Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is effstim wrong when calculated in PHOTNU and PHOTLAM? #103

Open
pllim opened this issue Oct 19, 2018 · 1 comment
Open

Is effstim wrong when calculated in PHOTNU and PHOTLAM? #103

pllim opened this issue Oct 19, 2018 · 1 comment

Comments

@pllim
Copy link
Collaborator

pllim commented Oct 19, 2018

This does not make sense to me:

>>> import pysynphot as S
>>> S.__version__
'0.9.12'
>>> bp = S.ObsBandpass('acs,wfc1,f555w')
>>> sp = S.Vega
>>> obs = S.Observation(sp, bp)
>>> bp.pivot()
5360.938305731454
>>> obs.effstim()
1024.232011041325
>>> obs.effstim('photnu')
8.744735882086226e+28
>>> S.units.Photlam().ToPhotnu(bp.pivot(), obs.effstim())
9.818819146083892e-09
>>> obs.effstim('jy')
3630.073134871727
>>> S.units.Photlam().ToJy(bp.pivot(), obs.effstim())
3638.3434633950515

As shown above, effstim() calculated in Jy is not that far off compared to effstim() calculated in PHOTLAM and then converted to Jy around bandpass' pivot wavelength. However, that is not the case for PHOTNU. Why?

@deustua and @tddesjardins , since you have been looking into this from the INS side, what do you think? Is this a bug or am I not understanding something about effective stimulus in PHOTNU?

git blame shows that the Photnu.unitResponse() method used in the calculation in question was implemented by @vglaidler 11 years ago and has no changed since.

@pllim pllim changed the title Is effstim wrong with calculated in PHOTNU? Is effstim wrong when calculated in PHOTNU? Oct 19, 2018
@pllim pllim changed the title Is effstim wrong when calculated in PHOTNU? Is effstim wrong when calculated in PHOTNU and PHOTLAM? Feb 7, 2019
@pllim
Copy link
Collaborator Author

pllim commented Feb 7, 2019

Looking at this more and referring to @deustua 's "first principle" formula that states effstim in PHOTLAM should be the same as effstim in FLAM converted to PHOTLAM along bandpass' pivot wavelength, I think PHOTLAM values might be problematic as well but at a smaller scale.

>>> from astropy import units as u
>>> import pysynphot as S
>>> S.__version__
'0.9.12'
>>> bp = S.ObsBandpass('acs,wfc1,f555w')
>>> sp = S.Vega
>>> obs = S.Observation(sp, bp)
>>> w = bp.pivot()
>>> effstim_flam = obs.effstim('flam')
>>> effstim_photlam = obs.effstim()
>>> x = (effstim_flam * (u.erg / u.s / u.cm ** 2 / u.AA)).to(u.ph / u.s / u.cm ** 2 / u.AA, u.spectral_density(w * u.AA))
>>> x
<Quantity 1021.92386949 ph / (Angstrom cm2 s)>
>>> print('{:.2%}'.format(abs(x.value - effstim_photlam) / effstim_photlam))
0.23%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant