kcorrect.template
Classes
Spectral energy distribution(s) |
|
Spectral energy distribution template(s) |
Module Contents
- class SED(filename=None, wave=None, flux=None, ext='FLUX', interpolate=True)[source]
Bases:
objectSpectral energy distribution(s)
- Parameters:
filename (str) – name of FITS file to read from
wave (ndarray of np.float32) – rest frame wavelength grid in Angstroms
flux (ndarray of np.float32) – [nsed, nwave] rest frame flux grid in erg/cm^2/s/A at 10pc
ext (str) – extension from which to read FLUX in FITS file
interpolate (bool) – create interpolation object
- flux
[nsed, nwave] flux grid in erg/cm^2/s/A at 10pc and currently set redshift
- Type:
ndarray of np.float32
- nsed
number of SEDs
- Type:
np.float32
- nwave
number of wavelengths in grid
- Type:
np.int32
- redshift
redshift of SED
- Type:
np.float32
- restframe_flux[source]
[nsed, nwave] rest frame flux grid in erg/cm^2/s/A at 10pc
- Type:
ndarray of np.float32
- wave
[nwave] wavelength grid in Angstroms
- Type:
ndarray of np.float32
Notes
The fluxes are a bit funnily defined, in terms of the flux that the galaxy would have at 10pc, analogous to an absolute magnitude. When the redshift is applied, the bolometric flux is conserved (i.e. there is no luminosity distance applied, it is a pure redshifting of the spectrum).
If filename is set, overrides wave and flux.
If binimage is True, then instead of a FLUX HDU table, there should be WAVE and FLUX HDUs with binary images.
- fromfits(filename=None, ext='FLUX')[source]
Read SED from FITS files
- Parameters:
filename (str) – input file name
ext (str or int) – extension to read from
Notes
The FITS table should have two columns:
wave - an [nwave] array of wavelengths in Angstrom flux - an [nsed, nwave] array of fluxes
Only imports the first row of the FITS table.
- tofits(filename=None, ext='FLUX', clobber=True)[source]
Write SED to FITS files
- Parameters:
filename (str) – output file name
ext (str or int) – extension to write to
clobber (bool) – whether to clobber the existing file or add an HDU
Notes
Writes a one-row FITS table with two columns:
wave : an [nwave] array of restframe wavelengths in Angstrom
flux : an [nsed, nwave] array of restframe fluxes
If binimage is set for this object, instead write two HDUs.
- class Template(filename=None, ext='FLUX', interpolate=False)[source]
Bases:
SEDSpectral energy distribution template(s)
- Parameters:
filename (str) – name of FITS file to read from
binimage (bool) – if True, read in WAVE and FLUX extensions as binary images
ext (str) – extension from which to read FLUX in FITS file
interpolate (bool) – create interpolation object
- flux
[nsed, nwave] flux grid in erg/cm^2/s/A
- Type:
ndarray of np.float32
- intsfh[source]
[nsed] integrated star formation history in solar masses
- Type:
ndarray of np.float32
- m300[source]
[nsed] stars formed last 300 million years in solar masses
- Type:
ndarray of np.float32
- mremain[source]
[nsed] remaining mass in stars and remnants in solar masses
- Type:
ndarray of np.float32
- nsed
number of SEDs
- Type:
np.float32
- nwave
number of wavelengths in grid
- Type:
np.int32
- redshift
redshift of SED
- Type:
np.float32
- restframe_flux[source]
[nsed, nwave] rest frame flux grid in erg/cm^2/s/A
- Type:
ndarray of np.float32
- wave
[nwave] wavelength grid in Angstroms
- Type:
ndarray of np.float32
Notes
If filename is set, overrides wave and flux.
The file should have the HDUs:
- FLUXan ndarray with two tags:
‘wave’ : an [nwave]-array of np.float32 with wavelength in Ang. ‘flux’ : an [nsed, nwave]-array of np.float32 with flux in erg/s/cm^2/A
METS : an [nsed]-array with metallicity INTSFH : an [nsed]-array with integrated SF in solar units MREMAIN : an [nsed]-array with current stellar mass in solar units M50 : an [nsed]-array with mass formed within 50 My in solar units M300 : an [nsed]-array with mass formed within 300 My in solar units M1000 : an [nsed]-array with mass formed within 1 Gy in solar units
If binimage is True, then instead of a FLUX HDU table, there should be WAVE and FLUX HDUs with binary images.