Developer’s Guide
Module contents
package supplying optical glass data from vendor supplied data
The opticalglass
package currently supports the following vendors:
CDGM
Hikari
Hoya
Ohara
Schott
Sumita
The spreadsheets from the vendors are in the data
directory. They are
imported using pandas
into DataFrame
instances, one per catalog.
The data in the catalog DataFrame
is used unchanged from the import; only
the data headers are modified for consistency across catalogs. The
create_glass()
function returns a glass object, given
the glass and catalog names.
An interface to the RefractiveIndex.INFO
database is provided by the rindexinfo
module. read_rii_file()
and read_rii_url()
return the native yaml representation
used by RefractiveIndex.INFO. The create_material()
function returns an object depending on the yaml database specification. If
the material is specified by an interpolating polynomial, a RIIMedium
instance is returned. If the material is specified by a set of data points,
an InterpolatedMedium
instance is returned.
A set of legacy catalogs, circa 1980, is available via the
Robb1983Catalog
class. The data used by this class is from
the 1983 paper by Paul N. Robb and R. I. Mercado, Calculation of
refractive indices using Buchdahl’s chromatic coordinate . The catalogs include:
Hoya
Ohara
Schott
Chance
Corning-France
The authors fitted a Buchdahl quadratic model to the glass data that has a standard deviation of 0.00002 and a maximum absolute error of 0.0001 in the visible spectral region.
Fitting and modeling glass data using the Buchdahl chromatic coordinate is
supported in the buchdahl
module.
Submodules
opticalmedium
Module for simple optical media definitions
- glass_encode(n, v)
- glass_decode(gc)
- class OpticalMedium(*args, **kwargs)
Bases:
Protocol
Protocol for media with optical properties, e.g. refractive index.
- abstract calc_rindex(wv_nm: float | ndarray[Any, dtype[_ScalarType_co]]) float | ndarray[Any, dtype[_ScalarType_co]]
returns the interpolated refractive index at wv_nm
- class Air(*args, **kwargs)
Bases:
OpticalMedium
Optical definition for air (low fidelity definition)
- calc_rindex(wv_nm: float | ndarray[Any, dtype[_ScalarType_co]]) float | ndarray[Any, dtype[_ScalarType_co]]
returns the interpolated refractive index at wv_nm
- class ConstantIndex(nd, lbl, cat='')
Bases:
OpticalMedium
Constant refractive index medium.
- name()
- catalog_name()
- calc_rindex(wv_nm_)
returns the interpolated refractive index at wv_nm
- class InterpolatedMedium(label, pairs=None, wvls=None, rndx=None, kvals=None, kvals_wvls=None, cat='')
Bases:
OpticalMedium
Optical medium defined by a list of wavelength/index pairs
- label
required string identifier for the material
- wvls
list of wavelengths in nm, used as x axis
- rndx
list of refractive indices corresponding to the values in wvls
- kvals_wvls
list of wavelengths in nm, used as x axis
- kvals
list of absorption coefficents corresponding to the values in kvals_wvls
- rindex_interp
the refractive index interpolation function
- kvals_interp
the kval interpolation function
- calc_rindex(wv_nm: float | ndarray[Any, dtype[_ScalarType_co]]) float | ndarray[Any, dtype[_ScalarType_co]]
returns the interpolated refractive index at wv_nm
- meas_rindex(wvl: str) float
returns the measured refractive index at wvl
For InterpolatedMedium the measured index isn’t directly known. The calculated index is used instead. Calling rindex handles the spectral line conversion.
- transmission_data(thi=10.0)
returns an array of transmission data for the glass
Returns: np.arrays of wavelength and transmission for thi mm sample
glass
Support for Glass catalogs and instances
The glass
module contains the two base classes fundamental to the
opticalglass
module. The GlassCatalog
class
implements as much of the common functionality needed for access to the
catalog data as possible.
The Glass
is an interface to the data for a particular
glass in a catalog. The primary function of interest for optical calculations
is rindex()
which returns the refractive index at the
input wavelength (nm).
A factory interface to Glass
creation is the function
create_glass()
that returns a Glass
instance of the appropriate catalog type, given the glass and catalog names.
- get_filepath(fname)
given a (spreadsheet) file name, return a complete Path to the file
The data files included with the
opticalglass
package are located in a data directory in the package hierarchy.opticalglass/ opticalglass/ data/ fname
- get_glass_map_arrays(cat, d_str, F_str, C_str, **kwargs)
return index and dispersion data arrays for input spectral range
- Parameters:
- Returns:
index, V-number, partial dispersion, Buchdahl coefficients, and glass names
- glass_catalog_factory(cat_name, mod_name=None, cls_name=None)
Function returning a glass catalog instance.
- Parameters:
catalog – name of supported catalog (CDGM, Hoya, Ohara, Schott)
mod_name – the module name of the glass catalog
cls_name – the class name of the glass catalog
- Raises:
GlassCatalogNotFoundError – if catalog isn’t found
- xl_cols()
Generate Excel column labels, A thru ZZ.
- xl2df(fname)
Read Excel fname into a dataframe and apply Excel based column names.
- build_glass_cat(xl_df, series_mappings, item_mappings, *args, **kwargs)
Apply series and item mappings to xl_df, and return catalog df.
- class GlassCatalogPandas(name, fname, series_mappings, item_mappings, *args, **kwargs)
Bases:
object
Pandas-based glass catalog
Optical glass manufacturers have settled on Excel spreadsheets as a means of documenting the technical details of their glass products. The formats are broadly similar but different in the details. This class and related functions provide a means of mapping the Excel data into a pandas dataframe that has some categories relabeled to take advantage of commonalities.
The class is adapted to a specific catalog by defining the position and size of the data areas in the original Excel spreadsheet. Pandas is used to read the spreadsheet into a dataframe, xl_df. xl_df has indices and columns that match the Excel worksheet border.
the index runs from 1 to xl_df.shape[0]
the columns match the pattern ‘A’, ‘B’, ‘C’, … ‘Z’, ‘AA’, ‘AB’, …
This facilitates transferring areas on the spreadsheet to areas in the catalog DataFrame.
Manufacturers spreadsheets have a header area and a data area. First, a set of parameters are defined for the header. Data that are spread over multiple columns form a category, often readily identified in the spreadsheet layout.
num_rows = 2 # number of header rows in the imported spreadsheet category_row = 1 # row with categories header_row = 2 # row with data item/header info data_col = 'B' # first column of data in the imported spreadsheet args = num_rows, category_row , header_row, data_col
The location of the different categories in the spreadsheet is defined in the series_mapping list.
series_mappings = [ ('refractive indices', (lambda h: h.split('n')[-1]), category_row, 'C', 'P'), ('dispersion coefficients', None, category_row, 'V', 'AA'), ('internal transmission mm, 10', None, header_row, 'DC', 'EK'), ('chemical properties', None, category_row, 'AW', 'BA'), ('thermal properties', None, category_row, 'BB', 'BI'), ('mechanical properties', None, category_row, 'BJ', 'BO'), ]
There are common items of interest, that correspond to a single column. These are defined in the item_mappings list.
item_mappings = [ ('refractive indices', 'C', header_row, 'F'), ('refractive indices', "C'", header_row, 'G'), ('abbe number', 'vd', header_row, 'R'), ('abbe number', 've', header_row, 'S'), ('specific gravity', 'd', header_row, 'BP'), ] kwargs = dict( data_extent = (3, 242, data_col, 'FZ'), name_col_offset = 'A', )
- name
the glass catalog name
- glass_list
- glass_lookup
- abstract create_glass(gname: str, gcat: str) OpticalMedium
Create an instance of the glass gname.
Must be implemented by the subclasses.
- catalog_name()
- get_glass_names()
returns a list of glass names
- get_column_names()
returns a list of column headers
- glass_index(gname)
returns the glass index (row) for glass name gname
- data_index(dname)
returns the data index (column) for data dname
- Parameters:
dname (str) – header string for data
- Returns:
the 1-based index (column) of the requested data
- Return type:
- Raises:
GlassDataNotFoundError – if dname doesn’t match any header string
- get_data_for_glass(gname, dindex=None, num=None)
returns an array of glass data for the glass at gname
- Parameters:
gname – glass index into spreadsheet
dindex – the starting column of the desired data
num – number of data items (cells) to retrieve
Returns: list of data items
- glass_data(gindex)
returns an array of data for the glass at gindex
- glass_coefs(gname)
returns an array of glass coefficients for the glass at gname
- catalog_data(dindex)
returns an array of data at column dindex for all glasses
- transmission_data(gname)
returns an array of transmission data for the glass at gindex
- Parameters:
gname – glass name
- Returns:
list of wavelength, transmittance pairs
- class GlassPandas(gname)
Bases:
OpticalMedium
base optical glass, for use with pandas
- gname
the glass name
- catalog
the GlassCatalog this glass is associated with. Must be provided by the derived class
- coefs
list of coefficients for calculating refractive index vs wv
- sync_to_restore()
hook routine to restore coefs, if needed
- initialize_catalog()
subclass initialization of glass catalog instance, as needed.
- glass_code(d_str='d', vd_str='vd')
returns the 6 digit glass code, combining index and V-number
- glass_data()
returns the raw spreadsheet data for the glass as a Series
- meas_rindex(wvl)
returns the measured refractive index at wvl
- calc_rindex(wv_nm: float | ndarray[Any, dtype[_ScalarType_co]]) float | ndarray[Any, dtype[_ScalarType_co]]
returns the interpolated refractive index at wv_nm
Must be provided by the derived class
- transmission_data()
returns an array of transmission data for the glass
Returns: np.arrays of wavelength and transmission for 10mm sample
- decode_glass_name(glass_name)
Split glass_name into prefix, group, num, suffix.
Manufacturers glass names follow a common pattern. At the simplest, it is a short character string, typically used to identify a particular glass composition, with a numeric qualifier. The composition group and product serial number are combined to form the basic product id, the group_num:
F2
SF56
Manufacturers will often use a single character prefix to indicate different categories of glasses, e.g. moldable or “New”:
N-BK7
P-LASF50
Similarly, a suffix with one or more characters is often used to differentiate between different variations of the same base material.
N-SF57
N-SF57HT
N-SF57HTultra
This function takes an input glass name and returns a tuple of strings. A valid glass_name should always have a non-null group_num; prefixes and suffixes are optional and used differently by different manufacturers.
group_num, prefix, suffix
group, num = group_num
- Parameters:
glass_name (str) – a glass manufacturer’s glass name
Returns: group_num, prefix, suffix, where group_num = group, num
Returned strings are uppercase.
- glass_catalog_stats(glass_list, do_print=False)
Decode all of the glass names in glass_cat_name.
Print out the original glass names and the decoded version side by side.
- Parameters:
glass_list – ((group, num), prefix, suffix), glass_name, glass_cat_name
do_print (bool) – if True, print the glass name and the decoded version
- Returns:
all catalog groups group_num (dict): all glasses with multiple variants prefixes (dict): all the non-null prefixes used suffixes (dict): all the non-null suffixes used
- Return type:
groups (dict)
- class Robb1983Catalog(*args, **kwargs)
Bases:
object
glass catalog based on data in Robb, et als 1983 paper on Buchdahl’s chromatic coordinate
The data used by this class is from the 1983 paper by Paul N. Robb and R. I. Mercado, Calculation of refractive indices using Buchdahl’s chromatic coordinate . The copyright date for all 5 catalogs cited was 1980.
- Parameters:
fname – filename, located in
data
directory
- glass_db
dict lookup by catalog and glass name, value is decoded glassname and Buchdahl coefficients
- glass_list
list of decoded_glassname, glassname, and catalog per glass
- property glass_data
- create_glass(gname: str, gcat: str) OpticalMedium
- catalog_name()
- get_glass_names(gcat=None)
returns a list of glass names
- glass_map_data(wvl='d', **kwargs)
return index and dispersion data for all glasses in the catalog
- Parameters:
wvl (str) – the central wavelength for the data, either ‘d’ or ‘e’
- Returns:
index, V-number, partial dispersion, Buchdahl coefficients, and glass names
- get_glass_map_arrays(d_str, F_str, C_str, **kwargs)
return index and dispersion data arrays for input spectral range
glassfactory
Interfaces for commercial glass catalogs
The glassfactory module is intended to be the primary method by which glass instances are created. The
create_glass()
is the public factory function for this purpose. The public functionget_glass_catalog()
returns the glass catalog instance corresponding to the input string.
- create_glass(*name_catalog)
Factory function returning a catalog glass instance.
The input argument list can take several forms:
1 string argument in the form ‘glass_name,catalog_name’
2 arguments. The first is a string glass name. The second is a string or list of strings of catalog names.
If 2 arguments are used and the catalog is “rindexinfo”, the “name” field is taken as a URL or filepath to a material in the RefractiveIndex.INFO database.
- Parameters:
*name_catalog – tuple of 1 or 2 input items
- Raises:
GlassCatalogNotFoundError – if catalog isn’t found
GlassNotFoundError – if name isn’t in the specified catalog
- get_glass_catalog(cat_name, mod_name=None, cls_name=None)
Function returning a glass catalog instance.
- Parameters:
catalog – name of supported catalog (CDGM, Hoya, Ohara, Schott)
- Raises:
GlassCatalogNotFoundError – if catalog isn’t found
- fill_catalog_list(cat_list=None)
Given a list of catalog names, populate the _catalog_list with them.
modelglass
Module for optical glass models based on index/v-number
- model_from_glasses(gla1, gla2)
Create a model from the slope between two glasses.
- class ModelGlass(nd: float, vd: float, mat: str, cat: str = 'user')
Bases:
OpticalMedium
Optical medium defined by a glass code, i.e. index - V number pair
- sync_to_restore()
- glass_code()
- name()
- catalog_name()
- calc_rindex(wv_nm)
returns the interpolated refractive index at wv_nm
- meas_rindex(wvl)
returns the measured refractive index at wvl
- update(nd, vd)
buchdahl
Buchdahl chromatic coordinate modeling and support
- get_wv(wavelength)
Return the wavelength in micrometers.
- omega(delta_lambda)
Calculate the Buchdahl chromatic coordinate.
- omega2wvl(om)
- calc_buchdahl_coords(nd, nF, nC, wlns=('d', 'F', 'C'), ctype=None, **kwargs)
Given central, blue and red refractive indices, calculate the Buchdahl chromatic coefficients.
- Parameters:
nd – central refractive index
nF – “blue” refractive index
nC – “red” refractive index
wlns – wavelengths for the 3 refractive indices
ctype – if “disp_coefs”, return dispersion coefficients, otherwise the quadratic coefficients
- fit_buchdahl_coords(indices, degree=2, wlns=['d', 'h', 'g', 'F', 'e', 'C', 'r'])
Given central, 4 blue and 2 red refractive indices, do a least squares fit for the Buchdahl chromatic coefficients.
- class Buchdahl(wv0, rind0, coefs, mat='', cat='')
Bases:
OpticalMedium
Quadratic Buchdahl refractive index model.
\[N(\omega) = {N_0} + \nu_1\omega + \nu_2\omega^2\]\(\omega\) is the Buchdahl chromatic coordinate for the input wavelength
\(\nu_1, \nu_2\) are the linear and quadratic coefficients of the model
\({N_0}\) is the refractive index at the central wavelength of the fit
The Buchdahl chromatic coordinate \(\omega\) is defined as:
\[\omega(\lambda) = \frac{\lambda - \lambda_0}{1 + 5/2(\lambda - \lambda_0)}\]- name()
- catalog_name()
- glass_code()
- rindex(wvl)
Returns the refractive index from the quadratic model at wvl.
- calc_rindex(wv_nm)
returns the interpolated refractive index at wv_nm
spectral_lines
Support for using wavelength values and spectral line designations interchangably.
- spectra = {"A'": 768.195, 'C': 656.2725, "C'": 643.8469, 'D': 589.2938, 'F': 486.1327, "F'": 479.9914, 'He-Cd': 441.57, 'He-Ne': 632.8, 'Nd': 1060.0, 'd': 587.5618, 'e': 546.074, 'g': 435.8343, 'h': 404.6561, 'i': 365.014, 'r': 706.5188, 's': 852.11, 't': 1013.98}
dict:
keys: spectral line labels
values: wavelengths in nm
- get_wavelength(wvl) float | ndarray[Any, dtype[_ScalarType_co]]
Return wvl in nm, where wvl can be a spectral line
Example:
In [1]: from rayoptics.util.spectral_lines import * In [2]: wl_e = get_wavelength('e'); wl_e Out[2]: 546.074 In [3]: wl_HeNe = get_wavelength('He-Ne'); wl_HeNe Out[3]: 632.8 In [4]: wl_550 = get_wavelength(550); wl_550 Out[4]: 550.0 In [5]: wl_fl = get_wavelength(555.0); wl_fl Out[5]: 555.0 In [6]: wl_f = get_wavelength('F'); wl_f Out[6]: 486.1327
- Parameters:
wvl – either the wavelength in nm, a string with a spectral line identifier or a pandas Index. Case sensitive - Fraunhofer lines have a proper capitalization. The keys need to match exactly.
- Returns:
the wavelength in nm, or a numpy array of floats
- Return type:
- Raises:
KeyError – if
wvl
is not in the spectra dictionary
util
Utilities including Singleton metaclass
- class Counter
Bases:
dict
A dict that initializes a missing key’s value to 0.
Example
track_changes = Counter() track_changes[‘something happened’] += 1 track_changes[‘something not found’] += 1
- class Singleton
Bases:
type
A metaclass implementation for the Singleton pattern.
Example
- class JustOne(metaclass=Singleton):
pass
- rgb2mpl(rgb)
convert 8 bit RGB data to 0 to 1 range for mpl
- calc_glass_constants(nd, nF, nC, *partials)
Given central, blue and red refractive indices, calculate Vd and PFd.
- Parameters:
nd – refractive indices at central, short and long wavelengths
nF – refractive indices at central, short and long wavelengths
nC – refractive indices at central, short and long wavelengths
partials (tuple) – if present, 2 ref indxs, n4 and n5, wl4 < wl5
- Returns:
V-number and relative partial dispersion from F to d
If partials is present, the return values include the central wavelength index and the relative partial dispersion between the 2 refractive indices provided from partials.
glasserror
Support for Glass catalog exception handling
- exception GlassCatalogNotFoundError(catalog)
Bases:
GlassError
Exception raised when glass catalog name not found
- exception GlassNotFoundError(catalog, name)
Bases:
GlassError
Exception raised when glass name not found
- exception GlassDataNotFoundError(catalog, data)
Bases:
GlassError
Exception raised when glass data item not found
- exception GlassDBNotSupported(db)
Bases:
GlassError
Exception: data-n2 rindexinfo database is requested.
GUI Submodules
glassmap
Glass map display, via Matplotlib
- class GlassMapDB(*args)
Bases:
object
Simple model to support Model/View architecture for Glass map views
- catalogs
list of objects that respond to
glass_map_data()
- get_data_at(i, **kwargs)
- get_data_set_label_at(i)
- class GlassMapSet(glasses, cat_name)
Bases:
object
Set of glass instances to be displayed in a GlassMapFigure.
- catalog_name()
- glass_map_data(wvl='d', **kwargs)
- calc_glass_map_arrays(glasses, d_str, F_str, C_str, **kwargs)
return index and dispersion data arrays for input spectral range
- Parameters:
- Returns:
index, V-number, partial dispersion, Buchdahl coefficients, and glass names
- class GlassMapFigure(glass_db, db_display=None, hover_glass_names=True, plot_display_type='Refractive Index', refresh_gui=None, **kwargs)
Bases:
Figure
Matplotlib implementation of an optical glass map.
- glass_db
an instance of
GlassMapDB
- db_display
list of boolean flags to control catalog display
- hover_glass_names
if True display glass name list under cursor
- plot_display_type
controls the type of data display. Supported types are:
“Refractive Index”
“Partial Dispersion”
“Buchdahl Coefficients”
“Buchdahl Dispersion Coefficients”
- refresh_gui
an optional function called when a glass is picked
- pick_list
list of glasses selected by a mouse click. The on_pick fct accumulates the pick_list. Filled with:
catalog_name, glass_name, nd, vd, PCd
- dsc = [(0.2196078431372549, 0.5568627450980392, 0.5568627450980392), (0.5215686274509804, 0.5215686274509804, 0.5215686274509804), (0.44313725490196076, 0.44313725490196076, 0.7764705882352941), (0.4, 0.803921568627451, 0), (1.0, 0.4470588235294118, 0.33725490196078434), (1.0, 0.6470588235294118, 0.0), (0.5450980392156862, 0.5450980392156862, 0.5137254901960784)]
- mkr = ['^', 'x', '2', 's', 'v', '+', '*', 'D', 'o']
- home_bbox = Bbox([[95.0, 1.45], [20.0, 2.05]])
- connect_events(action_dict=None)
connect to all the events we need
- disconnect_events()
disconnect all the stored connection ids
- get_display_label()
Return the type of plot being displayed.
- refresh(**kwargs)
Call update_data() followed by plot(), return self.
- Parameters:
kwargs – keyword arguments are passed to update_data
- Returns:
self (class Figure) so scripting envs will auto display results
- update_data(**kwargs)
Fill in raw_data array.
The raw_data attribute is a list over catalogs. Each catalog has an item consisting of the catalog name and a tuple of vectors:
n, v, p, coefs0, coefs1, glass_names
- update_axis_limits(bbox)
Update the axis limits basde on the data bounding box.
- draw_axes()
Draw and label the axes.
- plot()
Draw the glass map.
- draw_glass_polygons()
Draw the glass polygons on the map.
- clear_pick_table()
Reset the pick list.
- find_artists_at_location(event)
Returns a list of shapes in zorder at the event location.
- on_hover(event)
Display the glasses under the cursor.
- on_pick(event)
handle picking glasses under the cursor.
One pick event for each catalog, extract selected glasses and add to pick_list
- on_press(event)
handle mouse clicks within the diagram.
The button press event is sent after the pick events; it will be sent in cases with no pick events, e.g. clicking in an empty area of the axes. The two cases are:
if there were pick events, needsClear will be False so that items from different artists can be accumulated in the pick_list. The press event signals no further item accumulation. Flip needsClear to True so the next pick or press event will clear the pick_list.
if there were no pick events, needsClear will be True. Call clear_pick_table to empty pick_list and reset needsClear to False.
- updateVisibility(indx, state)
Update the visibility and redraw.
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, canvas=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, constrained_layout=<UNSET>, constrained_layout_pads=<UNSET>, dpi=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, figheight=<UNSET>, figwidth=<UNSET>, frameon=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, layout_engine=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, size_inches=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tight_layout=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)
Set multiple properties at once.
Supported properties are
- Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None animated: bool canvas: FigureCanvas clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: ~matplotlib.figure.Figure figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: {‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None} linewidth: number mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float
glassmapviewer
desktop application for viewing glass catalog data
- init_UI(gui_parent, fig)
- createPlotTypeBox(gui_parent, fig)
- createPartialsBox(gui_parent, fig)
- on_plot_type_toggled(fig, button)
- createCatalogGroupBox(gui_parent, fig)
- create_handle_checkbox(fig, cb_number)
- class GlassMapViewer
Bases:
QMainWindow
- refresh_gui(**kwargs)
- staticMetaObject = PySide6.QtCore.QMetaObject("GlassMapViewer" inherits "QMainWindow": )
- class PickTable(gui_parent, pick_model)
Bases:
QTableView
- mousePressEvent(event)
Initiate glass drag and drop operation from here.
- staticMetaObject = PySide6.QtCore.QMetaObject("PickTable" inherits "QTableView": )
- class PickModel(fig)
Bases:
QAbstractTableModel
- rowCount(self, parent: PySide6.QtCore.QModelIndex | PySide6.QtCore.QPersistentModelIndex = Invalid(PySide6.QtCore.QModelIndex)) int
- columnCount(self, parent: PySide6.QtCore.QModelIndex | PySide6.QtCore.QPersistentModelIndex = Invalid(PySide6.QtCore.QModelIndex)) int
- headerData(self, section: int, orientation: PySide6.QtCore.Qt.Orientation, role: int = Instance(Qt.DisplayRole)) Any
- data(self, index: PySide6.QtCore.QModelIndex | PySide6.QtCore.QPersistentModelIndex, role: int = Instance(Qt.DisplayRole)) Any
- fill_table(pick_list)
- staticMetaObject = PySide6.QtCore.QMetaObject("PickModel" inherits "QAbstractTableModel": )
- class PlotCanvas(gui_parent, fig)
Bases:
FigureCanvasQTAgg
- staticMetaObject = PySide6.QtCore.QMetaObject("PlotCanvas" inherits "FigureCanvasQTAgg": )
- main()
glasspolygons
create glass map glass designation polygons
- find_glass_designation(nd, vd)
find the designation and rgb color for the input index and V number
- Parameters:
nd – refractive index, d line
vd – V-number, d line
- Returns:
designation label, RGBA list
Catalog-specific Submodules
cdgm
Support for the CDGM Glass catalog
- class CDGMCatalog(*args, **kwargs)
Bases:
GlassCatalogPandas
- class CDGMGlass(gname)
Bases:
GlassPandas
- catalog = None
- initialize_catalog()
subclass initialization of glass catalog instance, as needed.
hikari
Support for the Hikari Glass catalog
- class HikariCatalog(*args, **kwargs)
Bases:
GlassCatalogPandas
- get_rindx_wvl()
Returns the wavelength value from the refractive index data header string.
- get_transmission_wvl()
Returns the wavelength header string.
- create_glass(gname: str, gcat: str) HikariGlass
Create an instance of the glass gname.
- class HikariGlass(gname)
Bases:
GlassPandas
- catalog = None
- initialize_catalog()
subclass initialization of glass catalog instance, as needed.
hoya
Support for the Hoya Glass catalog
- class HoyaCatalog(*args, **kwargs)
Bases:
GlassCatalogPandas
- glass_coefs(gname)
returns an array of glass coefficients for the glass at gname
- class HoyaGlass(gname)
Bases:
GlassPandas
- catalog = None
- initialize_catalog()
subclass initialization of glass catalog instance, as needed.
ohara
Support for the Ohara Glass catalog
- class OharaCatalog(*args, **kwargs)
Bases:
GlassCatalogPandas
- get_rindx_wvl()
Returns the wavelength value from the refractive index data header string.
- create_glass(gname: str, gcat: str) OharaGlass
Create an instance of the glass gname.
- class OharaGlass(gname)
Bases:
GlassPandas
- catalog = None
- initialize_catalog()
subclass initialization of glass catalog instance, as needed.
schott
Support for the Schott Glass catalog
- class SchottCatalog(*args, **kwargs)
Bases:
GlassCatalogPandas
- get_rindx_wvl()
Returns the wavelength value from the refractive index data header string.
- get_transmission_wvl()
Returns the wavelength value from the transmission data header string.
- create_glass(gname: str, gcat: str) SchottGlass
Create an instance of the glass gname.
- class SchottGlass(gname)
Bases:
GlassPandas
- catalog = None
- initialize_catalog()
subclass initialization of glass catalog instance, as needed.
sumita
Support for the Sumita Glass catalog
- class SumitaCatalog(*args, **kwargs)
Bases:
GlassCatalogPandas
- get_rindx_wvl()
Returns the wavelength value from the refractive index data header string.
- get_transmission_wvl()
Returns the wavelength value from the transmission data header string.
- create_glass(gname: str, gcat: str) SumitaGlass
Create an instance of the glass gname.
- class SumitaGlass(gname)
Bases:
GlassPandas
- catalog = None
- initialize_catalog()
subclass initialization of glass catalog instance, as needed.
rindexinfo
Interface to the RefractiveIndex.INFO database
- create_glass(file_url: str | Path) OpticalMedium
Create a glass from the RefractiveIndex.Info (RII) database.
- Parameters:
file_url – Union[str, Path]: a file path or a URL to the RII item
The URL must be rooted in the domain https://refractiveindex.info.
- create_material(yaml_data: Any, label: str, catalog: str, db: str) OpticalMedium
Create a material object given yaml data and identifiers.
- read_coefficients(material_data, material_type)
- read_data_arrays(material_data, material_type)
- validate_wvls(wv_um, data_range)
- eval_formula_1(wv_nm, coeff, data_range=None)
Sellmeier (preferred)
- eval_formula_2(wv_nm, coeff, data_range=None)
Sellmeier 2
- eval_formula_3(wv_nm, coeff, data_range=None)
Polynomial
- eval_formula_4(wv_nm, coeff, data_range=None)
RefractiveIndex.INFO
- eval_formula_5(wv_nm, coeff, data_range=None)
Cauchy
- eval_formula_6(wv_nm, coeff, data_range=None)
Gases
- eval_formula_7(wv_nm, coeff, data_range=None)
Hertzberger
- eval_formula_8(wv_nm, coeff, data_range=None)
Retro
- eval_formula_9(wv_nm, coeff, data_range=None)
Exotic
- class RIIMedium(label, coefs, rndx_fct, data_range=None, kvals_wvls=None, kvals=None, mat='', cat='')
Bases:
OpticalMedium
- calc_rindex(wv_nm: float | ndarray[Any, dtype[_ScalarType_co]]) float | ndarray[Any, dtype[_ScalarType_co]]
returns the interpolated refractive index at wv_nm
- meas_rindex(wvl: str) float
returns the measured refractive index at wvl
For InterpolatedMedium the measured index isn’t directly known. The calculated index is used instead. Calling rindex handles the spectral line conversion.
- transmission_data(thi=10.0)
returns an array of transmission data for the glass
Returns: np.arrays of wavelength and transmission for thi mm sample
- summary_plots(opt_medium, opt_medium_yaml=None)
plot refractive index and thruput data, when available.