bd-j / prospector

Python code for Stellar Population Inference from Spectra and SEDs
http://prospect.readthedocs.io
MIT License
159 stars 75 forks source link

parameter add_igm_absorption not working #180

Closed gkhullar closed 4 years ago

gkhullar commented 4 years ago

Hi,

I am using Prospector (0.3.0) and python-FSPS (0.3.0) to test IGM absorption at redshifts greater than 3.5, using a CSpecBasis sps object, and an SSP (sfh=0) model with dust and subsolar metallicity.

For the following model at z=4, it seems that switching add_igm_absorption to True and False does not change the flux between rest-frame 912-1216A.

model_dict = TemplateLibrary["parametric_sfh"]

model_dict["sfh"]["init"] = 0
model_dict["mass"]["init"] = 10**(float(12.38))
model_dict["mass"]["prior"] = priors.LogUniform(mini=4e8, maxi=6e13)
model_dict["tage"] = {"N": 1, "isfree": True, "init": 0.002,"prior":priors.TopHat(mini=0.,maxi=cluster_age),"units":"Gyr"}
model_dict["tau"] = {"N": 1, "isfree": False, "init": 0.00,"prior":priors.LogUniform(mini=0.01,maxi=2e0),"units":"Gyr"}
model_dict["dust2"] = {"N": 1, "isfree": False, "init": 0.0,"prior":priors.TopHat(mini=0.00, maxi=1.9),"units":"unitless"}
model_dict["logzsol"] = {"N": 1, "isfree": False, "init": -0.72, "prior":priors.LogUniform(mini=-2.0, maxi=2e0),"units":"metallicity"}

model_dict["add_neb_emission"] ={"N": 1,"isfree": False,"init": True}
model_dict["add_neb_continuum"] ={"N": 1,"isfree": False,"init": True}

model_dict["zred"] = {"N": 1, "isfree": False, "init": 4.0, "prior" : priors.TopHat(mini=1.001, maxi=6.001), "units":"redshift, see the python-FSPS documentation"} 
model_dict["peraa"] = {"N": 1,"isfree": False,"init": False}

model_dict["add_igm_absorption"] ={"N": 1,"isfree": False,"init": True}
model_dict["igm_factor"] = {'N': 1, 'isfree': True, 'init': 1.0, 'units': 'factor by which to scale the Madau attenuation', 'prior': priors.ClippedNormal(mean=1.0, sigma=0.1, mini=0.0, maxi=2.0)}

model_dict["mass"]["init_disp"] = 3e9
model_dict["logzsol"]["init_disp"]=0.11

model = SedModel(model_dict)

theta = model.theta.copy()
initial_spec, initial_phot, initial_mfrac = model.sed(theta, obs=obs, sps=sps)

The above model gives me the following SED, where the vertical line is the z=5 observed frame Lyman Alpha 1216A in emission. The issue is that whether add_igm_absorption is True or False, I get the exact same SED via initial_spec. image

To test whether something was wrong with my python-FSPS installation, I ran ~ the same model but for a range of redshifts where the Madau attenuation was substantial. Python-FSPS gives me the following results in the rest-frame, indicating the attenuation is being implemented (y-axis is relative flux). Dotted line is rest-frame lyman alpha, which is visibly affected by the IGM absorption.

image

Is there something incorrect in my Prospector model here? The zred parameter is definitely dimming my SED appropriately (i tested it with a few different zred values). Happy to provide more information on this. Thank you in advance!

bd-j commented 4 years ago

Hi, Sorry to be so late responding and thank you for the detailed issue documentation. By default all redshifting functionality is handled by prospector for speed and flexibility reasons. Unfortunately IGM absorption is not handled in this way. You should be able to get correct behavior by doing the following when instantiating your SPS object

sps = CSPSpecBasis(reserved_params=["sigma_smooth"])

(i.e. dropping "zred" from the parameters reserved for prospector)

There may be some slowdown (see #162) which I hope to fix in the next week or so.

gkhullar commented 4 years ago

Hi Ben

Thanks so much -- this worked great for CSPSpecBasis and FastStepBasis and I am definitely seeing IGM absorption!