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

Predicting full spectrum when Modelling Spectroscopy + Photometry at the same time #324

Closed elmiio closed 6 months ago

elmiio commented 6 months ago

I am attempting to model some spectroscopic and photometric data using a simple stellar population model template. In the past, I have only done modelling where I had one or the other, but not both. I am wondering, is there a way to generate a MAP spectrum that spans the wavelengths of both the photometric and spectroscopic data at once? If this is not possible, is there then a way to generate a MAP spectrum that can be separately compared to the photometry and spectroscopy?

bd-j commented 6 months ago

Hi @elmiio the easiest way is to create a new 'empty' observation dictionary, and then ask for the model prediction with that data. By default if no spectrum is to be fit, the code will output the full model spectrum (similar to if you fit photometry only)

from prospect.utils.obsutils import rectify_obs
empty_obs = dict(wavelengths=None, spectrum=None, filters=None)
spec, phot, x = model.predict(theta_map, sps=sps, obs=obs)
fullspec, _, _ = model.predict(theta_map, sps=sps, obs=empty_obs)
ax.plot(sps.wavelengths * (1 + model.params["zred"]) , fullspec)
elmiio commented 6 months ago

I see. This seems to do exactly what I was looking for, thank you. Can I re-open this issue if I have any further questions?

bd-j commented 6 months ago

yes, please do re-open if there are further issues with this.

YourVoicee commented 5 months ago

Hello! I apologize if my question is obvious, but I wanted to join in and ask about the prediction of parameters (e.g., mass, metallicity) using both photometric and spectroscopic data. Is it possible to combine these two types of information to obtain more accurate estimates of the parameters, or will the parameters be determined only from the part of the spectrum that is used for the input?