-
Notifications
You must be signed in to change notification settings - Fork 63
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
Adding synphot #424
Adding synphot #424
Conversation
@pllim I've tried running this branch with your branch in poppy and I'm getting some errors from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pysynphot and stsynphot are not 100% interchangable, especially when it comes to Quantity support and underlying machinery.
dev_utils/compute_psf_library.py
Outdated
if package_version.parse(poppy_ver) > package_version.parse("0.9.2"): | ||
import stsynphot | ||
else: | ||
import pysynphot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't do this: This looks like a maintenance nightmare. Much easier to cut the next major release and not use pysynphot at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed in the long run, yes. This is intentional and needed in the short term transitional period however. We plan to take it out after this next release.
Codecov Report
@@ Coverage Diff @@
## develop #424 +/- ##
===========================================
- Coverage 48.39% 48.39% -0.01%
===========================================
Files 14 14
Lines 5837 5912 +75
===========================================
+ Hits 2825 2861 +36
- Misses 3012 3051 +39
Continue to review full report at Codecov.
|
The tests passed here. I don't understand where are the errors you need help with. Can you please clarify? Thanks! |
@pllim, the errors come from running this branch of webbpsf with your |
@shanosborne , can you please have this branch call that branch here, so we can all see the log in CI? Thanks! |
I waited a while for https://travis-ci.org/github/spacetelescope/webbpsf/jobs/760994800 to run but it passed. 🤷 (I cancelled the irrelevant jobs.) |
Oh shoot you're right. I messed up the test and didn't add an |
Seems like Travis CI has a very long queue time now. Still waiting for it to start. 🤞 |
Right, so now we have the case where the fact that the poppy PR isn't merged yet has become a problem. So I'm going to add a commit to flip the sign of the version check in |
@shanosborne for the version check - how about instead of looking at the version number we try looking at just what poppy is using directly. Something like this:
And, optional, but I wonder if it's worth consolidating these if/else statements into one place in the code, so there's less to undo later when we can take out all the pysynphot refs eventually. This all would indeed be easier if we could afford a case of temporary breakage of dependencies if we don't merge both PRs at the exact same time, but alas from past experience that way lies confusion and hassle... |
I still think it is less maintenance burden to branch out 0.9.x that only uses pysynphot and only support stsynphot going forward. People who want to use pysynphot can use your 0.9.x releases and you can backport things into it from develop as needed. But I am not the one who has to maintain this package. |
I guess we finally got it? Are the errors in https://travis-ci.org/github/spacetelescope/webbpsf/jobs/761016058 what you also see locally, @shanosborne ? |
Most of the failures are caused by your source and bandpass "waveset" not overlapping completely or at all. This usually means either one of them have wavelength in existing values but now in wrong unit or some assumptions you made with PySynphot no longer makes sense. I'll see if I can sniff it out with your test cases. There is one error where somehow you are passing in zero or negative for wavelength, which is not allowed. |
This comment has been minimized.
This comment has been minimized.
After discussions with @shanosborne , I have created this gist to explain why you are seeing failures, and provide workarounds, where possible. Many thanks to Shannon who patiently provided me with the necessary info. tl;dr
|
@shanosborne FYI the PR in poppy is now merged, so here we can take out the temporary parts (extra tox test case etc) and hopefully merge this shortly. Can you take care of the few updates needed in this, please? I'm not sure if anything's needed besides just the changes in the test setup? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed this should have the temporary test case revised out before we merge.
Looking at this now I'm starting to have second thoughts about the back compatibility approach, but probably not enough to revise. I still want to make sure we take zero chance of breaking any dependencies in any of the team practices etc; but I'm not sure we want all the switching code around in the long run. We probably should consider pysynphot deprecated and remove this before some later release I suppose.
One minor change requested, plus the test case stuff, and then this should be good to merge. Thanks!
docs/references.rst
Outdated
Pysynphot CDBS files used for the development version of the JWST Exposure Time Calculators (ETCs), | ||
Stsynphot CDBS files used for the development version of the JWST Exposure Time Calculators (ETCs), | ||
normalized to peak transmission = 1.0 (because absolute throughput is not | ||
relevant for PSF calculations). Not all filters are yet supported in Pysynphot, | ||
relevant for PSF calculations). Not all filters are yet supported in Stsynphot, | ||
however. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: This text can be updated, as it's outdated in ways besides just the py/stsynphot change. Let's say the following:
Instrumental relative spectral responses are derived from the reference data files used by the Pandeia engine <https://jwst-docs.stsci.edu/jwst-exposure-time-calculator-overview/jwst-etc-pandeia-engine-tutorial/installing-pandeia#InstallingPandeia-DataFiles>
_ for the JWST Exposure Time Calculator<https://jwst.etc.stsci.edu>
_, normalized to peak transmission=1.0 (because absolute throughput is not relevant for PSF calculations).
Re: tox -- You still want a new job to test against stsynphot (unless you want to swap it out with pysynphot in existing jobs) but maybe not call it "poppydev". |
Update dependencies min versions
…to shanosborne-stsynphot
Travis passes, codecov is "failing" but irrelevant (-0.01% delta), I'm going ahead with this since it's needed with the current dev poppy. |
This PR aims to work with spacetelescope/poppy#388 to replace
pysynphot
withstsynphot
.After discussion with @mperrin, we decided that completely replacing
pysynphot
in webbpsf would cause problems for our dev users (especially ote sim mirage users) if they have mismatched webbpsf and poppy versions. So instead, we decided to add a check for the user's poppy version inside webbpsf. If poppy > 0.9.2 (the latest release), the code would usestsynphot
, if poppy <= 0.9.2, the code would usepysynphot
. We will remove this check for the next release of webbpsf, but this will help users in the meantime.Testing Note: Because of the version check above, since the poppy PR with the
stsynphot
changes isn't merged yet, in order to test this you'll need to change the>
to<
in line 57 inwebbpsf_core.py
. That or we'll need to rebase the poppy PR to appear that the change is after 0.9.2