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

Fix for Issue # 1643 #1645

Merged
merged 3 commits into from
Aug 10, 2023
Merged

Fix for Issue # 1643 #1645

merged 3 commits into from
Aug 10, 2023

Conversation

debora-pe
Copy link
Collaborator

As titled. Issue #1643
The problem was not in the slitspatnum implementation but in dealing with masked slits in HolyGrail

@debora-pe debora-pe requested a review from jhennawi August 3, 2023 23:42
@codecov-commenter
Copy link

codecov-commenter commented Aug 3, 2023

Codecov Report

Merging #1645 (8279bfb) into develop (ecbd212) will increase coverage by 0.35%.
The diff coverage is 11.11%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@             Coverage Diff             @@
##           develop    #1645      +/-   ##
===========================================
+ Coverage    40.98%   41.34%   +0.35%     
===========================================
  Files          189      189              
  Lines        43055    42685     -370     
===========================================
  Hits         17646    17646              
+ Misses       25409    25039     -370     
Files Changed Coverage Δ
pypeit/core/wavecal/autoid.py 28.65% <0.00%> (+1.92%) ⬆️
pypeit/core/arc.py 43.84% <50.00%> (ø)

... and 3 files with indirect coverage changes

Copy link
Collaborator

@jhennawi jhennawi left a comment

Choose a reason for hiding this comment

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

Looks good @debora-pe but I'm not following the control flow that well. I've asked @rcooke-ast to also review since I think he was the original author of this code. I think this probably requires that the dev-suite be run, as there could be unforeseen consequences of modifying such a core algorithm when fits to slits start failing and things are masked.

Copy link
Collaborator

@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.

Looks good to me, but with two minor suggestions. Approving for now. I'm sure it's fine, but I'd also encourage a dev-suite run just to be sure.

@@ -1772,11 +1774,10 @@ def run_brute(self, min_nlines=10):

# Now that all slits have been inspected, cross match to generate a
# list of all lines in every slit, and refit all spectra
if self._nslit > 1:
obad_slits = self.cross_match(good_fit, self._det_weak) if self._ok_mask.size > 1 else np.array([])
if obad_slits.size > 1:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be >=? The previous if self._nslit > 1: was checking if this was multislit vs longslit, I think, but this new check is looking explicitly for bad slits.

msgs.info('Checking wavelength solution by cross-correlating with all slits')

msgs.info('Cross-correlation iteration #1')
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are several options here, but I think the two information messages should be put above obad_slits = self.cross_match(...) blah. Alternatively, the second info message could be removed and change cntr=1. Otherwise, there appears to be printout that says iteration 1 and then immediately iteration 2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rcooke-ast thank you so much for your comments. They made me realize that the flow here was not completely correct, so I fixed it. Please take a look if you can.
I'm running the Dev Suite right now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good to me!

@debora-pe
Copy link
Collaborator Author

@jhennawi thank you for reviewing this. I didn't know if you wanted me to modify the pypeit file in the Dev Suite that triggered this problem. I made the change here: pypeit/PypeIt-development-suite#279
Please approve it if you are OK with it.

@debora-pe
Copy link
Collaborator Author

Tests pass, except for a few unit tests failures that are not related to this PR and that PR #1628 (Dev Suite PR #272) has fixed.

Test Summary
--------------------------------------------------------
--- PYTEST PYPEIT UNIT TESTS PASSED  230 passed, 2 skipped, 72 warnings in 311.72s (0:05:11) ---
--- PYTEST UNIT TESTS FAILED  5 failed, 118 passed, 193 warnings in 1446.17s (0:24:06) ---
--- PYTEST VET TESTS PASSED  42 passed, 5 skipped, 31 warnings in 671.68s (0:11:11) ---
--- PYPEIT DEVELOPMENT SUITE PASSED 207/207 TESTS  ---
Testing Started at 2023-08-08T15:35:15.941933
Testing Completed at 2023-08-08T23:54:48.063223
Total Time: 8:19:32.121290

The skipped tests were due to not having specutils installed, so I re run them and all good.
--- PYTEST PYPEIT UNIT TESTS PASSED 232 passed, 72 warnings in 331.40s (0:05:31) ---
--- PYTEST VET TESTS PASSED 47 passed, 31 warnings in 693.48s (0:11:33) ---

@debora-pe
Copy link
Collaborator Author

Merging this

@debora-pe debora-pe merged commit dd9fc7a into develop Aug 10, 2023
25 checks passed
@debora-pe debora-pe deleted the issue1643 branch August 10, 2023 20:46
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.

4 participants