Core¶
Spectrum¶
MonoSpectrum
¶
Bases: Spectrum
A spectrum with a scalar wavelength (density is a delta function).
Attributes:
| Name | Type | Description |
|---|---|---|
wavelength |
Float[Array, '1']
|
A scalar representing the wavelength in the same units of distance as the sampling of the corresponding field. |
density |
Float[Array, '1']
|
A scalar set to 1.0 because there is only one wavelength in the spectrum. |
Source code in src/chromatix/core/spectrum.py
Spectrum
¶
Bases: Module
A spectrum defined by wavelengths and their corresponding densities.
Attributes:
| Name | Type | Description |
|---|---|---|
wavelength |
Float[Array, 'wv']
|
A 1D array representing the wavelengths in the discretized spectrum in the same units of distance as the sampling of the corresponding field. |
density |
Float[Array, 'wv']
|
A 1D array representing the weight of each wavelength in the discretized spectrum. |
Source code in src/chromatix/core/spectrum.py
central_wavelength
property
¶
The central wavelength of the spectrum (defined as the first wavelength provided to the spectrum because you could construct the complex field with multiple wavelengths in any order).
density
instance-attribute
¶
size
property
¶
Returns the number of wavelengths in the discretized spectrum.
spectral_modulation
property
¶
Returns the ratio of the central wavelength to all the wavelengths in the spectrum. This is useful when calculating phase responses of a material that scales approximately linearly with wavelength.
wavelength = eqx.error_if(wavelength, wavelength.ndim != 1, 'Wavelength must be 1D for polychromatic spectrum.')
instance-attribute
¶
__init__(wavelength, density=None)
¶
Source code in src/chromatix/core/spectrum.py
__repr__()
¶
build(spectrum)
classmethod
¶
Function that creates a spectrum type from either a single float (MonoSpectrum), an array of multiple wavelengths, or a tuple of two arrays: one array of wavelengths and another array of the relative power of each wavelength in the spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spectrum
|
Spectrum | ScalarLike | Float[Array, 'wv'] | tuple[Float[Array, 'wv'], Float[Array, 'wv']]
|
If this is a scalar float value, a single wavelength
|
required |
Returns: An object representing a spectrum (or a single wavelength in the monochrome case).
Source code in src/chromatix/core/spectrum.py
Base¶
Field = TypeVar('Field')
module-attribute
¶
__all__ = ['Monochromatic', 'Chromatic', 'Scalar', 'Vector', 'Sample', 'Absorbing', 'Scattering', 'Fluorescent', 'Volume', 'Sensor', 'Resampler']
module-attribute
¶
Absorbing
¶
Chromatic
¶
Fluorescent
¶
Monochromatic
¶
Resampler
¶
Bases: Module
Source code in src/chromatix/core/base.py
Sample
¶
Bases: Module
Source code in src/chromatix/core/base.py
Scalar
¶
Bases: Module
Source code in src/chromatix/core/base.py
Scattering
¶
Sensor
¶
Bases: Module
Source code in src/chromatix/core/base.py
Vector
¶
Bases: Module