tardis.spectrum.spectrum module

class tardis.spectrum.spectrum.TARDISSpectrum(_frequency, luminosity)[source]

Bases: HDFWriterMixin

_frequency: astropy.units.Quantity with unit ‘Hz’ or a length

These are bin edges of frequency or wavelenght bins for the spectrum.

luminosity: astropy.units.Quantity with unit Energy per second

The luminosity in each bin of the spectrum.

After manually adding a distance attribute, the properties ‘flux_nu’ and ‘flux_lambda’ become available

f_nu_to_f_lambda(f_nu)[source]
property flux_lambda
property flux_nu
hdf_properties = ['_frequency', 'luminosity', 'delta_frequency', 'wavelength', 'luminosity_density_lambda']
static luminosity_to_flux(luminosity, distance)[source]
plot(ax=None, mode='wavelength', **kwargs)[source]

Plot the Spectrum

Parameters:
axmatplotlib.axes._subplots.AxesSubplot or None, optional

Axis on which to create plot. Default value is None which will create plot on a new figure’s axis.

mode{‘wavelength’, ‘frequency’}, optional

Quantity to plot spectrum against, either ‘wavelength’ or ‘frequency’. Default value is ‘wavelength’.

**kwargsdict, optional

matplotlib.lines.Line2D properties to style the plot: refer to matplotlib documentation for a list of all possible arguments.

to_ascii(fname, mode='luminosity_density')[source]