-
Notifications
You must be signed in to change notification settings - Fork 169
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
JP-3682: split outlier detection into separate steps for each mode #8722
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8722 +/- ##
==========================================
- Coverage 76.92% 76.91% -0.01%
==========================================
Files 498 498
Lines 45810 45830 +20
==========================================
+ Hits 35240 35252 +12
- Misses 10570 10578 +8
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. |
regression tests started here https://github.com/spacetelescope/RegressionTests/actions/runs/12697929952 |
@tapastro @melanieclarke let me know what I can do to get the parameter reference files changed over. |
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.
Thanks for taking this on. The code changes look good to me. I left a few comments about suffixes and docs (I didn't finish looking over all the docs changes). The refactoring looks much cleaner.
For the reference files perhaps @stscieisenhamer has some suggestions on how to handle the transition from a single pars-outlierdetectionstep
reftype to the multiple pars-outlierdetectionifustep
etc pars files. To propose a plan maybe we define the new reftypes on crds, start using them with this PR and leave the existing pars-outlierdetectionstep
reftype up (so previous cal versions can still use the context) for some period of time (it looks like the unused drizpars
is still in the current context).
Related to the transition, I think this refactoring warrants a migration guide in the docs. Something that describes to a user that if they previously used strun outlierdetection
they now need to do ...
. Is that in the updated docs (and I missed it)?
jwst/pipeline/calwebb_spec3.py
Outdated
@@ -85,8 +86,10 @@ def process(self, input): | |||
# Setup sub-step defaults | |||
self.master_background.suffix = 'mbsub' | |||
self.mrs_imatch.suffix = 'mrs_imatch' | |||
self.outlier_detection.suffix = 'crf' | |||
self.outlier_detection.save_results = self.save_results | |||
self.outlier_detection_spec.suffix = 'crf' |
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.
Is the suffix now one-to-one for the split steps (eg outlier_detection_spec
always uses crf
)? If so I suggest we define them in the class instead of assigning in the pipeline.
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.
yes it's now 1:1, will define them in the spec of each step
jwst/outlier_detection/utils.py
Outdated
"""Minimal base class holding common methods for outlier detection steps.""" | ||
|
||
@abstractmethod | ||
def search_attr(self, attr, **kwargs): |
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.
What required defining this method?
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 catch. These were carried over from the draft of this PR several months ago. They no longer appear to be necessary, if they ever were necessary in the first place.
jwst/outlier_detection/utils.py
Outdated
pass | ||
|
||
@abstractmethod | ||
def _make_output_path(self): |
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.
What required defining this method?
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.
same as above
class OutlierDetectionTSOStep(Step, OutlierDetectionStepBase): | ||
"""Flag outlier bad pixels and cosmic rays in DQ array of each input image. | ||
Input images can be listed in an input association file or already opened | ||
with a ModelContainer. DQ arrays are modified in place. |
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.
Is ModelContainer supported?
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.
no, I will update the docstring
I'm working through regtest failures now, most of which are due to the need to change e.g. |
step = OutlierDetectionCoronStep() | ||
step.call(input.fits, save_intermediate_results=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.
step = OutlierDetectionCoronStep() | |
step.call(input.fits, save_intermediate_results=True) | |
OutlierDetectionCoronStep.call(input.fits, save_intermediate_results=True) |
call
is a class method.
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.
yep, my bad, will fix
from jwst.pipeline import calwebb_image3 | ||
calwebb_image3(input.fits, steps={'outlier_detection_coron': {'save_intermediate_results': 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.
from jwst.pipeline import calwebb_image3 | |
calwebb_image3(input.fits, steps={'outlier_detection_coron': {'save_intermediate_results': True}}) | |
from jwst.pipeline import Image3Pipeline | |
Image3Pipeline.call(input.fits, steps={'outlier_detection_coron': {'save_intermediate_results': True}}) |
|
||
Parameters | ||
----------- | ||
input_data : asn file or ~jwst.datamodels.ModelContainer |
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.
Should this be input_models
?
with a ModelContainer. DQ arrays are modified in place. | ||
Parameters | ||
----------- | ||
input_data : ~jwst.datamodels.ModelContainer or str |
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.
Should this be input_models
?
See `OutlierDetectionStep.spec` for documentation of these arguments. | ||
Parameters | ||
----------- | ||
input_data : ~jwst.datamodels.CubeModel or str |
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.
Should this be input_model
?
"""Minimal base class holding common methods for outlier detection steps.""" | ||
|
||
def _get_asn_id(self, input_models): | ||
"""Find association ID for any allowed input model type, |
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.
Docstring missing "Parameter" section describing the input parameter.
jwst/outlier_detection/utils.py
Outdated
return | ||
|
||
def _set_status(self, input_models, status): | ||
"""Record step exit status, handling both filenames and open models.""" |
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.
Docstring missing "Parameters" section describing the input parameters.
Resolves JP-3682
Closes #8634
This PR addresses splitting outlier detection into separate steps for coronagraphy, IFU, imaging, spectroscopy, and TSO data. This was motivated by large differences in input parameters and algorithms that are implemented for each mode.
Tasks
Build 11.3
(use the latest build if not sure)no-changelog-entry-needed
)changes/
:echo "changed something" > changes/<PR#>.<changetype>.rst
(see below for change types)docs/
pageokify_regtests
to update the truth files