bd-j / prospector

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

Weirdly fit SED continuum when fitting SEDs with nebular line emission #301

Closed gracekrahm closed 9 months ago

gracekrahm commented 11 months ago

I am trying to fit SEDs with nebular line emission using the add_neb_emission, gas_logu, and add_neb_continuum parameters. These seem to fit the actual nebular emission lines fairly well, however, the presence of the nebular lines seems to throw off the fit of the SED continuum. snap74_galaxy6_sed

For many of the galaxies like the one shown above, the SED is fit much lower than the mock SED generated by powderday in the section of the SED with nebular lines. Is this issue possibly caused by flags that we aren't setting correctly or something else?

Our initial parameters are included below with the full script and minimal example available here

model_params = []

#basics                                                                            
model_params.append({'name': "zred", "N": 1, "isfree": False,"init": zred,"units": "Mpc"})
model_params.append({'name': 'pmetals', 'N': 1,'isfree': False,'init': -99,'prior': None})
model_params.append({'name': 'imf_type', 'N': 1,'isfree': False,'init': 2})
#M-Z
model_params.append({'name': 'logmass', 'N': 1,'isfree': True,'init': 10.0,'prior': priors.Uniform(mini=7.5, maxi=12.)})
model_params.append({'name': 'logzsol', 'N': 1,'isfree': True,'init': -0.5,'prior': priors.Uniform(mini=-1., maxi=0.2)})
#SFH
model_params.append({'name': "sfh", "N": 1, "isfree": False, "init": 3})
model_params.append({'name': "mass", 'N': 3, 'isfree': False, 'init': 1., 'depends_on':zfrac_to_masses_log})
model_params.append({'name': "agebins", 'N': 1, 'isfree': False,'init': []})
model_params.append({'name': "z_fraction", "N": 2, 'isfree': True, 'init': [0, 0],'prior': priors.Beta(alpha=1.0, beta=1.0, mini=0.0, maxi=1.0)})
#Dust attenuation                                                                                                            
model_params.append({'name': 'dust_type', 'N': 1,'isfree': False,'init': 0,'prior': None})
model_params.append({'name': 'dust1', 'N': 1,'isfree': False, 'init': 1.0,'prior': priors.Uniform(mini=0., maxi=2.0)})
model_params.append({'name': 'dust2', 'N': 1,'isfree': True, 'init': 1.0,'prior': priors.Uniform(mini=0.0, maxi=3.0)})
model_params.append({'name': 'dust_index', 'N': 1,'isfree': True,'init': -0.9, 'prior': priors.Uniform(mini=-1.2, maxi=0.3)})
#Dust Emission                                                                                                                                             
model_params.append({'name': 'add_dust_emission', 'N': 1,'isfree': False,'init': 1})
model_params.append({'name': 'duste_gamma', 'N': 1,'isfree': False,'init': 0.01,'prior': priors.Uniform(mini=0.0, maxi=1.0)})
model_params.append({'name': 'duste_umin', 'N': 1,'isfree': False,'init': 10.0,'prior': priors.Uniform(mini=0.1, maxi=30.0)})
model_params.append({'name': 'duste_qpah', 'N': 1,'isfree': False,'init': 1.,'prior': priors.Uniform(mini=0.0, maxi=10.0)})

#Misc
model_params.append({'name': 'add_agb_dust_model', 'N': 1,'isfree': False,'init': 0})
model_params.append({'name': 'add_neb_emission', 'N': 1,
                        'isfree': False,
                        'init': True,
                        'units': r'log Z/Z_\odot',
                        'prior': None})
#model_params.append({'name': 'nebular', 'N': 1,'isfree': True,'init': -2, 'prior':None})  #add neb emission
model_params.append({'name': 'gas_logu', 'N': 1,
                        'isfree': False,
                        'init': -2.0,
                        'units': '',
                        'prior': priors.TopHat(mini=-4.0, maxi=-1.0)})

model_params.append({'name': 'add_neb_continuum', 'N': 1,
                        'isfree': False,
                        'init': True,
                        'units': r'log Z/Z_\odot',
                        'prior': None})
bd-j commented 10 months ago

Those nebular parameters look ok to me To be clear, you are fitting to photometry, not the spectrum? Are the photometric points well fit? In that case the mismatch in the detailed spectra may be due to a real degeneracy.

I might suggest setting zcontinuous=1 and dropping the pmetals parameter. You might also want more than 3 SFH bins.

bd-j commented 9 months ago

Assuming this is resolved, but feel free to re-open if the issue has persisted. Thanks.