-
Notifications
You must be signed in to change notification settings - Fork 104
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
Adding support for the (decommissioned) spectrograph: AAT/UHRF #1834
Conversation
# Conflicts: # doc/releases/1.15.1dev.rst
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 #1834 +/- ##
===========================================
+ Coverage 38.01% 38.03% +0.01%
===========================================
Files 210 211 +1
Lines 48850 48975 +125
===========================================
+ Hits 18569 18626 +57
- Misses 30281 30349 +68 ☔ 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.
All good on my end. I hear @kbwestfall will have one fix
to suggest/add.
pypeit/pypeitsetup.py
Outdated
@@ -186,7 +186,20 @@ def from_file_root(cls, root, spectrograph, extension='.fits'): | |||
Returns: | |||
:class:`PypeitSetup`: The instance of the class. | |||
""" | |||
return cls.from_rawfiles(io.files_from_extension(root, extension=extension), spectrograph) | |||
spec = load_spectrograph(spectrograph) |
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 hear that @kbwestfall has some issues/fixes for this
# Conflicts: # doc/releases/1.16.1dev.rst
Refactor file discovery
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.
There are a couple of somewhat buried changes that I was hoping you could comment on. I merged in release
and develop
. Can we re-run tests?
pypeit/core/arc.py
Outdated
maxi = min(nmask[0], ww.size) | ||
outbpm[pks[i]:ww[maxi]+2] = True | ||
# Return the output bpm | ||
return outbpm |
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 would be great to have a test for this, but I'm fine with you punting on that for this 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.
Good point - I've added one in.
pypeit/core/findobj_skymask.py
Outdated
flux_smash_mean, flux_smash_med, flux_smash_std = astropy.stats.sigma_clipped_stats( | ||
flux_smash, mask=np.logical_not(gpm_smash), sigma_lower=3.0, sigma_upper=3.0 | ||
) | ||
flux_smash, mask=smash_mask, sigma_lower=3.0, sigma_upper=3.0) |
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 haven't dug into the context of this change, but it feels important. Can you give us more information about the problem that you've addressed with this code? And, do you have any assessments of how this affects all the other instruments?
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.
To be honest, I developed this many months ago, and I can't remember the motivation, or why it wasn't working in the first place. The code is basically finding peaks and masking around them, provided that pixel values continuously decrease away from the peak pixel. There needs to be a continuous decrease of 5+ pixels in order to activate this feature. I suspect this is only important when object profiles are excessively broad (which is what I was dealing with at the time).
Given that I can't recall what the motivation was, I am happy to revert this.
@@ -860,7 +860,7 @@ def get_detector_par(self, det, hdu=None): | |||
# Some properties of the image | |||
binning = self.compound_meta(self.get_headarr(hdu), "binning") | |||
numamps = hdu[0].header['NVIDINP'] | |||
specflip = True if hdu[0].header['AMPID1'] == 2 else False | |||
specflip = False if hdu[0].header['AMPMODE'] == 'ALL' else True |
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 would comment on this in the change log. Is this a general change for all KCWI taken, or does it reflect a change in header that needs an associated date if..else
check?
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 was finding a problem with one of the datasets I have. This is effectively the same thing, but it depends which 2 amplifiers are used. This is more conservative. I have added this to the change log.
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.
Comments addressed @kbwestfall - thanks! I'll run tests
pypeit/core/arc.py
Outdated
maxi = min(nmask[0], ww.size) | ||
outbpm[pks[i]:ww[maxi]+2] = True | ||
# Return the output bpm | ||
return outbpm |
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.
Good point - I've added one in.
@@ -860,7 +860,7 @@ def get_detector_par(self, det, hdu=None): | |||
# Some properties of the image | |||
binning = self.compound_meta(self.get_headarr(hdu), "binning") | |||
numamps = hdu[0].header['NVIDINP'] | |||
specflip = True if hdu[0].header['AMPID1'] == 2 else False | |||
specflip = False if hdu[0].header['AMPMODE'] == 'ALL' else True |
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 was finding a problem with one of the datasets I have. This is effectively the same thing, but it depends which 2 amplifiers are used. This is more conservative. I have added this to the change log.
pypeit/core/findobj_skymask.py
Outdated
flux_smash_mean, flux_smash_med, flux_smash_std = astropy.stats.sigma_clipped_stats( | ||
flux_smash, mask=np.logical_not(gpm_smash), sigma_lower=3.0, sigma_upper=3.0 | ||
) | ||
flux_smash, mask=smash_mask, sigma_lower=3.0, sigma_upper=3.0) |
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.
To be honest, I developed this many months ago, and I can't remember the motivation, or why it wasn't working in the first place. The code is basically finding peaks and masking around them, provided that pixel values continuously decrease away from the peak pixel. There needs to be a continuous decrease of 5+ pixels in order to activate this feature. I suspect this is only important when object profiles are excessively broad (which is what I was dealing with at the time).
Given that I can't recall what the motivation was, I am happy to revert this.
# Conflicts: # doc/releases/1.16.1dev.rst
# Conflicts: # doc/releases/1.16.1dev.rst
There is an accompanying dev-suite PR. I will also add some documentation about this spectrograph. Tests currently pass.