rayoptics.optical.opticalmodel module
Top level model classes
- class SystemSpec(opt_model, **kwargs)[source]
Bases:
object
Container for units and other system level constants
- property dimensions
the model linear units (str).
- class OpticalModel(radius_mode=False, specsheet=None, **kwargs)[source]
Bases:
object
Top level container for optical model.
The OpticalModel serves as a top level container of model properties. Key aspects are built-in element and surface based repesentations of the optical surfaces. A sequential optical model is a sequence of surfaces and gaps. Additionally, it includes optical usage information to specify the aperture, field of view, spectrum and focus.
- ro_version
current version of rayoptics
- radius_mode
if True output radius, else output curvature
- system_spec
- seq_model
- optical_spec
- parax_model
- ele_model
- map_submodels(**kwargs)[source]
Setup machinery for model mapping api.
This function performs two tasks:
populating the submodel dict either with attributes or creating a new instance as needed.
populate a submodel alias dict with short versions of the wordy defining names
The first task must handle these use cases:
opt_model populated by importing a .roa file
an opt_model created interactively
an opt_model initialized by a lens file importer
- save_model(file_name, version=None)[source]
Save the optical_model in a ray-optics JSON file.
- Parameters:
file_name – str or Path
version – optional override for rayoptics version number
- update_model(**kwargs)[source]
Model and its constituents are updated.
- Parameters:
kwargs –
possible keyword arguments including:
build:
’rebuild’: rebuild the model “from scratch”, e.g number of nodes changes
’update’: number of nodes unchanged, just the parameters
src_model: model that originated the modification
- add_part(factory_fct, *args, **kwargs)[source]
Use a factory_fct to create a new part and insert into optical model.
- add_lens(**kwargs)[source]
Add a lens into the optical model
- Parameters:
kwargs –
keyword arguments including:
idx: insertion point in the sequential model
t: the thickness following a chunk when inserting
lens: tuple of cv1, cv2, th, glass_name_catalog, sd where:
cv1: front curvature
cv2: rear curvature
th: lens thickness
- glass_input: a str, e.g. ‘N-BK7, Schott’ or
refractive index or index/V-number pair
sd: lens semi-diameter
- add_assembly_from_seq(idx1, idx2, **kwargs)[source]
Create an Assembly from the elements in the sequence range.
- rebuild_from_seq()[source]
Rebuild ele_model and part_tree from seq_model.
When in doubt about whether there is a problem with bad data in an OpticalModel, this function can be used to rebuild everything from the sequential model.
- flip(*args, **kwargs)[source]
Flip a Part or an Interface range in the optical model.
The flip operation supports several different ways of specifying what is to be flipped.
Args:
None: This flips the model from ifc 1 to ifc image-1
idx1, idx2: This flips the model between interfaces idx1 and idx2. Flipping from object to image is disallowed.
part: This flips the corresponding part in the model
list: This flips a list of parts in the model
- insert_ifc_gp_ele(*descriptor, **kwargs)[source]
insert interfaces and gaps into seq_model and eles into ele_model
- Parameters:
descriptor – a tuple of additions for the sequential, element and part tree models
kwargs – keyword arguments including idx: insertion point in the sequential model insert: if True, insert the chunk, otherwise replace it t: the thickness following a chunk when inserting do_update: update seq_model and optical properties if True (default) src_model: the model originating the changes