rayoptics.seq.sequential module
Manager class for a sequential optical model
- class SequentialModel(opt_model, do_init=True, **kwargs)[source]
Bases:
object
Manager class for a sequential optical model
A sequential optical model is a sequence of surfaces and gaps.
The sequential model has this structure
IfcObj Ifc1 Ifc2 Ifc3 ... Ifci-1 IfcImg \ / \ / \ / \ / GObj G1 G2 Gi-1
where
There are N interfaces and N-1 gaps. The initial configuration has an object and image Surface and an object gap.
The Interface API supports implementation of an optical action, such as refraction, reflection, scatter, diffraction, etc. The Interface may be realized as a physical profile separating the adjacent gaps or an idealized object, such as a thin lens or 2 point HOE.
The Gap class maintains a simple separation (z translation) and the medium filling the gap. More complex coordinate transformations are handled through the Interface API.
- opt_model
parent optical model
- lcl_tfrms
forward transform, interface to interface
- rndx
a list with refractive indices for all wvls
- z_dir
-1 if gap follows an odd number of reflections, otherwise +1
- gbl_tfrms
global coordinates of each interface wrt the 1st interface
- path(wl=None, start=None, stop=None, step=1)[source]
returns an iterable path tuple for a range in the sequential model
- Parameters:
wl – wavelength in nm for path, defaults to central wavelength
start – start of range
stop – first value beyond the end of the range
step – increment or stride of range
- Returns:
(ifcs, gaps, lcl_tfrms, rndx, z_dir)
- reverse_path(wl=None, start=None, stop=None, step=-1)[source]
returns an iterable path tuple for a range in the sequential model
- Parameters:
wl – wavelength in nm for path, defaults to central wavelength
start – start of range
stop – first value beyond the end of the range
step – increment or stride of range
- Returns:
(ifcs, gaps, lcl_tfrms, rndx, z_dir)
- calc_ref_indices_for_spectrum(wvls)[source]
returns a list with refractive indices for all wvls
- Parameters:
wvls – list of wavelengths in nm
- insert(ifc, gap, z_dir=1, idx=None)[source]
insert ifc and gap after cur_surface in seq_model lists
- remove(*args, prev=False)[source]
Remove surf and gap at cur_surface or an input index argument.
If no arguments are provided, the cur_surface is deleted. If a single index is provided, that interface/gap pair is deleted, otherwise a range of interface/gap pairs is deleted.
To avoid invalid sequence states, both an interface and a gap must be removed at the same time. The
prev
argument, if True, removes the gap preceding the interface. The default behavior is to remove the following gap.Neither the object not the image interfaces may be removed.
- remove_node(e_node)[source]
Remove the ifcs/gaps connected to e_node.
Return the first and last ifc indices.
- add_surface(surf_data, **kwargs)[source]
add a surface where surf_data is a list that contains:
[curvature, thickness, refractive_index, v-number, semi-diameter]
The curvature entry is interpreted as radius if radius_mode is True
The thickness is the signed thickness
The refractive_index, v-number entry can have several forms:
refractive_index, v-number (numeric)
refractive_index only -> constant index model
glass_name, catalog_name as 1 or 2 strings
an instance with a rindex attribute
air, str -> om.Air
blank -> defaults to om.Air
‘REFL’ -> set interact_mode to ‘reflect’
The semi-diameter entry is optional. It may also be entered using the sd keyword argument.
- apply_scale_factor_over(scale_factor, *surfs)[source]
Apply the scale_factor to the surfs arg.
If surfs isn’t present, the scale_factor is applied to all interfaces and gaps.
If surfs contains a single value, it is applied to that interface and gap.
If surfs contains 2 values it is considered an interface range and the scale_factor is applied to the interface range and the gaps contained between the outer interfaces.
- overall_length(os_idx=1, is_idx=-1)[source]
Sum gap thicknesses from os_idx to is_idx
The default arguments return the thickness sum between the 1st and last surfaces.
To include the image surface, is_idx=len(sm.gaps)
- Parameters:
os_idx – starting gap index
is_idx – final gap index
- Returns:
float, overal length of gap range
- Return type:
oal
- list_decenters(full=False)[source]
List decenter data and gap separations.
- Parameters:
full – lists all values if True, else only y offset and alpha tilt
- trace_grid(fct, fi, wl=None, num_rays=21, form='grid', append_if_none=True, **kwargs)[source]
fct is applied to the raw grid and returned as a grid
- compute_global_coords(glo=1, origin=None, **kwargs)[source]
Return global surface coordinates (rot, t) wrt surface glo.
- If origin isn’t None, it should be a tuple (r, t) being the transform
from the desired global origin to the specified global surface.
- gen_sequence(surf_data_list, **kwargs)[source]
create a sequence iterator from the surf_data_list
- Parameters:
surf_data_list – a list of lists containing: [curvature, thickness, refractive_index, v-number]
**kwargs – keyword arguments
- Returns:
(ifcs, gaps, rndx, lcl_tfrms, z_dir)
- create_surface_and_gap(surf_data, radius_mode=False, prev_medium=None, wvl=550.0, **kwargs)[source]
create a surface and gap where surf_data is a list that contains:
[curvature, thickness, refractive_index, v-number, semi-diameter]
The curvature entry is interpreted as radius if radius_mode is True
The thickness is the signed thickness
The refractive_index, v-number entry can have several forms:
refractive_index, v-number (numeric)
refractive_index only -> constant index model
glass_name, catalog_name as 1 or 2 strings
an instance with a rindex attribute
air, str -> om.Air
blank -> defaults to om.Air
‘REFL’ -> set interact_mode to ‘reflect’
The semi-diameter entry is optional. It may also be entered using the sd keyword argument.