-
Notifications
You must be signed in to change notification settings - Fork 76
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
spectral extraction: improved logic for initial position of "Manual" background trace #1738
Conversation
2bb8b80
to
18adcee
Compare
18adcee
to
d0bc2e4
Compare
Codecov ReportBase: 87.27% // Head: 87.65% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1738 +/- ##
==========================================
+ Coverage 87.27% 87.65% +0.37%
==========================================
Files 95 95
Lines 10082 10131 +49
==========================================
+ Hits 8799 8880 +81
+ Misses 1283 1251 -32
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
It looks like sign
is different for the "Manual" and "OneSided" cases when brightest_pixel
is in the top half of the image, but the same for both cases when brightest_pixel
is in the bottom half. Since the example Specviz2D notebook's brightest pixel is in its image's top half, the initial guesses for the "OneSided" and "Manual" options end up on opposite sides of the brightest pixel.
I think the two guesses for "Manual" and "OneSided" should either always be in the same spot (like now, when brightest_pixel < width / 2
) or always be opposite from another (like now, when brightest_pixel >= width / 2
).
Good point, I didn't explain the logic very well. The sign for the "OneSided" case is only applied if the separation would push the "TwoSided" case off the edge of the image, since the We could separate the |
I agree that a simpler approach is better here and think having the "Manual" position match the "OneSided" position makes sense. |
c9b74da
to
76b4e4b
Compare
if default_bg_width * 2 >= distance_from_edge: | ||
sign = 1 if (brightest_pixel < width / 2) else -1 | ||
default_bg_separation = sign * default_bg_width * 2 |
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.
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.
The new commit sufficiently addresses my previous comment, and understood about the failing test. Should a merge here wait until the test has been rewritten? I imagine this branch would pass, but the change is also not an extremely urgent one.
I think since we know this case works, it's ok to get in with the slightly lower coverage? This is the exact same case that was covered before, so these lines will be covered once that test is rewritten. But I'm also ok letting this PR sit as long as that test doesn't fall off the radar too long - I agree this PR isn't urgent and don't expect merge conflicts. |
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.
Code looks like code and we have a follow-up issue, so merging. Thanks!
Description
This pull request improves the logic for the initial guess for the position of the "Manual" background trace. Previously it started at the same guess as the extraction trace (based on the brightest flux medianed over the dispersion direction). Now it uses the same location that would be adopted for a OneSided background, with the "direction" determined on whether the extraction trace is in the top or bottom half of the image, and the separation at 10% of the cross-dispersion "height".
Motivated by @ojustino's comment: #1682 (review)
Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.