SFH: Generate SED from SFH

Star FormationR Documentation

Generate SED from SFH

Description

As of v1.0.0 the older SFHp4 and SFHp5 have been removed, use massfunc_b5 in combination with SFHfunc (this is now default) to create stepped SFHs. The mass formed in bins is now specified as a SFR, not as a total mass formed.

The star formation history functions discussed here compute output galaxy spectra and stellar masses using variable star formation histories. This can be either a pure burst (SFHburst), or a functional form (SFHfunc). Uses either BC03 or EMILES libraries. SFHfunc can take a functional form for the metallicity.

Usage

SFHfunc(massfunc = massfunc_b5, forcemass = FALSE, agescale = 1,
 stellpop = "BC03lr", speclib = NULL, tau_birth = 1, tau_screen = 0.3,
 pow_birth = -0.7, pow_screen = -0.7, filters = "all", Z = 5, emission = FALSE,
 veldisp = 50, range = 5, res = 0.5, emission_scale = "FUV", escape_frac = 1 - emission,
 Ly_limit = 911.75, LKL10 = NULL, disp_stars = FALSE, LSF = NULL, z = 0.1, H0 = 67.8,
 OmegaM = 0.308, OmegaL = 1 - OmegaM, ref, outtype = "mag", sparse = 5, intSFR = FALSE,
 unimax = 1.38e+10, agemax = NULL, LumDist_Mpc = NULL, Eb = 0, L0 = 2175.8,
 LFWHM = 470, ...)

SMstarfunc(massfunc = massfunc_b5, forcemass = FALSE, agescale = 1,
 burstage = c(0, 1e+08), youngage = c(1e+08, 1e+09), midage = c(1e+09, 5e+09),
 oldage = c(5e+09, 9e+09), ancientage = c(9e+09, 1.3e+10), stellpop = "BC03lr",
 speclib = NULL, Z = 5, z = 0.1, H0 = 67.8, OmegaM = 0.308, OmegaL = 1 - OmegaM,
 ref, unimax = 1.38e+10, agemax = NULL, intSFR = FALSE, ...)

SFHburst(burstmass = 1e8, burstage = 0, stellpop = 'BC03lr', speclib = NULL,
 tau_birth = 1.0, tau_screen = 0.3, pow_birth = -0.7, pow_screen = -0.7,
 filters = 'all', Z = 0.02, emission = FALSE, veldisp = 50, range = 5, res = 0.5,
 emission_scale = "FUV", escape_frac = 1 - emission, Ly_limit = 911.75, LKL10 = NULL,
 disp_stars = FALSE, LSF = NULL, z = 0.1, H0 = 67.8, OmegaM = 0.308, OmegaL = 1 - OmegaM,
 ref, outtype = 'mag', sparse = 5, unimax=  13.8e9, agemax = NULL, LumDist_Mpc = NULL,
 Eb = 0, L0 = 2175.8, LFWHM = 470, ...)

Arguments

massfunc

Function; a function which will take age (in years) as an input and return SFR (in Msol/yr). Additional massfunc function arguments can be passed down via the ... (useful for fitting), so be careful to give additional arguments unique names compared to SFHfunc. Various sensible functions are available in ProSpect, see massfunc.

burstmass

Numeric scalar; the total stellar mass formed in a recent burst in units Msol.

burstage

Numeric vector; the age limits in years for the burst phase. Numeric scalar; the age of the burst in years (SFHburst).

youngage

Numeric vector; the age limits in years for the young phase.

midage

Numeric vector; the age limits in years for the mid phase.

oldage

Numeric vector; the age limits in years for the old phase.

ancientage

Numeric vector; the age limits in years for the ancient phase.

forcemass

Logical or numeric scalar; if FALSE then the stellar mass is directly computed from the massfunc function, i.e. the output of this must be a true star formation rate in Msol per year. If forcemass is a number then this specifies the required integrated stellar mass that must be formed over all time, and the output of massfunc will linearly scaled as required to achieve this.

agescale

Numeric scalar; scaling to apply to the ages (which will passed in years) to massfunc. E.g. if left at agescale=1 then massfunc is expecting the age in years, but if set to 1e-6/1e-9 then massfunc is expecting the age in Myrs/Gyrs.

stellpop

Character scalar; which stellar population library to use, one of BC03lr (default), BC03hr, EMILES.

speclib

Pass in the spectral library directly. Must be one of BC03lr, BC03hr, EMILES. Doing this speeds up the compute time, since there is no need to lazy load from the package.

tau_birth

Numeric scalar; dust tau of birth clouds. Associated with sub 10 Myr star formation. See CF_birth.

tau_screen

Numeric scalar; dust tau of the dust screen. See CF_screen.

pow_birth

Numeric scalar; power to further raise the dust attenuation of birth clouds. See CF_birth.

pow_screen

Numeric scalar; power to further raise the dust attenuation of the dust screen. See CF_screen.

filters

Character vector; names of filters to use. See filters for options. Default 'all' selects all filters, 'GAMA' returns just the classic GAMA survey filters. Can also be a list of matrices or functions to pass into bandpass. This creates increasingly faster code, but requires more user effort. Setting to NULL will not process the spectrum through filters at all, which is useful if you just want some of the other output which are quicker to produce.

Z

Numeric scalar (SFHburst), or a function (SFHfunc); specifies which metallicity to use for each star formation phase. The metallicity is the vector location Z in BC03lr$Z / BC03hr$Z / EMILES$Z., i.e. the default of 5 for BC03lr is close to solar (BC03lr$Z[5]=0.02). For SFHfunc the functional form takes age as an input (in units of agescale) and outputs the target metallicity in terms of Z (so 0.02 for solar). Z function arguments can be passed down via the ... (useful for fitting), so be careful to give additional arguments unique names compared to SFHfunc. For convenience, if a non-integer value is provided then this is interpreted as the desired metallicity value (so Z=0.02 for solar etc), and converted into the appropriate function internally, e.g. Z=5 and Z=0.02 will give the same outputs for BC03.

emission

Logical; should emission features be added to the spectrum? This will be done using emissionLines.

veldisp

Numeric scalar; velocity dispersion (km/s) of emission features. See emissionLines.

range

Numeric scalar; how many sigma either side of the line should the dispersion spread flux be evaluated (starts to become inaccurate if lower than 5).

res

Numeric scalar; the relative resolution of the dispersion evaluation in fractions of sigma. Should not be more than 0.5, but might need to be lower if dispersion is much larger than the effective spectral resolution (a few thousand km/s usually, in which case set to 0.1-0.2).

emission_scale

Character; one of 'FUV' or 'SFR'. 'FUV' scales the emission features via an energy balance, absorbing all unattenuated flux below Ly_limit by a factor (1-escape_frac) and re-emitting as lines. 'SFR' scales Halpha from Kennicutt (1998), but still absorbs flux below Ly_limit by a factor (1-escape_frac). If providing LKL10 to speed code up then it must be LKL10=LKL10_NormAll when emission_scale='FUV', and LKL10=LKL10_NormHalpha when emission_scale='SFR'. Otherwise these are loaded internally as appropriate.

escape_frac

Numeric scalar/vector; the fraction of photons allows to escape when the wavelength is shorter than the corresponding element of Ly_limit. If emission=TRUE and emission_scale='FUV' then the absorbed flux (1-escape_frac) is re-emitted as lines. By default it is escape_frac = 1 - emission, i.e. if we do not want emission then we allow all UV photons out of the star forming region (to possibly then be attenuated by dust), but if we want emission then all of these photons are used to excite our emission lines.

Ly_limit

Numeric scalar/vector; the Lyman limit/s to use (Angstroms). Photons with wavelengths shorted than the Ly_limit[i] are absorbed by a factor 1-escape_frac[i]. If emission=TRUE and emission_scale='FUV' then the absorbed flux (1-escape_frac) is re-emitted as lines. We expect absorption short of Ly alpha (1215.7 A), Ly beta (1025.7 A), Lyman gamma (972.5 A), and the Lyman series limit (911.8 A), where a different escape_frac can be specified for each. Generally aborption gets stronger as the wavelength gets shorter, creating a characteristic saw-tooth absorption spectrum with a jump at each Lyman series level. Users can specify more Lyman limits (e.g. delta etc), but generally this is not needed. The escape fraction short of the Lyman series limit (911.8 A) should generally be 0 if not known otherwise. A single crude Ly_limit should generally be 911.8 (the actual ionisation limit n=Inf of 13.6 eV) since this represents all ionising UV flux (energetic enough to fully ionise an hydrogen atom, regardless of its energy state).

LKL10

List; LKL template to use. If LKL10=NULL then the appropriate template is loaded internally (this is the safest option). To speed things up the user can pass in the appropriate LKL10 template, but care must be taken to ensure the scaling used makes use of the correct dataset. See emissionLines.

disp_stars

Logical; should the star templates also have dispersion (veldisp) added? This is done distinctly to the emission features (so they will not be dispersed twice!) This is only applied to the attenuated spectrum, so the unattenuated will be the intrinsic (0 km/s dispersion) spectrum.

LSF

Function, numeric matrix/data.frame, numeric scalar; describes the instrumental line spread function is km/s. This should either scalar (constant throughout), a two column matrix/data.frame (wavelength in Ang, LSF in km/s) or a function that take wavelength (Ang) as an input and returns LSF in km/s. NULL means this is ignored (effectively same as setting to 0, but more efficient).

z

Numeric scalar; cosmological redshift of the source. If the provided z=0 then the returned fluxes will be absolute, i.e. absolute magnitudes if outtype='mag'. If z<0 then only luminosities are computed (flux parts are skipped).

H0

Numeric scalar; Hubble constant as defined at z=0 (default is H0=67.8 (km/s)/Mpc).

OmegaM

Numeric scalar; Omega Matter today (default is 0.308).

OmegaL

Numeric scalar; Omega Lambda today (default is for a flat Universe with OmegaL = 1 - OmegaM = 0.692).

ref

The name of a reference cosmology to use, one of 137 / 737 / Planck / Planck13 / Planck15 / Planck18 / WMAP / WMAP9 / WMAP7 / WMAP5 / WMAP3 / WMAP1 / Millennium / GiggleZ. Planck = Planck18 and WMAP = WMAP9. The usage is case insensitive, so wmap9 is an allowed input. This overrides any other settings for H0, OmegaM and OmegaL. If OmegaR is missing from the reference set then it is inherited from the function input (0 by default). See cosref for details.

unimax

Numeric scalar; maximum allowed age in years of any stellar population relative to z=0 (i.e. today). Any star formation that is older than this will be set to 0. Overridden by agemax if that is provided.

agemax

Numeric scalar; maximum allowed age in years of any stellar population relative to the redshift of the observed galaxy. Any star formation that is older than this will be set to 0. Overrides unimax if that is also provided. It is computational a bit faster to provide this since we do not need to compute a lookup time from the redshift.

outtype

Character scalar; specifies the type of photometry computed, must be one of 'mag' / 'magAB' (for AB magnitudes, the default), 'Jansky' / 'Jy' (for Jansky fluxes) or 'CGS' (for CGS fluxes), or NULL (out item is then NULL). See magABcalc for details.

sparse

Numeric scalar; amount of sparse sampling of the spectra to make. Higher values mean coarser spectra is processed, which means less accurate photometry, but faster processing. Generally done when computing higher resolution libraries for AB mags.

intSFR

Boolean scalar; should the massfunc be intergrated between ages? This might be necessary if the SFH is quite bursty (FWHM of burst < 250 Myrs), but it is more expensive to compute (a few 10s% typically) and not required if the SFH is quite smooth.

LumDist_Mpc

Numeric scalar; Luminosity distance computed in units of cm. Default is NULL. The luminosity distance can be supplied for repeated computations when the redshift of the object is constant. This should be supplied using the "correct" cosmology (as near as possible), i.e. using H0 ~ 70 km/s/Mpc (not 100).

Eb

Numeric scalar; Additional attenuation at the 2175.8 Ang dust bump. The default of 0 means this has no effect, MW is near 3.3, and typical galaxies are around Eb=1.

L0

Numeric scalar; location of the 2175.8 Ang dust bump in Angstroms (probably do not adjust this).

LFWHM

Numeric scalar; width of the 2175.8 Ang dust bump in Angstroms (probably do not adjust this).

SMstar

Logical; if you have the ParmOff package (on Github asgr/ParmOff, required for correct argument matching between the various functions used) setting this to TRUE will also compute the various stellar mass calculations of SMstarfunc including stellar mass remaining (TotSMstar) which is the reason this function is usually run. The output appears in the list object 'SMstar'.

...

Further arguments to be passed to massfunc or Z functions, as appropriate (this is achieved by formals matching, so be careful to used unique names).

Details

Optionally the definition of old and ancient can be associated with a fixed time the history of the Universe (e.g. the peak of starformation). This means the exact lookback period adapts as a function of the redshift provided. This often makes more sense then simply fixing the age of the ancient population since it precents the stellar populations becoming older than the Universe.

We use the simple dust models for birth clouds and dust screens as given by Charlot and Fall (2000):

A=\exp(-\tau*(\lambda/\lambda_{piv})^n)

The defaults should be reasonable in the regime they are used over, where birth cloud dust should only be applied to stellar populations younger than 10 Myrs. Note that BC03 has 70 stellar population spectra which are younger than this, whilst EMILES has none. This means that EMILES cannot realistically capture the birth dust attenuation phase, so for highly star bursting populations BC03 should probably be preferred.

Value

SFHfunc / SFHburst returns a list containing:

flux

Numeric Matrix; first column is observed wavelength (Angstroms) and second column is observed flux (erg/s/cm^2/Angstrom).

out

Data frame; first column is the filter name, second columns is the central wavelength, third column is the requested output (e.g. AB mag).

wave_lum

Numeric vector; luminosity wavelength in Angstroms.

lum_atten

Numeric vector; attenuated stellar luminosity in the standard BC03 units of Lsol / Angstrom.

lum_unatten

Numeric vector; unattenuated stellar luminosity in the standard BC03 units of Lsol / Angstrom.

lumtot_unatten

Numeric scalar, total unattenuated stellar luminosity in Lsol.

lumtot_atten

Numeric scalar, total attenuated stellar luminosity in Lsol (i.e. this is power that will be re-radiated).

lumtot_birth

Numeric scalar, total attenuated luminosity in birth cloud in Lsol (i.e. this is power that will be re-radiated by birth clouds).

lumtot_screen

Numeric scalar, total attenuated luminosity in screen cloud in Lsol (i.e. this is power that will be re-radiated by the ISM screen).

agevec

Numeric vector; ages scaled by agescale. For SFHburst it is the input burstage.

SFR

Numeric vector; the star formation rate at all ages (SFHfunc only).

masstot

Numeric scalar; total mass formed in Msol.

massvec

Numeric vector; the total mass formed in each age window (SFHfunc only).

SMstar

Numeric vector; if the argument SMstar is TRUE then this will contain the output of SMstarfunc, else NA.

M2L

Numeric scalar; total mass to light ratio.

SFRburst

Numeric scalar; the star formation rate over the last 10^8 years.

Zvec

Numeric vector; Z history. For SFHburst it is the input Z.

emission_input

List; the inputs sent to emissionLines when emission=TRUE.

SMstarfunc produces both the stellar mass formed and the stellar mass remaining for the different time phases provided in the arguments. Finally it produces the total stellar mass formed, and the total stellar mass remaining (not formed- this is the last element listed).

SMburst is a more limited function that just computes the mass remaining from a true instantaneous burst. This is rarely (ever) how ProSpect is used in fitting mode, so most users will not want to use this function to compute stellar masses from ProSpect outputs.

Author(s)

Aaron Robotham

See Also

ProSpectSED, photom, BC03lr, BC03hr, EMILES, massfunc, emissionLines

Examples

#A pretty full example showing some low level things:

SFHdemo_dust=SFHfunc()
plot(SFHdemo_dust$out[,2:3], log='x', ylim=c(26,17), xlab=BC03lr$Labels$Wavelab,
ylab='Mag', col=rev(rainbow(26, end=2/3)), pch=16)

SMdemo=SMstarfunc()
SMdemo

SFHdemo_nodust=SFHfunc(tau_birth=0, tau_screen=0)
wave_star=SFHdemo_nodust$flux[,1]

total_atten=sum(c(0,diff(wave_star))*(SFHdemo_nodust$flux[,2]-SFHdemo_dust$flux[,2]))

plot(SFHdemo_nodust$flux, log='xy', ylim=c(1e-20,1e-15), type='l',
xlab=BC03lr$Labels$Wavelab, ylab='Flux (erg/s/cm^2/Ang)')
lines(SFHdemo_dust$flux, col='grey')
lines(10^seq(5,7,by=0.01), greybody_norm(10^seq(5,7,by=0.01), z=0.1, norm=total_atten),
col='brown')
Dale_temp=Dale_interp(type='NormSFR')
lines(Dale_Msol$Wave, Dale_temp$Aspec*total_atten, col='red')

wave=sort(c(SFHdemo_dust$flux[,'wave'], Dale_Msol$Wave))
SpecAtten=approxfun(SFHdemo_dust$flux, rule=2)(wave)+
          approxfun(Dale_Msol$Wave, Dale_temp$Aspec, rule=2)(wave/1.1)
lines(wave, SpecAtten, col='darkgreen')

#Some different SFHs with identical stellar mass formed (10^10 Msol):

bursty=SFHfunc(massfunc=massfunc_p6, m1=2, m2=1, m3=0, m4=0, m5=0,
  forcemass=1e10, agemax=1e10)
constant=SFHfunc(massfunc=massfunc_p6, m1=1, m2=1, m3=1, m4=1, m5=1,
  forcemass=1e10, agemax=1e10)
young=SFHfunc(massfunc=massfunc_p6, m1=0, m2=0, m3=1, m4=1, m5=0, m6=0,
  forcemass=1e10, agemax=1e10)
old=SFHfunc(massfunc=massfunc_p6, m1=0, m2=0, m3=0, m4=0, m5=1, m6=1,
  forcemass=1e10, agemax=1e10)

#SFHs:

plot(bursty$agevec, bursty$SFR, type='l', col='purple', xlim=c(0,1e10), ylim=c(0,5),
  xlab='Age / Yrs', ylab='SFR / Msol/yr')
lines(constant$agevec, constant$SFR, col='blue')
lines(young$agevec, young$SFR, col='darkgreen')
lines(old$agevec, old$SFR, col='red')
legend('top', legend=c('bursty', 'constant', 'young', 'old'), lty=1,
  col=c('purple', 'blue', 'darkgreen', 'red'))

#Luminosities with default dust attenuation:

wave=bursty$wave_lum
plot(wave, bursty$lum_atten, log='xy', type='l', col='purple', ylim=c(1e-1,1e8),
  xlab='Wavelength / Ang', ylab='Lsol / Ang')
lines(wave, constant$lum_atten, col='blue')
lines(wave, young$lum_atten, col='darkgreen')
lines(wave, old$lum_atten, col='red')
legend('topright', legend=c('bursty', 'constant', 'young', 'old'), lty=1,
  col=c('purple', 'blue', 'darkgreen', 'red'))

asgr/ProSpect documentation built on Feb. 21, 2025, 1:43 a.m.