xopto.materials.absorption.base module

class Absorption(t=293, trange: Optional[Tuple[float, float]] = None)[source]

Bases: object

Base class of material density.

Parameters
  • t (float) – Default medium temperature.

  • trange (Tuple[float, float] or None) – Valid temperature range in K as (min, max).

check_temperature(t: float)[source]

Checks if the temperature of medium is within the valid range.

Parameters

temperature (float or np.ndarray) – Temperature(s) to check.

Note

Reports a warning if the temperature of the medium is not within the valid range. If the temperature input argument is a numpy array, the call reports a warning if any of the temperatures are not within the valid range.

is_valid_temperature(temperature: float)bool[source]

Checks if the temperature of the medium is within the valid range.

Parameters

temperature (float or np.ndarray) – Temperature to check.

Returns

valid – Returns True if the temperature is within the valid range. If the temperature input argument is a numpy array, the call returns True only if all the temperatures are within the valid range.

Return type

bool

plot(**kwargs)[source]

Plot the temperature dependence of the density.

Parameters

kwargs (dict) – Keyword arguments passed to the __call__ method of the instance.

property t: float

Default temperature of the material in K.

property temperature: float

Default temperature of the material in K.

property trange: Tuple[float, float]

Valid temperature range in K.

DEFAULT_WAVELENGTHS = array([4.00e-07, 4.01e-07, 4.02e-07, 4.03e-07, 4.04e-07, 4.05e-07,        4.06e-07, 4.07e-07, 4.08e-07, 4.09e-07, 4.10e-07, 4.11e-07,        4.12e-07, 4.13e-07, 4.14e-07, 4.15e-07, 4.16e-07, 4.17e-07,        4.18e-07, 4.19e-07, 4.20e-07, 4.21e-07, 4.22e-07, 4.23e-07,        4.24e-07, 4.25e-07, 4.26e-07, 4.27e-07, 4.28e-07, 4.29e-07,        4.30e-07, 4.31e-07, 4.32e-07, 4.33e-07, 4.34e-07, 4.35e-07,        4.36e-07, 4.37e-07, 4.38e-07, 4.39e-07, 4.40e-07, 4.41e-07,        4.42e-07, 4.43e-07, 4.44e-07, 4.45e-07, 4.46e-07, 4.47e-07,        4.48e-07, 4.49e-07, 4.50e-07, 4.51e-07, 4.52e-07, 4.53e-07,        4.54e-07, 4.55e-07, 4.56e-07, 4.57e-07, 4.58e-07, 4.59e-07,        4.60e-07, 4.61e-07, 4.62e-07, 4.63e-07, 4.64e-07, 4.65e-07,        4.66e-07, 4.67e-07, 4.68e-07, 4.69e-07, 4.70e-07, 4.71e-07,        4.72e-07, 4.73e-07, 4.74e-07, 4.75e-07, 4.76e-07, 4.77e-07,        4.78e-07, 4.79e-07, 4.80e-07, 4.81e-07, 4.82e-07, 4.83e-07,        4.84e-07, 4.85e-07, 4.86e-07, 4.87e-07, 4.88e-07, 4.89e-07,        4.90e-07, 4.91e-07, 4.92e-07, 4.93e-07, 4.94e-07, 4.95e-07,        4.96e-07, 4.97e-07, 4.98e-07, 4.99e-07, 5.00e-07, 5.01e-07,        5.02e-07, 5.03e-07, 5.04e-07, 5.05e-07, 5.06e-07, 5.07e-07,        5.08e-07, 5.09e-07, 5.10e-07, 5.11e-07, 5.12e-07, 5.13e-07,        5.14e-07, 5.15e-07, 5.16e-07, 5.17e-07, 5.18e-07, 5.19e-07,        5.20e-07, 5.21e-07, 5.22e-07, 5.23e-07, 5.24e-07, 5.25e-07,        5.26e-07, 5.27e-07, 5.28e-07, 5.29e-07, 5.30e-07, 5.31e-07,        5.32e-07, 5.33e-07, 5.34e-07, 5.35e-07, 5.36e-07, 5.37e-07,        5.38e-07, 5.39e-07, 5.40e-07, 5.41e-07, 5.42e-07, 5.43e-07,        5.44e-07, 5.45e-07, 5.46e-07, 5.47e-07, 5.48e-07, 5.49e-07,        5.50e-07, 5.51e-07, 5.52e-07, 5.53e-07, 5.54e-07, 5.55e-07,        5.56e-07, 5.57e-07, 5.58e-07, 5.59e-07, 5.60e-07, 5.61e-07,        5.62e-07, 5.63e-07, 5.64e-07, 5.65e-07, 5.66e-07, 5.67e-07,        5.68e-07, 5.69e-07, 5.70e-07, 5.71e-07, 5.72e-07, 5.73e-07,        5.74e-07, 5.75e-07, 5.76e-07, 5.77e-07, 5.78e-07, 5.79e-07,        5.80e-07, 5.81e-07, 5.82e-07, 5.83e-07, 5.84e-07, 5.85e-07,        5.86e-07, 5.87e-07, 5.88e-07, 5.89e-07, 5.90e-07, 5.91e-07,        5.92e-07, 5.93e-07, 5.94e-07, 5.95e-07, 5.96e-07, 5.97e-07,        5.98e-07, 5.99e-07, 6.00e-07, 6.01e-07, 6.02e-07, 6.03e-07,        6.04e-07, 6.05e-07, 6.06e-07, 6.07e-07, 6.08e-07, 6.09e-07,        6.10e-07, 6.11e-07, 6.12e-07, 6.13e-07, 6.14e-07, 6.15e-07,        6.16e-07, 6.17e-07, 6.18e-07, 6.19e-07, 6.20e-07, 6.21e-07,        6.22e-07, 6.23e-07, 6.24e-07, 6.25e-07, 6.26e-07, 6.27e-07,        6.28e-07, 6.29e-07, 6.30e-07, 6.31e-07, 6.32e-07, 6.33e-07,        6.34e-07, 6.35e-07, 6.36e-07, 6.37e-07, 6.38e-07, 6.39e-07,        6.40e-07, 6.41e-07, 6.42e-07, 6.43e-07, 6.44e-07, 6.45e-07,        6.46e-07, 6.47e-07, 6.48e-07, 6.49e-07, 6.50e-07, 6.51e-07,        6.52e-07, 6.53e-07, 6.54e-07, 6.55e-07, 6.56e-07, 6.57e-07,        6.58e-07, 6.59e-07, 6.60e-07, 6.61e-07, 6.62e-07, 6.63e-07,        6.64e-07, 6.65e-07, 6.66e-07, 6.67e-07, 6.68e-07, 6.69e-07,        6.70e-07, 6.71e-07, 6.72e-07, 6.73e-07, 6.74e-07, 6.75e-07,        6.76e-07, 6.77e-07, 6.78e-07, 6.79e-07, 6.80e-07, 6.81e-07,        6.82e-07, 6.83e-07, 6.84e-07, 6.85e-07, 6.86e-07, 6.87e-07,        6.88e-07, 6.89e-07, 6.90e-07, 6.91e-07, 6.92e-07, 6.93e-07,        6.94e-07, 6.95e-07, 6.96e-07, 6.97e-07, 6.98e-07, 6.99e-07,        7.00e-07, 7.01e-07, 7.02e-07, 7.03e-07, 7.04e-07, 7.05e-07,        7.06e-07, 7.07e-07, 7.08e-07, 7.09e-07, 7.10e-07, 7.11e-07,        7.12e-07, 7.13e-07, 7.14e-07, 7.15e-07, 7.16e-07, 7.17e-07,        7.18e-07, 7.19e-07, 7.20e-07, 7.21e-07, 7.22e-07, 7.23e-07,        7.24e-07, 7.25e-07, 7.26e-07, 7.27e-07, 7.28e-07, 7.29e-07,        7.30e-07, 7.31e-07, 7.32e-07, 7.33e-07, 7.34e-07, 7.35e-07,        7.36e-07, 7.37e-07, 7.38e-07, 7.39e-07, 7.40e-07, 7.41e-07,        7.42e-07, 7.43e-07, 7.44e-07, 7.45e-07, 7.46e-07, 7.47e-07,        7.48e-07, 7.49e-07, 7.50e-07, 7.51e-07, 7.52e-07, 7.53e-07,        7.54e-07, 7.55e-07, 7.56e-07, 7.57e-07, 7.58e-07, 7.59e-07,        7.60e-07, 7.61e-07, 7.62e-07, 7.63e-07, 7.64e-07, 7.65e-07,        7.66e-07, 7.67e-07, 7.68e-07, 7.69e-07, 7.70e-07, 7.71e-07,        7.72e-07, 7.73e-07, 7.74e-07, 7.75e-07, 7.76e-07, 7.77e-07,        7.78e-07, 7.79e-07, 7.80e-07, 7.81e-07, 7.82e-07, 7.83e-07,        7.84e-07, 7.85e-07, 7.86e-07, 7.87e-07, 7.88e-07, 7.89e-07,        7.90e-07, 7.91e-07, 7.92e-07, 7.93e-07, 7.94e-07, 7.95e-07,        7.96e-07, 7.97e-07, 7.98e-07, 7.99e-07, 8.00e-07, 8.01e-07,        8.02e-07, 8.03e-07, 8.04e-07, 8.05e-07, 8.06e-07, 8.07e-07,        8.08e-07, 8.09e-07, 8.10e-07, 8.11e-07, 8.12e-07, 8.13e-07,        8.14e-07, 8.15e-07, 8.16e-07, 8.17e-07, 8.18e-07, 8.19e-07,        8.20e-07, 8.21e-07, 8.22e-07, 8.23e-07, 8.24e-07, 8.25e-07,        8.26e-07, 8.27e-07, 8.28e-07, 8.29e-07, 8.30e-07, 8.31e-07,        8.32e-07, 8.33e-07, 8.34e-07, 8.35e-07, 8.36e-07, 8.37e-07,        8.38e-07, 8.39e-07, 8.40e-07, 8.41e-07, 8.42e-07, 8.43e-07,        8.44e-07, 8.45e-07, 8.46e-07, 8.47e-07, 8.48e-07, 8.49e-07,        8.50e-07, 8.51e-07, 8.52e-07, 8.53e-07, 8.54e-07, 8.55e-07,        8.56e-07, 8.57e-07, 8.58e-07, 8.59e-07, 8.60e-07, 8.61e-07,        8.62e-07, 8.63e-07, 8.64e-07, 8.65e-07, 8.66e-07, 8.67e-07,        8.68e-07, 8.69e-07, 8.70e-07, 8.71e-07, 8.72e-07, 8.73e-07,        8.74e-07, 8.75e-07, 8.76e-07, 8.77e-07, 8.78e-07, 8.79e-07,        8.80e-07, 8.81e-07, 8.82e-07, 8.83e-07, 8.84e-07, 8.85e-07,        8.86e-07, 8.87e-07, 8.88e-07, 8.89e-07, 8.90e-07, 8.91e-07,        8.92e-07, 8.93e-07, 8.94e-07, 8.95e-07, 8.96e-07, 8.97e-07,        8.98e-07, 8.99e-07, 9.00e-07, 9.01e-07, 9.02e-07, 9.03e-07,        9.04e-07, 9.05e-07, 9.06e-07, 9.07e-07, 9.08e-07, 9.09e-07,        9.10e-07, 9.11e-07, 9.12e-07, 9.13e-07, 9.14e-07, 9.15e-07,        9.16e-07, 9.17e-07, 9.18e-07, 9.19e-07, 9.20e-07, 9.21e-07,        9.22e-07, 9.23e-07, 9.24e-07, 9.25e-07, 9.26e-07, 9.27e-07,        9.28e-07, 9.29e-07, 9.30e-07, 9.31e-07, 9.32e-07, 9.33e-07,        9.34e-07, 9.35e-07, 9.36e-07, 9.37e-07, 9.38e-07, 9.39e-07,        9.40e-07, 9.41e-07, 9.42e-07, 9.43e-07, 9.44e-07, 9.45e-07,        9.46e-07, 9.47e-07, 9.48e-07, 9.49e-07, 9.50e-07, 9.51e-07,        9.52e-07, 9.53e-07, 9.54e-07, 9.55e-07, 9.56e-07, 9.57e-07,        9.58e-07, 9.59e-07, 9.60e-07, 9.61e-07, 9.62e-07, 9.63e-07,        9.64e-07, 9.65e-07, 9.66e-07, 9.67e-07, 9.68e-07, 9.69e-07,        9.70e-07, 9.71e-07, 9.72e-07, 9.73e-07, 9.74e-07, 9.75e-07,        9.76e-07, 9.77e-07, 9.78e-07, 9.79e-07, 9.80e-07, 9.81e-07,        9.82e-07, 9.83e-07, 9.84e-07, 9.85e-07, 9.86e-07, 9.87e-07,        9.88e-07, 9.89e-07, 9.90e-07, 9.91e-07, 9.92e-07, 9.93e-07,        9.94e-07, 9.95e-07, 9.96e-07, 9.97e-07, 9.98e-07, 9.99e-07,        1.00e-06])

Default wavelengths for plots.

class Interpolator(wavelength: numpy.ndarray, absorption: numpy.ndarray, *args, **kwargs)[source]

Bases: object

Prepare an interpolator for the given x and y data.

Parameters
  • wavelength (np.ndarray) – Wavelengths (m) of light at which the absorption coefficient is defined.

  • absorption (np.ndarray) – Absorption coefficient (1/m) at the wavelengths of light. Points that will define the interpolation function.

  • args (tuple, dict) – Optional positional and keyword arguments passed to the intep1d function of scipy.interpolate module.

  • kwargs (tuple, dict) – Optional positional and keyword arguments passed to the intep1d function of scipy.interpolate module.

property absorption

Measured values of the absorption coefficient (1/m).

check_range(wavelength: float)[source]

Checks if the wavelength of light is within the valid range.

Parameters

wavelength (float or np.ndarray) – Temperature(s) to check.

Note

Reports a warning if the wavelength of light is not within the valid range. If the wavelength input argument is a numpy array, the call reports a warning if any of the wavelengths are not within the valid range.

classmethod fromfile(filename: str, *args, **kwargs)xopto.materials.absorption.base.Interpolator[source]

Create an interpolator from a numpy data file. The independent variable (wavelengths) should be stored in the first column, the dependent variable (absorption coefficient) in the second column

Parameters
  • filename (str) – Source file.

  • args (tuple) – Positional arguments passed to :py:func:scipy.interpolate.interp1d.

  • kwargs (dict) – Keyword arguments passed to :py:func:scipy.interpolate.interp1d.

Returns

interpolator – Interpolator instance.

Return type

Interpolator

is_valid_range(wavelength: float)bool[source]

Check the wavelngths of light (m) for valid range.

Parameters

wavelength (float, np.ndarray) – Wavelengths of light to check for valid range.

Returns

ok – Returns True if all the wavelengthsare within the valid range.

Return type

bool

plot(wavelength: Optional[numpy.ndarray] = None, label=None, show=False)[source]

Plots the wavelength dependence of the absorption coefficient.

Parameters
  • wavlength (np.ndarray) – Wavelengths of light.

  • label (str) – Plot label.

  • show (bool) – Show the plot window if True.

range()[source]

Return the valid range of wavelengths.

Returns

range – Valid range of wavelengths as a tuple (low, high).

Return type

(float, float)

property wavelength

Wavelengths of light (m) at which the absorption coefficient was measured.