Skip to content

Commit

Permalink
forgot one parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
debora-pe committed Nov 14, 2024
1 parent 3f3237d commit 40cd1d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions pypeit/core/flexure.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
from IPython import embed


def spat_flexure_shift(sciimg, slits, bpm=None, maxlag=20, sigdetect=10., debug=False, qa_outfile=None):
def spat_flexure_shift(sciimg, slits, bpm=None, maxlag=20, sigdetect=10., debug=False, qa_outfile=None, qa_vrange=None):
"""
Calculate a rigid flexure shift in the spatial dimension
between the slitmask and the science image.
Expand All @@ -73,6 +73,9 @@ def spat_flexure_shift(sciimg, slits, bpm=None, maxlag=20, sigdetect=10., debug=
Run in debug mode
qa_outfile (:obj:`str`, optional):
Path to the output file where the QA is saved. If None, the QA is not generated.
qa_vrange (:obj:`tuple`, optional):
Tuple with the vmin and vmax values for the imshow plot in the QA. If None, the
vmin and vmax values are calculated from the data.
Returns:
float: The spatial flexure shift relative to the initial slits
Expand Down Expand Up @@ -136,12 +139,12 @@ def spat_flexure_shift(sciimg, slits, bpm=None, maxlag=20, sigdetect=10., debug=
plt.show()

# 2D plot
spat_flexure_qa(sciimg, slits, shift, gpm=np.logical_not(bpm))
spat_flexure_qa(sciimg, slits, shift, gpm=np.logical_not(bpm), vrange=qa_vrange)

if qa_outfile is not None:
# Generate the QA plot
msgs.info("Generating QA plot for spatial flexure")
spat_flexure_qa(sciimg, slits, shift, gpm=np.logical_not(bpm), outfile=qa_outfile)
spat_flexure_qa(sciimg, slits, shift, gpm=np.logical_not(bpm), vrange=qa_vrange, outfile=qa_outfile)

return shift

Expand Down
3 changes: 2 additions & 1 deletion pypeit/images/rawimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,8 @@ def spatial_flexure_shift(self, slits, force=False, debug=False):
self.spat_flexure_shift = flexure.spat_flexure_shift(self.image[0], slits, bpm=self._bpm[0],
maxlag=self.par['spat_flexure_maxlag'],
sigdetect=self.par['spat_flexure_sigdetect'],
debug=debug, qa_outfile=qa_outfile)
debug=debug, qa_outfile=qa_outfile,
qa_vrange=self.par['spat_flexure_vrange'])
self.steps[step] = True
# Return
return self.spat_flexure_shift
Expand Down

0 comments on commit 40cd1d4

Please sign in to comment.