-
Notifications
You must be signed in to change notification settings - Fork 23
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
New routine: ocrreject_exam() #169
base: master
Are you sure you want to change the base?
Conversation
@m-dallas - |
@m-dallas - |
Assuming your fork is called "origin", you can add the original spacetelescope repo as "upstream". Check your remotes first: git remote -vv Make the changes: git remote add upstream [email protected]:spacetelescope/stistools.git
git fetch upstream
git rebase upstream/master Then you should be able to overwrite your local branch: git push --force origin md_ocrreject_exam |
6b39da6
to
7260942
Compare
Tested on plhstins4 and passed using python 3.13.1 with 2 warnings:
|
Did you intend for the resulting scalars to be of type
|
Manual checks of the logic to use |
We should probably make an explicit check for the relevant CCD mode to avoid help calls. I imagine users might run it on their whole visits. For instance, I (intentionally) ran your code on first-order MAMA data and got a cryptic error message:
I would check the following keywords:
And do this in a try/except so that a with fits.open(flt_file) as flt_hdul:
try:
instrument = flt_hdul[0].header['INSTRUME']
detector = flt_hdul[0].header['DETECTOR']
obsmode = flt_hdul[0].header['OBSMODE']
nextend = flt_hdul[0].header['NEXTEND']
if (instrument.strip() != 'STIS') or \
(detector.strip() != 'CCD') or \
(obsmode.strip() != 'ACCUM') or \
(nextend < 6):
raise ValueError
except (KeyError, ValueError,):
raise ValueError(f"{flt_file}: Not a STIS/CCD/ACCUM file with ≥2 SCI extensions.")
# Your code...
propid = flt_hdul[0].header['PROPOSID'] |
That wasn't intentional, just the default behavior of dividing an np.sum: I changed the relevant lines to: for consistency |
Good point, I implemented your fix and it works as expected on the MAMA exposure in a list I gave it:
|
Checks STIS CCD 1D spectroscpopic data for cosmic ray overflagging. Behaves differently if plotly is installed.
stistools.ocrreject_exam.ocrreject_exam("odvkl1040", plot=True)