lightcurvelynx.astro_utils.spectrograph

The Spectrograph object stores information about a spectrograph’s bins and provides methods to compute fluxes for each bin.

Classes

Spectrograph

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.

waves[source]

The wavelengths at the center of each bin in Angstroms.

Type:

np.ndarray

instrument[source]

The instrument name for the spectrograph. Default is “Spectrograph”.

Type:

str

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

wave_min[source]

The minimum wavelength of the spectra in Angstroms.

Type:

float

wave_max[source]

The maximum wavelength of the spectra in Angstroms.

Type:

float

waves[source]
instrument[source]
wave_min[source]
wave_max[source]
scale = None[source]
__str__() str[source]

Return a string representation of the spectra filter.

__len__() int[source]
__eq__(other) bool[source]

Determine if two passbands have equal values for the processed tables.

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:

Spectrograph

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