-
Notifications
You must be signed in to change notification settings - Fork 169
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
use scipy directly instead of astropy modeling for residual fringe fit #7764
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #7764 +/- ##
==========================================
- Coverage 76.58% 76.58% -0.01%
==========================================
Files 456 456
Lines 36960 36920 -40
==========================================
- Hits 28307 28275 -32
+ Misses 8653 8645 -8
*This pull request uses carry forward flags. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Could you start a regression test run? |
Regression tests all pased: https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/820/ The devdeps failure appears related to numpy 2.0 and nep51 and pyyaml/asdf not playing nice together. I think it should be a simple fix in asdf. Here is a draft PR with tests running to see if the issue is addressed: |
abb6aff
to
3c83430
Compare
Regression tests passed without any errors. For this run (820), I marked this as ready for review even though it does not address the other slow function. |
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.
Looks good to me, but I'd like to get some MIRI MRS eyes on it, including testing on a few more datasets than what we have in the regtests, just to verify compatibility with the previous results.
@jemorrison @drlaw1558 could you take this PR code on a shake down run using any appropriate test data you have? |
This is clearly a performance bug in modeling. It is likely one of the sources of its poor performance at scale as the Please open an issue on modeling to describe this. |
Looks ok to me; in the test cases I ran it on the applied fringe correction was identical and unchanged. |
3c83430
to
031e4b2
Compare
Thanks @drlaw1558 for taking a look. I rebased the branch off the main branch to pull in the changelog updates (and fix the conflicts in CHANGES.rst). |
While looking at the regression tests. I noticed that
test_residual_fringe_cal
is one of the slower tests.Running just that test took ~2566 seconds:
https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/817
Profiling the test locally revealed that the majority of the time is spent in 2 functions:
This PR aims to improve the second function
fit_1d_background_complex
by:As mentioned in the astropy Spline1D docs much of the functionality of
Spline1D
is handled byscipy.interpolate.BSpline
. The spline fitting here boiled down to:LSQUnivariateSpline
(which astropy wraps withSplineExactKnotsFitter
)ChiSqOutlierRejectionFitter
The repeated fits are particularly costly with
Spline1D
due in large part to it's calls toinspect
which are avoided by usingBSpline
directly. Here's a zoomed in portion of the plot showing what occurs duringSpline1D.__init__
:Running
test_residual_fringe_cal
with the changes in this PR took 1562 seconds (~60% the previous time):https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/818
A similar plot shows the relative speed-up of
fit_1d_background_complex
(and the remaining large contribution ofnew_fit_1d_fringes_bayes_evidence
to the total runtime):Checklist for maintainers
CHANGES.rst
within the relevant release sectionHow to run regression tests on a PR