diff --git a/src/fsps/fsps.f90 b/src/fsps/fsps.f90 index 7eff93be..9dce215f 100644 --- a/src/fsps/fsps.f90 +++ b/src/fsps/fsps.f90 @@ -46,19 +46,19 @@ subroutine set_ssp_params(imf_type0,imf_upper_limit0,imf_lower_limit0,& delt,sbss,fbhb,pagb,add_stellar_remnants0,& tpagb_norm_type0,add_agb_dust_model0,agb_dust,& redgb,agb,masscut,fcstar,evtype,use_wr_spectra0,& - logt_wmb_hot0,smooth_lsf0) + logt_wmb_hot0,add_xrb_emission0,frac_xrb,smooth_lsf0) ! Set the parameters that affect the SSP computation. implicit none integer, intent(in) :: imf_type0,add_stellar_remnants0,tpagb_norm_type0,& - add_agb_dust_model0,use_wr_spectra0,smooth_lsf0 + add_agb_dust_model0,use_wr_spectra0,add_xrb_emission0,smooth_lsf0 double precision, intent(in) :: imf_upper_limit0, imf_lower_limit0,& imf1,imf2,imf3,vdmc,mdave,dell,& delt,sbss,fbhb,pagb,agb_dust,& redgb,agb,masscut,fcstar,evtype,& - logt_wmb_hot0 + logt_wmb_hot0,frac_xrb imf_type=imf_type0 imf_upper_limit=imf_upper_limit0 @@ -69,6 +69,7 @@ subroutine set_ssp_params(imf_type0,imf_upper_limit0,imf_lower_limit0,& use_wr_spectra=use_wr_spectra0 logt_wmb_hot=logt_wmb_hot0 smooth_lsf=smooth_lsf0 + add_xrb_emission=add_xrb_emission0 pset%imf1=imf1 pset%imf2=imf2 pset%imf3=imf3 @@ -85,6 +86,7 @@ subroutine set_ssp_params(imf_type0,imf_upper_limit0,imf_lower_limit0,& pset%masscut=masscut pset%fcstar=fcstar pset%evtype=evtype + pset%frac_xrb=frac_xrb has_ssp(:) = 0 has_ssp_age(:,:) = 0 @@ -96,7 +98,7 @@ subroutine set_csp_params(smooth_velocity0,redshift_colors0,& dust_type0,add_dust_emission0,add_neb_emission0,& add_neb_continuum0,cloudy_dust0,add_igm_absorption0,& zmet,sfh,wgp1,wgp2,wgp3,tau,& - const,tage,fburst,tburst,dust1,dust2,& + const,tage,fburst,tburst,dust1,dust2,dust3,& logzsol,zred,pmetals,dust_clumps,frac_nodust,& dust_index,dust_tesc,frac_obrun,uvb,mwr,& dust1_index,sf_start,sf_trunc,sf_slope,& @@ -114,7 +116,7 @@ subroutine set_csp_params(smooth_velocity0,redshift_colors0,& add_neb_continuum0,cloudy_dust0,add_igm_absorption0,& zmet,sfh,wgp1,wgp2,wgp3 double precision, intent(in) :: tau,& - const,tage,fburst,tburst,dust1,dust2,& + const,tage,fburst,tburst,dust1,dust2,dust3,& logzsol,zred,pmetals,dust_clumps,frac_nodust,& dust_index,dust_tesc,frac_obrun,uvb,mwr,& dust1_index,sf_start,sf_trunc,sf_slope,& @@ -146,6 +148,7 @@ subroutine set_csp_params(smooth_velocity0,redshift_colors0,& pset%tburst=tburst pset%dust1=dust1 pset%dust2=dust2 + pset%dust3=dust3 pset%logzsol=logzsol pset%zred=zred pset%pmetals=pmetals diff --git a/src/fsps/fsps.py b/src/fsps/fsps.py index a5729772..997de35c 100644 --- a/src/fsps/fsps.py +++ b/src/fsps/fsps.py @@ -161,6 +161,9 @@ class StellarPopulation(object): stars; a value of 1.0 implies that the Vassiliadis & Wood (1994) tracks are implemented as–is. + :param frac_xrb: (default: 1.0) + Scaling factor for the X-ray source spectrum to be added to the SSPs. + :param zred: (default: 0.0) Redshift. If this value is non-zero and if ``redshift_colors=1``, the magnitudes will be computed for the spectrum placed at redshift @@ -237,6 +240,9 @@ class StellarPopulation(object): Use the Eldridge (2017) WMBasic hot star library above this value of :math:`\log T_\mathrm{eff}` or 25,000K, whichever is larger. + :param add_xrb_emission: (default: 0) + Turn on/off the x-ray binary population spectra from Garofali et al. + :param masscut: (default: 150.0) Truncate the IMF above this value. @@ -350,6 +356,11 @@ class StellarPopulation(object): Dust parameter describing the attenuation of old stellar light, i.e. where ``t > dust_tesc`` (for details, see Conroy et al. 2009a). + :param dust3: (default: 0.0) + Dust parameter describing extra attenuation of old stellar light that + does _not_ afect the young (``t < dust_tesc`` ) star light. The + attenuation curve will be the one specified by ``dust_type`` + :param dust_clumps: (default: -99.) Dust parameter describing the dispersion of a Gaussian PDF density distribution for the old dust. Setting this value to -99.0 sets the @@ -460,6 +471,7 @@ def __init__( fbhb=0.0, sbss=0.0, pagb=1.0, + frac_xrb=1.0, zred=0.0, zmet=1, logzsol=0.0, @@ -475,6 +487,7 @@ def __init__( evtype=-1, use_wr_spectra=1, logt_wmb_hot=0.0, + add_xrb_emission=0, masscut=150.0, sigma_smooth=0.0, min_wave_smooth=1e3, @@ -495,6 +508,7 @@ def __init__( dust_type=0, dust1=0.0, dust2=0.0, + dust3=0.0, dust_clumps=-99.0, frac_nodust=0.0, frac_obrun=0.0, @@ -1256,6 +1270,8 @@ class ParameterSet(object): "evtype", "use_wr_spectra", "logt_wmb_hot", + "add_xrb_emission", + "frac_xrb", "smooth_lsf", ] @@ -1282,6 +1298,7 @@ class ParameterSet(object): "tburst", "dust1", "dust2", + "dust3", "logzsol", "zred", "pmetals", diff --git a/tests/tests.py b/tests/tests.py index 4df7dbe2..ee2aaf73 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -257,6 +257,35 @@ def test_redshift(pop_and_params): assert np.all(v5 != v4) +def test_dust3(pop_and_params): + """Make sure nebular lines are actually added.""" + + # uses default SSPs + + pop, params = pop_and_params + _reset_default_params(pop, params) + pop.params["sfh"] = 4 + pop.params["dust_type"] = 4 + pop.params["tau"] = 5.0 + pop.params["dust1"] = 0 + pop.params["dust2"] = 0.5 + + # make sure dust3 affects the population when there are old stars + pop.params["dust3"] = 0.0 + mag1 = pop.get_mags(tage=1.0, bands=["u", "b"]) + pop.params["dust3"] = 1.0 + mag2 = pop.get_mags(tage=1.0, bands=["u", "b"]) + assert np.all(mag2 > mag1) + + # make sure the dust3 isn't affecting young populations + pop.params["dust_tesc"] = 8 + pop.params["dust3"] = 0.0 + mag3 = pop.get_mags(tage=0.05, bands=["u", "b"]) + pop.params["dust3"] = 1.0 + mag4 = pop.get_mags(tage=0.05, bands=["u", "b"]) + assert_allclose(mag3, mag4) + + def test_nebemlineinspec(pop_and_params): """Make sure nebular lines are actually added."""