- class sncosmo.Spectrum(wave=None, flux=None, fluxerr=None, fluxcov=None, bin_edges=None, wave_unit=Unit('Angstrom'), unit=Unit('erg / (Angstrom cm2 s)'), time=None)¶
An observed spectrum of an object.
This class is designed to represent an observed spectrum. An observed spectrum is a set of contiguous bins in wavelength (referred to as “spectral elements”) with associated flux measurements. We assume that each spectral element has uniform transmission in wavelength. A spectrum can optionally have associated uncertainties or covariance between the observed fluxes of the different spectral elements. A spectrum can also optionally have a time associated with it.
Internally, we store the edges of each of the spectral element wavelength bins. These are automatically recovered in the common case where a user has a list of central wavelengths for each bin. The wavelengths are stored internally in units of Angstroms. The flux is stored as a spectral flux density F_λ (units of erg / s / cm^2 / Angstrom).
Central wavelengths of each spectral element. This must be monotonically increasing. This is assumed to be in units of Angstroms unless
Observed fluxes for each spectral element. By default this is assumed to be a spectral flux density F_λ unless
unitis explicitly specified.
Uncertainties on the observed fluxes for each spectral element.
Covariance of the observed fluxes for each spectral element. Only one of
fluxcovmay be specified.
Edges of each spectral element in wavelength. This should be a list that is length one longer than
flux. Only one of
bin_edgesmay be specified.
Wavelength unit. Default is Angstroms.
Flux unit. Default is F_λ (erg / s / cm^2 / Angstrom).
The time associated with the spectrum. This is required if fitting a model to the spectrum.
- __init__(wave=None, flux=None, fluxerr=None, fluxcov=None, bin_edges=None, wave_unit=Unit('Angstrom'), unit=Unit('erg / (Angstrom cm2 s)'), time=None)¶
__init__([wave, flux, fluxerr, fluxcov, ...])
bandflux(band[, zp, zpsys])
Perform synthentic photometry in a given bandpass.
bandfluxcov(band[, zp, zpsys])
Like bandflux(), but also returns model covariance on values.
Magnitude through the given bandpass(es), and for the given magnitude system(s).
Build an appropriate sampling for the spectral elements.
Check whether there is uncertainty information available.
Rebin the spectrum on a new wavelength grid.
Return the end of each bin.
Return the start of each bin.
Return the covariance matrix
Return the uncertainties on each flux bin
Return the centers of each bin.