Closed djperrefort closed 5 years ago
You have to explicitly set the amplitude of the model.
https://sncosmo.readthedocs.io/en/v2.0.x/models.html
For a given model, you can set the amplitude (or x0 in case you are using a SALT model) according to a desired absolute magnitude in a specific band by using the method set_source_peakabsmag(). Note that the redshift z affects your result. Therefore, you could specify:
>>> model.set(z=1.6) >>> model.set_source_peakabsmag(-19.0, 'bessellb', 'ab')
Specifically, for SALT models, it is recommended to call set_source_peakabsmag() after setting the other model parameters, such as x1 and c. It probably won’t make a difference if you are using the 'bessellb' bandpass, but if you were setting the absolute magnitude in another band, it would make a small difference.
The reason for this peculiarity is that “absolute magnitude” is not a parameter in the SALT2 model, per se. The parameters are x0, x1, c, t0, and z. x0 is a simple multiplicative scaling factor on the whole spectral timeseries. The set_source_peakabsmag() method is a convenience for setting x0 such that the integrated flux through a given bandpass is as desired. Since the integrated flux depends on the spectral shape, it will depend on x1 and c.
@wmwv That fixed it, thanks!
@wmwv I've double checked my use of globals and took a second look at the notebook we discussed this morning. I'm still getting results that don't make sense and can't spot my mistake.
To check my logic I tried simulating flux instead of magnitude and then manually calculated the magnitude, but I got the same values as before. I also tried running different salt2 models and there was no change (which was expected). I also checked that the wrapper for sncosmo I wrote is returning the correct values, which also passed.
Maybe something is wrong with how I am using sncosmo? I honsetly don't know.