Class SED
Defined in File SED.h
Inheritance Relationships
Derived Types
public GalSED(Class GalSED)public QSOSED(Class QSOSED)public StarSED(Class StarSED)
Class Documentation
-
class SED
SED base class.
The SED class is in charge of representing a template and performing all the necessary computation on it.
Subclassed by GalSED, QSOSED, StarSED
Public Functions
-
SED(const string name, int nummod = 0, string type = "G")
Generic constructor
-
SED(const string nameC, double tauC, double ageC, int nummodC, string typeC, int idAgeC)
Constructor additionally setting the age and age-grid index of the SED
- Parameters:
nameC – Arbitrary name for the SED object
tauC – currently unused in this base-class constructor (kept for signature compatibility; see GalSED::tau for the star-formation e-folding timescale)
ageC – age of the stellar population, stored in age
nummodC – Identification number of the SED object
typeC – One of g/G, q/Q or s/S for GAL, QSO, or Star type objects
idAgeC – index of the age for this SED object, stored in idAge
-
inline object_type get_object_type() const
Return the object type.
-
virtual ~SED()
-
void read(const string &sedFile)
Read sedFile assumed to be ASCII and build the lamb_flux vector of oneElLambda elements.
Negative flux values are set to 0. The lamb_flux vector is filled iteratively with each line of the file, and is finally sorted by ascending lambda. More complex input types are treated in inherited class methods.
-
bool warning_integrateSED(const vector<flt> &filters, bool display_warning)
Check that the SED spectral range fully covers the given filters, once redshifted, and extend lamb_flux with zero-flux points at the blue and/or red end if not
- Parameters:
- Returns:
true if a warning was printed for the blue end of the SED
-
array<double, 6> integrateSED(const flt &filter)
Integrate the SED within the bandpass of a given filter, after resampling both onto their combined wavelength grid
- Parameters:
filter – the filter to integrate against
- Returns:
a 6-element vector of auxiliary integrals ( \(\int T\,d\lambda\), \(c\int T/\lambda^2\,d\lambda\), \(\int T\lambda\,d\lambda\), \(\int FT\,d\lambda\), \(\int FT\lambda\,d\lambda\), \(\int T/\lambda^2\,d\lambda\)) used to derive the flux/magnitude in the filter; returns INVALID_VAL if the SED does not fully cover the filter bandpass
-
void generateCalib(double lmin, double lmax, int Nsteps, int calib)
Generate a calibration SED based on the argument calib.
- Parameters:
lmin – start of the lambda vector
lmax – end of the lambda vector
Nsteps – number of intervals between $lambda values (hence there are Nsteps+1 values of \(\lambda\))
calib – parameter FILTER_CALIB passed as argument to define the calibration function \(C(\lambda)\)
calib=0 : \(C(\lambda)=\lambda^{-2}\)
calib=1 : \(C(\lambda)=\lambda^{-1}\)
calib=2 : \(C(\lambda)=\lambda^{-3}\)
calib=3 : \(C(\lambda)=Blackbody(\lambda, T=10000K)\)
calib=4 : \(C(\lambda)=Blackbody(\lambda, T=10000K)\)
calib = 5: \(C(\lambda) =\lambda ^{ -3 }\)
-
void rescale(double scaleFac)
rescale the lamb_flux.val as val *= scaleFac
-
void compute_magnitudes(const vector<flt> &filters, vector<double> &integrated_fluxes)
same, also returning in
integrated_fluxesthe integral of lamb_flux times each filter (element [3] of integrateSED), which can be handed to compute_milky_way_extinction to avoid integrating twice
-
void compute_milky_way_extinction(const ext &oneExt, const vector<flt> &filters)
Compute Milky Way extinction coefficients for a set of filters.
Computes the extinction correction associated with a Milky Way extinction law for each input filter.
- Parameters:
oneExt – Extinction law to apply.
filters – Collection of filters for which the extinction coefficients will be computed.
-
void compute_milky_way_extinction(const ext &oneExt, const vector<flt> &filters, const vector<double> &unreddened_fluxes)
Same as above, reusing already computed unreddened integrals.
-
double trapzd()
Integrate lamb_flux over its full wavelength range using the trapezoidal rule
- Returns:
the integrated value
-
void sumSpectra(SED addSED, const double rescal)
Add another SED’s flux to this one, after resampling both onto a common wavelength grid
- Parameters:
addSED – the SED to add
rescal – scaling factor applied to
addSEDbefore summation
-
void reduce_memory(const vector<flt> &allFlt)
Reduce the memory footprint of lamb_flux by keeping only the points needed to integrate the SED within the given filters (plus the two extreme points, kept for interpolation), when the SED has been redshifted (red > 0)
- Parameters:
allFlt – filters the reduced SED must remain compatible with
-
virtual void writeSED(ofstream &ofs, ofstream &ofsPhys, ofstream &ofsDoc)
Write this SED to the binary/physical-parameters/doc output streams. Behaviour is specialised in the GalSED/QSOSED/StarSED subclasses.
- Parameters:
ofs – binary output stream for the SED
ofsPhys – output stream for the physical parameters (GAL only)
ofsDoc – output stream for the human-readable documentation file
-
inline void writeSED(const string &binFile, const string &physFile, const string &docFile)
Convenience overload of writeSED() opening the output files from their paths before delegating to the stream-based overload
- Parameters:
binFile – path to the output binary SED file
physFile – path to the output physical parameters file (GAL only)
docFile – path to the output documentation file
-
inline virtual void writeMag(bool outasc, ofstream &ofsBin, ofstream &ofsDat, vector<flt> allFilters, string magtyp)
Write the synthetic magnitudes of this SED to the magnitude library output streams. No-op in the base class; specialised in the GalSED/QSOSED/StarSED subclasses.
- Parameters:
outasc – whether to also write an ASCII representation
ofsBin – binary output stream for the magnitude library
ofsDat – output stream for the physical parameters (GAL only)
allFilters – filters the magnitudes were computed for
magtyp – magnitude system, “AB” or “VEGA”
-
inline void readSEDBin(const string &fname)
Convenience overload of readSEDBin() opening the input file from its path before delegating to the stream-based overload
- Parameters:
fname – path to the binary SED library file to read
-
inline virtual void readMagBin(ifstream &ins)
Read the synthetic magnitudes of this SED from a binary magnitude library stream. No-op in the base class; specialised in the GalSED/QSOSED/StarSED subclasses.
- Parameters:
ins – input stream positioned at this SED’s magnitude record
-
inline virtual void sumEmLines()
Sum the emission-line contribution into the SED flux. No-op in the base class; only implemented for GalSED.
-
inline virtual void kcorrec(const vector<double> &magz0)
for each magnitude mag[k] compute kcorr = mag[k] - mag_z0[k] - distMod
-
inline virtual void compute_luminosities()
Compute the physical parameters (mass, SFR, age, luminosities…) of the SED. No-op in the base class; only implemented for GalSED (see GalSED::compute_luminosities).
-
void generate_spectra(double zin = 0.0, double dmin = 1.0)
Generate spectrum at given redshift, with given normalization, and adding emission lines and extragalactic extinction (using the opacity curve returned by get_opa_vector() for this SED’s redshift)
-
inline bool is_same_model(const SED &other) const
Check if the SED is identical to another one
- Parameters:
other – the SED to compare to equality of the following attributes are compared:
nummod,ebv, andage
-
pair<vector<double>, vector<double>> get_data_vector(double minl, double maxl, bool mag, double offset = 0.0)
Return the pair of vectors [lambdas, vals] of wavelength and spectrum values
- Parameters:
minl – Minimum \(\lambda\) of the vector
maxl – Maximum \(\lambda\) of the vector
mag – If true, return magnitudes as vals instead of fluxes
offset – offset of the mag system to be used in case mag is true.
-
void redshift()
Apply transformation of the sed based on the redshift (stored in variable red) \(val\rightarrow val/(1+z)\) and \(\lambda\rightarrow \lambda(1+z)\)
-
void apply_extinction(const double ebv, const ext &oneext, bool update_ebv = true)
Apply dust extinction to the SED (GAL and GSO only)
- Parameters:
ebv – value of E(B-V)
oneext – instance of class ext
update_ebv – if true, update the stored value of ebv in the SED
-
void apply_extinction_to_lines(double ebv, const ext &obj)
Apply dust extinction to the emission lines (stored in
fac_line) Only for galaxies and QSO- Parameters:
ebv – value of E(B-V)
obj – instance of class
ext
-
void applyOpa(const vector<opa> &opaAll)
Apply extinction due to intergalactic medium (only for GAL and QSO)
- Parameters:
opaAll – Vector of opacities to compute extinction along the line of sight
-
inline void emplace_back(const double wavelength, const double value)
Helper function to append the oneElLambda(wavelength, value) object to the sed vector
Public Members
-
vector<oneElLambda> lamb_flux
vector of oneElLambda elements, capturing the SED template
-
vector<double> kcorr
k-correction term
-
vector<double> mag_z0
magnitude at z=0
-
vector<double> mag
magnitude and flux of the model
-
bool has_mw_galametz
True if the Milky Way extinction has been computed
-
vector<double> milky_way_extinction
attenuation of the model in each band
-
double band_pass_correction
bpc of the model
-
bool has_emlines
True if the emission lines have been computed, false if not
-
object_type nlib
object type of the SED
-
int nummod
index in the initial list of rest frame SEDs
-
double luv
monochromatic UV luminosity \(\int_{0.21\,\mu m}^{0.25\,\mu m} L_{\lambda}\;d\lambda\) (in Log unit of erg/s/Hz)
-
double lopt
optical luminosity \(\int_{0.55\,\mu m}^{0.65\,\mu m} L_{\lambda}\;d\lambda\) (in Log unit of erg/s/Hz)
-
double lnir
NIR luminosity \(\int_{2.1\,\mu m}^{2.3\,\mu m} L_{\lambda}\;d\lambda\) (in Log unit of erg/s/Hz)
-
double ltir
IR luminosity \(\int_{8\,\mu m}^{1000\,\mu m} L_\lambda\; < d\lambda\) in Log unit of \(L_\odot\)
-
double mass
mass in \(M_\odot\)
-
double age
age in year (yr)
-
double sfr
Star Formation Rate in \(M_\odot\)/yr.
-
double ssfr
Specific SFR, defined as sfr / mass.
-
double mag0
absolute magnitude, for a unit normalisation, in the reference band (MAG_REF) used by the absolute-magnitude prior: z=0 magnitude of the template, minus the z=0 distance-modulus offset when this SED is itself at z=0
-
int extlawId
index of the extinction law when dust attenuation has been applied
-
array<double, 4> qi
Store the unnormalized number flux (phot/cm \(^{-2}\)s \(^{-1}\)) of ionizing photons for HeII, HeI, H, and H2. See SED::calc_ph. In practice, qi[2] only is used, and only for the physical modeling of emission lines (EM_LINES=”PHYS”, see GalMag::read_SED)
-
vector<oneElLambda> fac_line
oneElLambda vector storing emission lines
Public Static Functions
-
static inline object_type string_to_object(const string &type)
Convert string to object_type.
- Parameters:
type – string starting with either g, q, or s, in either lower or upper case. If it is not the case, throw invalid argument exception.
- Returns:
object_type corresponding to input, if valid.
-
SED(const string name, int nummod = 0, string type = "G")