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

GMOS SOUTH CCD upgrade and some other fixes #1798

Merged
merged 5 commits into from
Apr 18, 2024
Merged

Conversation

debora-pe
Copy link
Collaborator

As titled

@codecov-commenter
Copy link

codecov-commenter commented Apr 12, 2024

Codecov Report

Attention: Patch coverage is 20.93023% with 34 lines in your changes are missing coverage. Please review.

Project coverage is 39.05%. Comparing base (4c11a19) to head (f131b07).
Report is 25 commits behind head on develop.

Files Patch % Lines
pypeit/spectrographs/gemini_gmos.py 19.04% 34 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1798      +/-   ##
===========================================
- Coverage    39.07%   39.05%   -0.02%     
===========================================
  Files          204      204              
  Lines        47012    47046      +34     
===========================================
+ Hits         18370    18375       +5     
- Misses       28642    28671      +29     

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

if obsepoch is not None:
return time.Time(obsepoch, format='jyear').mjd
else:
return None

Choose a reason for hiding this comment

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

you should update the docstring as well, because you are return None instead of a Metadata value read from the header(s)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed. I also wonder if it might be worthwhile throwing an error, or, throw a warning and then assume that the observations have ben taken since "2023-12-14".

Copy link
Collaborator

Choose a reason for hiding this comment

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

We likely do not want it to throw an error because this would cause pypeit_setup to fault, which we want to avoid. Throwing a warning makes sense, and we can add that the return can be None.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed, and I agree, but returning None could cause an error on line 846 (and several other places in this file where a possible None value is not checked)... I think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, yes, you're right. @debora-pe , you'll need to catch the case @rcooke-ast pointed out. There are other places in the code that can catch a None mjd (e.g., starting at line 255 in metadata.py), but maybe not everywhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I decided to use a dummy mjd (using today as date) and throwing a warning. What do you think?

@debora-pe
Copy link
Collaborator Author

Tests pass. The failures are unrelated and waiting for another PR to clear.

Test Summary
--------------------------------------------------------
--- PYTEST PYPEIT UNIT TESTS PASSED  249 passed, 64 warnings in 343.40s (0:05:43) ---
--- PYTEST UNIT TESTS FAILED  3 failed, 131 passed, 168 warnings in 1679.39s (0:27:59) ---
--- PYTEST VET TESTS PASSED  61 passed, 97 warnings in 5166.77s (1:26:06) ---
--- PYPEIT DEVELOPMENT SUITE FAILED 1/237 TESTS  ---
Failed tests:
    keck_nirspec/LOW_NIRSPEC-1 pypeit
Skipped tests:
Testing Started at 2024-04-12T17:55:53.048547
Testing Completed at 2024-04-13T07:12:08.495308
Total Time: 13:16:15.446761

@jhod0
Copy link
Contributor

jhod0 commented Apr 16, 2024

I have been able to successfully run this version of PypeIt on GMOS-South data taken in January!

The resulting spectra seem to be perfectly reasonable, here is a red galaxy targeted by our observations.

Thank you Debora!

Uploading image.png…

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.

Just minor comments from me. I'd encourage you to add some recent data to the dev-suite (and I presume there are old data just prior to the detector upgrade already in the dev suite)? Just to make sure that no bugs have crept in for either change.

)

# account for the CCD upgrade happened on 2023-12-14
if hdu is not None:
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 perhaps be defined before the detector dictionaries? (i.e. define parameters gain1, gain2, etc...). I think it's fine to update, but might be cleaner if we set variables near the top of this function and use those variables in the dictionary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do actually prefer to leave it like this. Other spectrographs have the same flow. Also, the code below is only run if hdu is provided, which would make the code full of if...else if I define the parameters before the dictionary.

if hdu is not None:
# date upgrade
t_upgrade = time.Time("2023-12-14", format='isot')
obs_date = time.Time(self.get_meta_value(self.get_headarr(hdu), 'mjd'), format='mjd')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be None sometimes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See my comment above

if obsepoch is not None:
return time.Time(obsepoch, format='jyear').mjd
else:
return None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed. I also wonder if it might be worthwhile throwing an error, or, throw a warning and then assume that the observations have ben taken since "2023-12-14".

@@ -85,15 +85,15 @@ def by_fitstbl_input(cls, frame: str, inp: str, spectrograph):
m_es = inp.split(';')
for m_e in m_es:
parse = m_e.split(':')
# det_strip will be a list of a single number (no mosaic) or 2 numbers (mosaic)
# det_strip will be a list of a single number (no mosaic) or >= 2 numbers (mosaic)

Choose a reason for hiding this comment

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

If len(det_strip) == 1 the it is not a mosaic, otherwise it is

Just for the comment. In this way it is explicit

Copy link
Collaborator

@kbwestfall kbwestfall 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. My main reason for clicking "request changes" is the detid issue. All of the other comments are minor.

pypeit/spectrographs/gemini_gmos.py Show resolved Hide resolved
if obsepoch is not None:
return time.Time(obsepoch, format='jyear').mjd
else:
return None
Copy link
Collaborator

Choose a reason for hiding this comment

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

We likely do not want it to throw an error because this would cause pypeit_setup to fault, which we want to avoid. Throwing a warning makes sense, and we can add that the return can be None.

pypeit/spectrographs/gemini_gmos.py Outdated Show resolved Hide resolved
pypeit/spectrographs/gemini_gmos.py Outdated Show resolved Hide resolved
pypeit/spectrographs/gemini_gmos.py Outdated Show resolved Hide resolved
pypeit/spectrographs/gemini_gmos.py Show resolved Hide resolved
@debora-pe
Copy link
Collaborator Author

@rcooke-ast I agree that it would be good to have data in the Dev Suite, but the CCD update is so knew that there are no available public data. A PypeIt user gave me a couple of frame (no science), but that's everything I have.
And yes, we do have older data in the Dev Suite.

@debora-pe
Copy link
Collaborator Author

Tests still good. Except the unrelated failures.

Test Summary
--------------------------------------------------------
--- PYTEST PYPEIT UNIT TESTS PASSED  249 passed, 64 warnings in 346.13s (0:05:46) ---
--- PYTEST UNIT TESTS FAILED  3 failed, 131 passed, 168 warnings in 1660.01s (0:27:40) ---
--- PYTEST VET TESTS PASSED  61 passed, 98 warnings in 5207.49s (1:26:47) ---
--- PYPEIT DEVELOPMENT SUITE FAILED 1/237 TESTS  ---
Failed tests:
    keck_nirspec/LOW_NIRSPEC-1 pypeit
Skipped tests:
Testing Started at 2024-04-17T19:09:40.292404
Testing Completed at 2024-04-18T08:17:22.885371
Total Time: 13:07:42.592967

@debora-pe
Copy link
Collaborator Author

Merging this now.

@debora-pe debora-pe merged commit 235a571 into develop Apr 18, 2024
23 checks passed
@debora-pe debora-pe deleted the gmoss_ccdupdate branch April 18, 2024 22:52
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.

6 participants