rayoptics.seq.medium module
Module building on opticalglass
for ray-optics material support
- decode_medium(*inputs, **kwargs)[source]
Input utility for parsing various forms of glass input.
The inputs can have several forms:
refractive_index, v-number: float ->
opticalglass.modelglass.ModelGlass
refractive_index only: float ->
opticalglass.opticalmedium.ConstantIndex
glass_name, catalog_name as 1 or 2 strings
an instance with a rindex attribute
air: str ->
opticalglass.opticalmedium.Air
blank -> defaults to
opticalglass.opticalmedium.Air
- class GlassHandlerBase(filename)[source]
Bases:
object
Base 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
opticalglass
catalog, the glass is instantiated and entered into the model. 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.