lentil.radiometry.Spectrum#
- class lentil.radiometry.Spectrum(wave, value, waveunit='nm', valueunit=None)[source]#
Class for representing spectral quantities.
Spectrumprovides core functionality for defining and interacting with spectral data in lentil. Some basic arithmetic functions are overloaded, so you can add, multiply, and exponentiateSpectrumobjectswith each other
by constants
with arrays having the same length as
value
- Parameters:
wave (array_like) – Array of wavelengths.
value (array_like) – Array of values corresponding to wavelengths in
wave.waveunit (str, optional) – Wavelength units, as accepted by
Unit(). Default isnm.valueunit (str or None, optional) – Value units, as accepted by
Unit(). Default is None.
Notes
When performing arithmetic operations between two
Spectrumobjects, the code will behave differently depending on thewavevectors of eachSpectrum:1. If the
wavevectors of eachSpectrumare the same, the arithmetic operation is directly performed element-wise on thevaluevectors of eachSpectrum.2. If the
wavevectors of eachSpectrumare different, thevaluevectors of eachSpectrumare interpolated to the same sampling, and then the arithmetic operation is performed element-wise on the resulting interpolatedvaluevectors. Before interpolating, thewaveandvaluevectors are zero-padded to cover the entire wave range represented by the union of bothSpectrumobjects. The sampling is determined by the smaller sampling of the twowavevectors.You can fine tune the sampling, interpolation, and padding methods by interfacing directly with the
Spectrum.add()andSpectrum.multiply()methods.
Attributes
Methods
|
Add Spectrum and other, element-wise |
|
Append Spectrum to the end of caller |
|
Return |
|
Compute a binned representation of the |
|
|
|
Crop a |
|
Divide Spectrum and other, element-wise |
|
Locate the indices defining the continuous nonzero portion of the |
|
Create a |
|
Compute the integrated value between |
|
Multiply Spectrum and other, element-wise |
|
Pad a Spectrum |
|
Spectrum elements raised to powers from other, element-wise |
|
Sample the |
|
Sample the |
|
Subtract Spectrum and other, element-wise |
|
Set new wavelength and/or value units. |
|
Trim the zero or near-zero ends off the |