eradiate.spectral.BandSRF¶
- class eradiate.spectral.BandSRF(wavelengths, values, name=None)[source]¶
Bases:
SpectralResponseFunctionThe spectral response function for a single band of an instrument.
- Parameters:
wavelengths (
quantity) – Wavelengths defining the interpolation grid. Values must be monotonically increasing.values (array-like) – Spectrum values. If a quantity is passed, units are checked for consistency. If a unitless array is passed, it is automatically converted to appropriate default configuration units, depending on the value of the
quantityfield. If no quantity is specified, this field can be a unitless value.name (
str, optional) – Name of this SRF.
- Fields:
- static convert(value)¶
Converter for the
Measure.srffield.Notes
Supported conversion protocols:
dict: Dispatch to subclass based on ‘type’ entry, then pass dictionary to constructor as keyword arguments.Dataset, DataArray: Call
BandSRF.from_dataarray().Path-like: Attempt loading a dataset from the hard drive, then call
BandSRF.from_dataarray().str: Perform a NetCDF file lookup in the SRF database and load it.
Anything else will pass through this converter without modification.
- eval(w)[source]¶
Evaluate the spectral response function for one or several wavelengths. Evaluation is vectorized.
- Parameters:
w (array-like) – One or several wavelengths at which the SRF is evaluated.
- Returns:
quantity– The returned value as the same shape asw.
- classmethod gaussian(wl_center, fwhm, cutoff=3.0, wl=None, wl_res=1.0, pad=False, normalize=True)[source]¶
Generate a Gaussian spectral response function dataset from central wavelength and full width at half maximum values.
- Parameters:
wl_center (
quantityorfloat) – Central wavelength of the Gaussian distribution. If passed as a float, the value is interpreted as being given in nm.fwhm (
quantityorfloat) – Full width at half maximum of the Gaussian distribution. If passed as a float, the value is interpreted as being given in nm.cutoff (
float, default:3.0) – Cut-off, in multiples of the standard deviation σ.wl (
quantityor array-like, optional) – Mesh used to evaluate the discretized distribution. If unset, a regular mesh with spacing given bywl_resis used. If passed as an array, the value is interpreted as being given in nm.wl_res (
quantityorfloat, optional) – Resolution of the automatic spectral mesh if relevant. If passed as a float, the value is interpreted as being given in nm.pad (
bool, default:False) – If True, pad SRF data with leading and trailing zeros.normalize (
bool, default:True) – IfTrue, the generated SRF data is normalized to have a maximum equal to 1.
- Returns:
Dataset– A dataset compliant with the Eradiate SRF format. The uncertainty variable is set to NaN.
- integrate(wmin, wmax)[source]¶
Return the integral of the SRF on the specified interval, using the trapezoid rule.
- integrate_cumulative(w)[source]¶
Return the cumulative integral of the SRF on the specified mesh, using the trapezoid rule.
- Parameters:
w (array-like) – Nodes of the spectral integration mesh. If a dimensionless array is passed, it is interpreted as being specified in default configuration units.
- Returns:
integral (
quantity) – Cumulative integral as an array of shape (N-1,), wherewavelengthhas shape (N,).