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

Spatial flexure reorganisation #1860

Merged
merged 14 commits into from
Oct 15, 2024
Merged

Conversation

rcooke-ast
Copy link
Collaborator

This delta PR moves the manual spatial flexure correction to the RawImage. The benefit of this approach is that manual spatial flexure can now be assigned for any frame (including calibrations). Previously, it was only science/standard/background frames that could have a manual flexure. Tests pass:

image

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 63.38028% with 26 lines in your changes missing coverage. Please review.

Project coverage is 38.05%. Comparing base (2f3eb13) to head (0dce8e9).
Report is 15 commits behind head on spatflex_options.

Files with missing lines Patch % Lines
pypeit/images/rawimage.py 16.66% 15 Missing ⚠️
pypeit/calibrations.py 70.37% 8 Missing ⚠️
pypeit/inputfiles.py 83.33% 1 Missing ⚠️
pypeit/metadata.py 87.50% 1 Missing ⚠️
pypeit/pypeit.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##           spatflex_options    #1860      +/-   ##
====================================================
+ Coverage             38.04%   38.05%   +0.01%     
====================================================
  Files                   211      211              
  Lines                 49226    49252      +26     
====================================================
+ Hits                  18730    18745      +15     
- Misses                30496    30507      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@debora-pe debora-pe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcooke-ast Thank you for doing this.
I tested the code a bit and it looks good. I only found a bug, which was not introduced here, but your code exposed it! And I have a few more comments/requests.
Please take a look at them, but I am approving anyway.

pypeit/calibrations.py Outdated Show resolved Hide resolved
@@ -756,11 +775,12 @@ def get_flats(self):
= [], None, None, illum_setup, None, detname
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raw_pixel_index should be added here too, as an empty list (just for consistency)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - good catch

@@ -160,7 +160,7 @@ def construct_file_name(cls, calib_key, calib_dir=None, basename=None):

def buildimage_fromlist(spectrograph, det, frame_par, file_list, bias=None, bpm=None, dark=None,
scattlight=None, flatimages=None, maxiters=5, ignore_saturation=True,
slits=None, mosaic=None, calib_dir=None, setup=None, calib_id=None):
slits=None, mosaic=None, manual_spat_flexure=None, calib_dir=None, setup=None, calib_id=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add manual_spat_flexure description in the docstring

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, added 👍

@@ -401,7 +401,7 @@ def build_rn2img(self, units='e-', digitization=False):
return np.array(rn2)

def process(self, par, bpm=None, scattlight=None, flatimages=None, bias=None, slits=None, dark=None,
mosaic=False, debug=False):
mosaic=False, manual_spat_flexure=None, debug=False):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add manual_spat_flexure description in the docstring

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also done :-)

Copy link
Collaborator Author

@rcooke-ast rcooke-ast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @debora-pe, and for catching that bug! All comments addressed, and merging.

@@ -756,11 +775,12 @@ def get_flats(self):
= [], None, None, illum_setup, None, detname
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - good catch

@@ -160,7 +160,7 @@ def construct_file_name(cls, calib_key, calib_dir=None, basename=None):

def buildimage_fromlist(spectrograph, det, frame_par, file_list, bias=None, bpm=None, dark=None,
scattlight=None, flatimages=None, maxiters=5, ignore_saturation=True,
slits=None, mosaic=None, calib_dir=None, setup=None, calib_id=None):
slits=None, mosaic=None, manual_spat_flexure=None, calib_dir=None, setup=None, calib_id=None):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, added 👍

@@ -401,7 +401,7 @@ def build_rn2img(self, units='e-', digitization=False):
return np.array(rn2)

def process(self, par, bpm=None, scattlight=None, flatimages=None, bias=None, slits=None, dark=None,
mosaic=False, debug=False):
mosaic=False, manual_spat_flexure=None, debug=False):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also done :-)

@rcooke-ast rcooke-ast merged commit d8f5293 into spatflex_options Oct 15, 2024
20 checks passed
@rcooke-ast rcooke-ast deleted the spatflex_redoshift branch October 15, 2024 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants