pyoptools.raytrace.mat_lib.material module

The material library provides access to refractive index data for common optical glasses and generic organic and inorganic compounds.

All data is from www.refractiveindex.info. Please follow their guidelines for citation.

raytrace.mat_lib.material instances for optical glasses can be retrieved directly using dictionary-style access. For example:

material[‘N-BK7’]

In some cases, materials from different manufacturer catalogs may share the same identifier, in this case a KeyError will be raised. This can be resolved using attribute access given the name of the manufacturer catalog. For example:

``` m = material[‘SF11’]

KeyError: “Multiple matches for glass type SF11. Use one of: material.hikari[‘SF11’] or material.schott[‘SF11’]”

```

Compounds are also available through the attributes organic and inorganic. Note that in refractiveindex.info, inorganic is named _main_.

Often, multiple data sources are available for a given compound. These can be disambiguated using a trailing : followed by the name of the reference. For example:

` silver = material.inorganic['Ag:Yang'] ` If the reference is omitted then the first available reference will be returned.

Some glasses and compounds have common abbreviations. These can also be used, through the aliases system, which takes precedent in material retrieval. For example:

` m = material['SODA_LIME'] `

the full dictionary of available in the attribute material.aliases.

pyoptools.raytrace.mat_lib.material.find_material(search, printout=True, exact=False, unalias=False)

Search for a material where the string _search_ is found in the name or description. For example:

If printout is True, prints a list of the commands used to access the matching materials.

If exact is True, return only the items where the material name is an exact match of the search string.

If unalias is True, the materials found in the alises list, will be translated to the real material.

Returns a list of the keys which can be used to retrieve candidate materials.

Example finding all SF-11 type glasses: ``` material.find_material(‘SF11’)

material.hikari[‘J-SF11’] material.hikari[‘E-SF11’] material.hikari[‘SF11’] material.schott[‘N-SF11’] material.schott[‘SF11’]

```

Note that for compounds, the common name can be searched as well, for example:

``` material.find_material(‘styrene’)

material.organic[‘C8H8:Sultanova’] material.organic[‘C8H8:Myers’]

```

pyoptools.raytrace.mat_lib.material.get_from(name: str, libs: str, check_aliases=True)

Finds a glass type located in a specific manufacturer library, or space-separate list of libraries.

This is mostly used internally because many optical component definitions specify the glass catalogs in this way.

Note that this method is only available from the base material module.

name : name of the glass to find libs : A name of a manufacturer library, e.g. ‘schott’, or a list

of space-separate manufacturer names, in which case they will be searched in the order given. Insensitive to capitalization.

check_aliasesif True (default), will check within material

aliases after checking in specified libraries. Note that aliases can include compounds in addition to glasses.

Raise KeyError if no material found in the given libraries.

pyoptools.raytrace.mat_lib.material.get_glass_libraries()

Returns a list of strings containing the names of the glass libraries defined in PyOpTools

pyoptools.raytrace.mat_lib.material.get_glass_materials_from_library(libname)

Returns a list of strings containing the names of the materials defined in the library ‘libname’