rayoptics.seq.medium module
Module building on opticalglass for ray-optics material support
- decode_medium(*inputs, **kwargs) OpticalMedium[source]
Input utility for parsing various forms of glass input.
The inputs can have several forms:
refractive_index, v-number: float ->
opticalglass.modelglass.ModelGlassrefractive_index only: float ->
opticalglass.opticalmedium.ConstantIndexglass_name, catalog_name as 1 or 2 strings
an instance with a rindex attribute
air: str ->
opticalglass.opticalmedium.Airblank -> defaults to
opticalglass.opticalmedium.Air
- class GlassHandlerBase(filename)[source]
Bases:
objectBase class for glass matching capability.
This class is used to match catalog glasses to input glass names. It is implemented as a class for ease of use by file importers. If the glass can be matched up with an existing
opticalglasscatalog, the glass is instantiated and entered into the model. Searching includes the custom_glass_registry from the opticalglass package. If the glass cannot be found, a search for a .smx file of the same name as the model file is made. If found, it is a JSON file with a dict that provides an eval() string to create an instance to replace the missing glass name. If this file isn’t found, it is created and contains a JSON template of a dict that has the missing glass names as keys; the values are the number of times the glass occurs in the file. These values should be replaced with the desired eval() string to create a replacement glass.Subclasses, e.g. used for different importers, should implement a single method that can be called during the import process to return a glass instance given an input string.
- find_glass(name, catalog, always=True) OpticalMedium | None[source]
find name glass or a substitute or, if always is True, n=1.5
Include searching the custom_glass_registry from the opticalglass package.
- find_6_digit_code(name) OpticalMedium | None[source]
process name as a 6 digit glass code
- find_substitute_glass(name) OpticalMedium | None[source]
Try to find a similar glass to
name.
- handle_glass_not_found(name) OpticalMedium | None[source]
Record missing glasses or create new replacement glass instances.