Skip to content

Commit

Permalink
Merge branch 'main' into RCAL-895-update-source-catalog-results-with-…
Browse files Browse the repository at this point in the history
…tweaked-astrometry
  • Loading branch information
mairanteodoro committed Aug 23, 2024
2 parents 938f7f6 + c314057 commit 8c58714
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ exposure_pipeline
-----------------
- Update source catalog file with tweaked coordinates. [#1373]

pipeline
--------
- Added ``suffix`` to the spec of ExposurePipeline with a
default value of ``cal``. Removed explicit setting of ``suffix``
so that it can be passed as an argument to ``strun``. [#1378]

0.16.1 (2024-08-13)
===================
Expand Down
13 changes: 1 addition & 12 deletions romancal/pipeline/exposure_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ExposurePipeline(RomanPipeline):
spec = """
save_calibrated_ramp = boolean(default=False)
save_results = boolean(default=False)
suffix = string(default="cal")
"""

# Define aliases to steps
Expand Down Expand Up @@ -151,8 +152,6 @@ def process(self, input):
]:
result.meta.cal_step[step_str] = "SKIPPED"

# Set suffix for proper output naming
self.suffix = "cal"
results.append(result)
return results

Expand All @@ -179,9 +178,6 @@ def process(self, input):
result.meta.cal_step.photom = "SKIPPED"
result.meta.cal_step.source_detection = "SKIPPED"
result.meta.cal_step.tweakreg = "SKIPPED"
self.suffix = "cal"

self.setup_output(result)

self.output_use_model = True
results.append(result)
Expand All @@ -195,10 +191,6 @@ def process(self, input):

return results

def setup_output(self, input):
"""Determine the proper file name suffix to use later"""
self.suffix = "cal"

def create_fully_saturated_zeroed_image(self, input_model):
"""
Create zeroed-out image file
Expand Down Expand Up @@ -228,8 +220,5 @@ def create_fully_saturated_zeroed_image(self, input_model):
]:
fully_saturated_model.meta.cal_step[step_str] = "SKIPPED"

# Set suffix for proper output naming
self.suffix = "cal"

# Return zeroed-out image file
return fully_saturated_model
50 changes: 49 additions & 1 deletion romancal/regtest/test_wfi_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,11 @@ def test_elp_input_dm(rtdata, ignore_asdf_paths):

@pytest.mark.bigdata
def test_processing_pipeline_all_saturated(rtdata, ignore_asdf_paths):
"""Tests for fully saturated data skipping steps in the pipeline"""
"""Tests for fully saturated data skipping steps in the pipeline
Note that this test mimics how the pipeline is run in OPS.
Any changes to this test should be coordinated with OPS.
"""
input_data = "r0000101001001001001_01101_0001_WFI01_ALL_SATURATED_uncal.asdf"
rtdata.get_data(f"WFI/image/{input_data}")
rtdata.input = input_data
Expand Down Expand Up @@ -547,3 +551,47 @@ def test_processing_pipeline_all_saturated(rtdata, ignore_asdf_paths):
assert model.meta.cal_step.assign_wcs == "SKIPPED"
assert model.meta.cal_step.flat_field == "SKIPPED"
assert model.meta.cal_step.photom == "SKIPPED"


@pytest.mark.bigdata
def test_pipeline_suffix(rtdata, ignore_asdf_paths):
"""
Tests passing suffix to the pipeline
Note that this test mimics how the pipeline is run in OPS.
Any changes to this test should be coordinated with OPS.
"""
input_data = "r0000101001001001001_01101_0001_WFI01_uncal.asdf"
rtdata.get_data(f"WFI/image/{input_data}")

output = "r0000101001001001001_01101_0001_WFI01_star.asdf"
rtdata.output = output

args = [
"roman_elp",
rtdata.input,
"--steps.tweakreg.skip=True",
"--suffix=star",
]
ExposurePipeline.from_cmdline(args)
rtdata.get_truth(f"truth/WFI/image/{output}")

diff = compare_asdf(rtdata.output, rtdata.truth, **ignore_asdf_paths)
assert diff.identical, diff.report()

# Ensure step completion is as expected
model = rdm.open(rtdata.output)

assert model.meta.cal_step.dq_init == "COMPLETE"
assert model.meta.cal_step.saturation == "COMPLETE"
assert model.meta.cal_step.linearity == "COMPLETE"
assert model.meta.cal_step.dark == "COMPLETE"
assert model.meta.cal_step.jump == "COMPLETE"
assert model.meta.cal_step.ramp_fit == "COMPLETE"
assert model.meta.cal_step.assign_wcs == "COMPLETE"
assert model.meta.cal_step.flat_field == "COMPLETE"
assert model.meta.cal_step.photom == "COMPLETE"
assert model.meta.cal_step.source_detection == "COMPLETE"
assert model.meta.cal_step.tweakreg == "INCOMPLETE"
assert model.meta.filename == output

0 comments on commit 8c58714

Please sign in to comment.