pyoptools.raytrace.library.library module

The optics library provides access to optical components from the catalogs of well-known optical suppliers or user-supplied libraries.

Currently, catalogs from Thorlabs [thorlabs.com] and Edmund [edmundoptics.com] are available.

Optical elements can be retrieved by part number using dictionary-style access from the library module i.e:

library[‘LB1862’] returns a SphericalLens based on an optic from Thorlabs.

optionally, the specific supplier catalog can be specified via attribute access. This can be used in the rare case that different catalogs have parts with matching part number, or to speed up lookup time. I.e.

library.Thorlabs[‘LB1862’]

It is also possible to retrieve a dictionary-descriptor for an optic without instantiating the optical component instance. This is done with the .descriptor() method. Descriptors can be used to instantiate optical components using the component.optic_factory.

The library module is iterable using .items(). This dictionary-style iterator returns component descriptor. A common usage is to search for optical components matching specific requirements.

User supplied catalogs can be added using the .add() method, which requires the path (string or Pathlib.Path) to a .json optic catalog file. The user supplied catalog can then be accessed by attribute using the given filename.