pyOptiShared.Material.ExperimentalMaterial
- class pyOptiShared.Material.ExperimentalMaterial(mat_name: str, lamb: list[float] | ndarray = None, values: list[float | complex] | ndarray = None, zbEps: bool = True, color: str = None)
Bases:
Material
A material defined by experimental data, a list of wavelength permittivity/index values.
- Parameters:
mat_name (str) – Material name.
values (list[float] | numpy.ndarray) – Permittivity or Ref. Index values.
lamb (list[float] | numpy.ndarray) – Wavelength values.
zbEps (bool, optional) – If True idicates permittivity values. Otherwise, ref. index values. Defaults to True, permittivity values.
color (str, optional) – Material color to display
Methods
LoadText
(filename)This method loads experimental data from a text file.
SetFromRefDotInfo
(shelf, book, page[, ...])Sets the material properties according to refractiveindex.info.
eps
(wavelength)This method returns the permittivity at particular wavelengths.
eps_imag
(wavelength)Returns the real part of the permmittivity values.
eps_real
(wavelength)Returns the real part of the permmittivity values.
index
(wavelength)This method returns the refractive index at particular wavelengths.
index_imag
(wavelength)Return the imaginary part of the index of refraction at a given wavelengths.
index_real
(wavelength)Return the real part of the index of refraction at a given wavelengths.
Attributes
color
The color of the material for eventual visualization purposes.
mIntrpImag
mIntrpReal
mstrMode
name
Material name.
- LoadText(filename: str)
This method loads experimental data from a text file.
- The text file contains a header for two or three tab saparated columns:
Two Columns: first column is wavelength (wl) second is either real index or real permittivity.
Three Columns: first column is wavelength (wl) second is real index (n) or permittivity and third is imaginary index (k) or permittivity.
Remember to set
zbEps
toFalse
during instantiation if the material object data will be defined in terms of the refractive index. Otherwise, the defaultTrue
indicates the data corresponds to permittivity data.- Parameters:
filename (str) – Filename for a .txt file. If missing extention it append .txt.
- Raises:
ValueError – Unsupported file extension.
ValueError – If less then two or three headers in the file.
ValueError – If data line has length different than the header.
- SetFromRefDotInfo(shelf: str, book: str, page: str, wavelength_unit: float = 1e-06) → None
Sets the material properties according to refractiveindex.info.
This method is based on the Python interface to RefractiveIndex database.
By default the wavelength units are microns (um). This method checks if the extinction coefficient of the material is None. Then, it prints a message to report that no loss is modeled by this shelf/book/page material. Hence, reporting only a real permittivity or refractive index. Otherwise it is a complex array of elements.
In summary this method will replace the
eps()
andindex()
methods by those available in theRefractiveIndexMaterial
object from therefractiveindex
module.
- eps(wavelength: float | list[float] | ndarray) → ndarray
This method returns the permittivity at particular wavelengths.
The units are those defined by either the raw data arrays, external text file or those set when using RefractiveIndex.info wrapper.
When using the
SetFromRefDotInfo()
this method is overloaded.- Parameters:
wavelength (float | list[float] | numpy.ndarray) – A set of wavelength values to calculate the permittivity.
- Raises:
ValueError – If wavelength is outside the range of the experimental data.
- Returns:
Permittivity array for requested wavelength values.
- Return type:
- index(wavelength: float | list[float] | ndarray) → ndarray
This method returns the refractive index at particular wavelengths.
The units are those defined by either the raw data arrays, external text file or those set when using RefractiveIndex.info wrapper.
When using the
SetFromRefDotInfo()
this method is overloaded.- Parameters:
wavelength (float | list[float] | numpy.ndarray) – A set of wavelength values to calculate the ref. index.
- Raises:
ValueError – If wavelength is outside the range of the experimental data.
- Returns:
Refractive index array for requested wavelength values.
- Return type: