lentil.radiometry.Spectrum#
- class lentil.radiometry.Spectrum(wave, value, waveunit='nm', valueunit=None)[source]#
Class for representing spectral quantities.
Spectrum
provides core functionality for defining and interacting with spectral data in lentil. Some basic arithmetic functions are overloaded, so you can add, multiply, and exponentiateSpectrum
objectswith 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
Spectrum
objects, the code will behave differently depending on thewave
vectors of eachSpectrum
:1. If the
wave
vectors of eachSpectrum
are the same, the arithmetic operation is directly performed element-wise on thevalue
vectors of eachSpectrum
.2. If the
wave
vectors of eachSpectrum
are different, thevalue
vectors of eachSpectrum
are interpolated to the same sampling, and then the arithmetic operation is performed element-wise on the resulting interpolatedvalue
vectors. Before interpolating, thewave
andvalue
vectors are zero-padded to cover the entire wave range represented by the union of bothSpectrum
objects. The sampling is determined by the smaller sampling of the twowave
vectors.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 |