lightcurvelynx.astro_utils.spectrograph
The Spectrograph object stores information about a spectrograph’s bins and provides methods to compute fluxes for each bin.
Classes
Models all of the bins of a spectrograph, producing bandfluxes for each |
Module Contents
- class Spectrograph(waves: numpy.array, *, scale: numpy.ndarray | None = None, instrument: str | None = None)[source]
Models all of the bins of a spectrograph, producing bandfluxes for each bin in the spectra. This class operates similarly to a PassbandGroup, but only contains a single “filter” named “spectra” that contains all of the bins.
- scale[source]
The multiplicative factor to apply to each bin’s flux to capture sensor sensitivity, etc. If None, we use 1.0 for all bins.
- Type:
np.ndarray
- classmethod from_regular_grid(wave_start: float, wave_end: float, bin_width: float, **kwargs)[source]
Create a Spectrograph with regularly spaced bins.
- Parameters:
wave_start (float) – The starting wavelength of the spectra in Angstroms.
wave_end (float) – The ending wavelength of the spectra in Angstroms.
bin_width (float) – The bin size of the spectra in Angstroms.
**kwargs – Additional keyword arguments to pass to the Spectrograph constructor.
- Returns:
A Spectrograph object with regularly spaced bins.
- Return type:
- bin_width(index)[source]
Get the width of the bin at the given index.
- Parameters:
index (int) – The index of the bin.
- Returns:
The width of the bin in Angstroms.
- Return type:
float
- wave_bounds()[source]
Get the minimum and maximum wavelength for this spectra.
- Returns:
min_wave (float) – The minimum wavelength.
max_wave (float) – The maximum wavelength.
- evaluate(flux_density_matrix: numpy.ndarray) numpy.ndarray[source]
Calculate the measured values for each bin in the spectrograph.
- Parameters:
flux_density_matrix (np.ndarray) – A 2D or 3D array of flux densities. If the array is 2D it contains a single sample where the rows are the T times and columns are M wavelengths in Angstroms. If the array is 3D it contains S samples and the values are indexed as (sample_num, time, wavelength).
- Returns:
measured_flux – A 2D or 3D array. If the flux_density_matrix contains a single sample (2D input) then the function returns a 2D matrix where each row is a time and each column is the measurement at the corresponding wavelength bin. Otherwise the function returns a size S x T x B array where each entry corresponds to the measured value for a given sample at a given time and wavelength bin.
- Return type:
np.ndarray