lightcurvelynx.astro_utils.sed

A class to hold SED information.

Classes

SED

A class to hold SED information.

Module Contents

class SED(wavelengths, fluxes, **kwargs)[source]

A class to hold SED information.

wavelengths[source]

The wavelength values of the SED.

Type:

np.ndarray

fluxes[source]

The flux values of the SED.

Type:

np.ndarray

wavelengths[source]
fluxes[source]
classmethod from_file(sed_file, **kwargs)[source]

Load a static SED from a file containing a two column array where the first column is wavelength (in angstroms) and the second column is flux (in nJy).

Parameters:
  • sed_file (str or Path) – The path to the SED file to load.

  • **kwargs (dict) – Additional keyword arguments to pass to the SED constructor.

Returns:

An instance of SED with the loaded SED data.

Return type:

SED

classmethod from_synphot(sp_model, waves=None, **kwargs)[source]

Generate the spectrum from a given synphot model.

References

synphot (ascl:1811.001)

Parameters:
  • sp_model (synphot.SourceSpectrum) – The synphot model to generate the spectrum from.

  • waves (numpy.ndarray, optional) – A length N array of wavelengths (in angstroms) at which to sample the SED. If None, the SED will be sampled at the wavelengths defined in the synphot model.

  • **kwargs (dict) – Additional keyword arguments to pass to the SED constructor.

Returns:

An instance of SED with the generated SED data.

Return type:

SED

minwave()[source]

Get the minimum wavelength of the SED.

Returns:

minwave – The minimum wavelength of the SED (in angstroms).

Return type:

float

maxwave()[source]

Get the maximum wavelength of the SED.

Returns:

maxwave – The maximum wavelength of the SED (in angstroms).

Return type:

float

evaluate(wavelengths)[source]

Evaluate the SED at the given wavelengths by interpolating the SED data.

Parameters:

wavelengths (numpy.ndarray, optional) – A length N array of wavelengths (in angstroms).

Returns:

flux_density – A length N matrix of observer frame SED values (in nJy).

Return type:

numpy.ndarray

to_file(sed_file)[source]

Save the SED to a file as a two column array where the first column is wavelength (in angstroms) and the second column is flux (in nJy).

Parameters:

sed_file (str or Path) – The path to the SED file to save.

plot(*, ax=None, **kwargs)[source]

Plot the SED.

Parameters:
  • ax (matplotlib.axes.Axes, optional) – The axes to plot on. If None, a new figure and axes will be created.

  • **kwargs (dict) – Additional keyword arguments to pass to the plot function.

Returns:

ax – The axes with the SED plot.

Return type:

matplotlib.axes.Axes