rayoptics.elem.transform module

Useful transforms for processing sequential models

compute_global_coords(seq_model, glo: int = 1, origin: tuple[ndarray[tuple[Any, ...], dtype[float64]] | None, ndarray[tuple[Any, ...], dtype[float64]]] | None = None) list[tuple[ndarray[tuple[Any, ...], dtype[float64]] | None, ndarray[tuple[Any, ...], dtype[float64]]]][source]

Return global surface coordinates (rot, t) wrt surface glo.

Parameters:
  • seq_model – sequential model

  • glo – global reference surface index

  • origin – None | (r_origin, t_origin)

The tuple (r_origin, t_origin) is the transform from the desired global origin to the global surface glo.

compute_local_transforms(seq_model, seq, step) list[tuple[ndarray[tuple[Any, ...], dtype[float64]] | None, ndarray[tuple[Any, ...], dtype[float64]]]][source]

Return forward surface coordinates (r.T, t) for each interface.

list_tfrms(tfrms, sel: str = 'r+t', *args)[source]

Formatted output of transform lists.

Parameters:
  • tfrms – list of transforms to be output

  • sel – output selector, rotations (r), translations (t) or both (r+t)

Returns:

tfrms

forward_transform(s1, zdist, s2) tuple[ndarray[tuple[Any, ...], dtype[float64]] | None, ndarray[tuple[Any, ...], dtype[float64]]][source]

generate transform rotation and translation from s1 coords to s2 coords

reverse_transform(s2, zdist, s1) tuple[ndarray[tuple[Any, ...], dtype[float64]] | None, ndarray[tuple[Any, ...], dtype[float64]]][source]

generate transform rotation and translation from s2 coords to s1 coords, applying transforms in the reverse order

cascade_transform(r_prev: ndarray[tuple[Any, ...], dtype[float64]], t_prev: ndarray[tuple[Any, ...], dtype[float64]], r_seg: ndarray[tuple[Any, ...], dtype[float64]], t_seg: ndarray[tuple[Any, ...], dtype[float64]]) tuple[ndarray[tuple[Any, ...], dtype[float64]] | None, ndarray[tuple[Any, ...], dtype[float64]]][source]

take the seg transform and cascade it with the prev transform

transfer_coords(r_seg: ndarray[tuple[Any, ...], dtype[float64]], t_seg: ndarray[tuple[Any, ...], dtype[float64]], pt_s1: ndarray[tuple[Any, ...], dtype[float64]], dir_s1: ndarray[tuple[Any, ...], dtype[float64]]) tuple[ndarray[tuple[Any, ...], dtype[float64]] | None, ndarray[tuple[Any, ...], dtype[float64]]][source]

take p and d in s1 coords of seg and transfer them to s2 coords

transform_before_surface(interface, ray_seg: tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

Transform ray_seg from interface to previous seg.

Parameters:
  • interface – the Interface for the path sequence

  • ray_seg – ray segment exiting from interface

Returns:

(b4_pt, b4_dir)

  • b4_pt - ray intersection pt wrt following seg

  • b4_dir - ray direction cosine wrt following seg

transform_after_surface(interface, ray_seg: tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

Transform ray_seg from interface to following seg.

Parameters:
  • interface – the Interface for the path sequence

  • ray_seg – ray segment exiting from interface

Returns:

(b4_pt, b4_dir)

  • b4_pt - ray intersection pt wrt following seg

  • b4_dir - ray direction cosine wrt following seg