-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RCAL-707 Update elp to replace list as input to tweakreg (#985)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e62468b
commit 5cc07ee
Showing
4 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/usr/bin/env python | ||
import logging | ||
from os.path import basename | ||
|
||
import romancal.datamodels.filetype as filetype | ||
from romancal.datamodels import ModelContainer | ||
from romancal.outlier_detection import OutlierDetectionStep | ||
from romancal.resample import ResampleStep | ||
|
||
# step imports | ||
from romancal.skymatch import SkyMatchStep | ||
|
||
from ..stpipe import RomanPipeline | ||
|
||
__all__ = ["HighLevelPipeline"] | ||
|
||
# Define logging | ||
log = logging.getLogger() | ||
log.setLevel(logging.DEBUG) | ||
|
||
|
||
class HighLevelPipeline(RomanPipeline): | ||
""" | ||
HighLevelPipeline: Apply all calibration steps to the roman data | ||
to produce level 3 products. Included steps are: | ||
skymatch, Outlierdetectionn and resample. | ||
""" | ||
|
||
class_alias = "roman_hlp" | ||
|
||
spec = """ | ||
save_results = boolean(default=False) | ||
""" | ||
|
||
# Define aliases to steps | ||
step_defs = { | ||
"skymatch": SkyMatchStep, | ||
"outlierdet": OutlierDetectionStep, | ||
"resample": ResampleStep, | ||
} | ||
|
||
# start the actual processing | ||
def process(self, input): | ||
"""Process the Roman WFI data from Level 2 to Level 3""" | ||
|
||
log.info("Starting Roman high level calibration pipeline ...") | ||
if isinstance(input, str): | ||
input_filename = basename(input) | ||
else: | ||
input_filename = None | ||
|
||
# open the input file | ||
file_type = filetype.check(input) | ||
asn = None | ||
if file_type == "asdf": | ||
log.info("The level three pipeline input needs to be an association") | ||
return | ||
|
||
if file_type == "asn": | ||
asn = ModelContainer.read_asn(input) | ||
self.skymatch.suffix = "skymatch" | ||
result = self.skymatch(input) | ||
self.skymatch.suffix = "outlierdetection" | ||
result = self.outlierdetection(asn) | ||
self.skymatch.suffix = "i2d" | ||
result = self.resample(result) | ||
if input_filename: | ||
result.meta.filename = input_filename | ||
|
||
return result | ||
|
||
def setup_output(self, input): | ||
"""Determine the proper file name suffix to use later""" | ||
if input.meta.cal_step.ramp_fit == "COMPLETE": | ||
self.suffix = "cal" | ||
input.meta.filename = input.meta.filename.replace("uncal", self.suffix) | ||
input["output_file"] = input.meta.filename | ||
self.output_file = input.meta.filename | ||
else: | ||
self.suffix = "cal" |