-
Notifications
You must be signed in to change notification settings - Fork 103
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
Combine refactor #1813
Combine refactor #1813
Conversation
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. I think the only requests I have are minor doc updates. But we should talk more about moving the lamp checking code and whether we want to make that change in this PR.
pypeit/images/combineimage.py
Outdated
|
||
# TODO JFH: This should not be here, but rather should be done in the Calibrations class. Putting in calibration specific | ||
# lamp checking in an image combining class is not ideal. |
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.
In principle, I agree. A lamp check that is specific to arcs is out of place in a generic image-combining class. We could push the lamp check into Calibrations.get_arc
, but we need to be careful about the amount of code that would need to be repeated and minimize the number of times we need to open the raw files.
I would say that the exposure time check should stay here (and we should deal with combining images with different exposure times better...).
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 agree. In fact, since we are now passing in a pypeitImage
(and not doing the reading/processing in this function as before), we should move the lamp checks to pypeit/images/buildimage.buildimage_fromlist()
. This allows @jhennawi to remove the fudged function in jwst_nirspec()
I think this makes the most sense.
I mostly agree with @kbwestfall that the exposure time stuff should stay here though, although I could be convinced either way, and that might be worth a separate discussion.
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.
@rcooke-ast this arc lamp checking stuff was not added by me in this PR, but rather I think by you in a different context. Can you please confirm? All I did was move that bit of code here from another of the image combine routines in order to be compatible with the refactor.
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's a simple change... I will submit a small PR into this so you can see what I mean. I just didn't want to monkey around with your PR.
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.
@@ -789,6 +789,9 @@ def objfind_one(self, frames, det, bg_frames=None, std_outfile=None): | |||
bkg_redux_sciimg = sciImg | |||
# Build the background image | |||
bg_file_list = self.fitstbl.frame_paths(bg_frames) | |||
# TODO I think we should create a separate self.par['bkgframe'] parameter set to hold the image | |||
# processing parameters for the background frames. This would allow the user to specify different | |||
# parameters for the background frames than for the science frames. |
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.
Let's talk more about this.
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #1813 +/- ##
===========================================
+ Coverage 38.48% 38.49% +0.01%
===========================================
Files 207 207
Lines 48153 48171 +18
===========================================
+ Hits 18533 18545 +12
- Misses 29620 29626 +6 ☔ View full report in Codecov by Sentry. |
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 look good to me. But we need to run the tests!
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 PR looks good to me. I only have one request (+ running the tests as usual)
Lots of test failures:
Except for the known |
That's fine with me, but note that @jhennawi hasn't responded to my comment on PR #1822, so I'm not sure if he approves of my proposed changes. |
Tests pass
|
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 - thanks!
pypeit/images/combineimage.py
Outdated
|
||
# TODO JFH: This should not be here, but rather should be done in the Calibrations class. Putting in calibration specific | ||
# lamp checking in an image combining class is not ideal. |
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.
This short PR refactors the CombineImage class to work on lists of images rather than lists of files. The file processing is moved into the calling routine pypeit.images.buildimage.py which makes more sense since this already takes the file list as the argument.
The advantages of this scheme is that it allows the class to work with JWST images for which the raw image reading routines do not work, because processing needs to be done to convert JWST outputs into PypeIt inputs. Furthermore, it produces a cleaner interface whereby CombineImage simply combines images but does not do file reading or image processing.
@rcooke-ast can you please see my comments about the arc lamp checking that I believe you added to this routine on line 291 of combineimage.py? My feeling is that checking specific things about the inputs to an image combining class should be performed outside of that class such that you pass in only the right images. The point is that others might want to check other things, and at some point the number of things we would check in this single purpose code would balloon. I think lamp exposure time checking should be done in calibrations.