Skip to content

Commit

Permalink
rcal-955 Initial code to change suffix _i2d to _coadd (#1542)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddavis-stsci authored Dec 2, 2024
1 parent fc1a659 commit ec4f412
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 23 deletions.
1 change: 1 addition & 0 deletions 1542.mosaic_pipeline.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change the default suffix for mosaic products from _i2d to _coadd
1 change: 1 addition & 0 deletions changes/1542.mosaic_pipeline.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change the default suffix for mosaic products from _i2d to _coadd
3 changes: 0 additions & 3 deletions romancal/associations/skycell_asn.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def skycell_asn(self):
root_asn_name = self.parsed.output_file_root
product_type = self.parsed.product_type
product_release = self.parsed.release_product
suffix = "coadd"
sep = "_"

product_name_mapping = {
Expand Down Expand Up @@ -92,8 +91,6 @@ def skycell_asn(self):
+ patch_name
+ sep
+ filter_id
+ sep
+ suffix
)

with open(asn_file_name + "_asn.json", "w") as outfile:
Expand Down
2 changes: 1 addition & 1 deletion romancal/outlier_detection/_fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def save_median(example_model, median_data, median_wcs, make_output_path):


def save_drizzled(drizzled_model, make_output_path):
_save_intermediate_output(drizzled_model, "outlier_i2d", make_output_path)
_save_intermediate_output(drizzled_model, "outlier_coadd", make_output_path)


def _make_median_model(example_model, data, wcs):
Expand Down
8 changes: 4 additions & 4 deletions romancal/pipeline/mosaic_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def process(self, input):
if skycell_name in skycell_record["name"]:
# skycell name are in the form of r270dm90x99y99
# example of product name "r0099101001001001001_F158_visit_r270dm90x99y99"
skycell_file_name = product_name + "_i2d.asdf"
skycell_file_name = product_name + "_coadd.asdf"

# check to see if there exists a skycell on disk if not create it
if not isfile(skycell_file_name):
Expand Down Expand Up @@ -129,7 +129,7 @@ def process(self, input):
self.resample.output_shape,
)
wcs_file = asdf.open(self.resample.output_wcs)
self.suffix = "i2d"
self.suffix = "coadd"
self.output_file = input.asn["products"][0]["name"]
result = self.resample.run(result)
self.sourcecatalog.output_file = self.output_file
Expand All @@ -139,12 +139,12 @@ def process(self, input):
exit(0)

else:
self.resample.suffix = "i2d"
self.resample.suffix = "coadd"
self.output_file = input.asn["products"][0]["name"]
result = self.resample.run(result)
self.sourcecatalog.output_file = self.output_file
result_catalog = self.sourcecatalog.run(result) # noqa: F841
self.suffix = "i2d"
self.suffix = "coadd"
if input_filename:
result.meta.filename = self.output_file

Expand Down
4 changes: 2 additions & 2 deletions romancal/regtest/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
@pytest.fixture(
scope="module",
params=[
"r0099101001001001001_r274dp63x31y81_prompt_F158_i2d.asdf",
"r0099101001001001001_F158_visit_i2d.asdf",
"r0099101001001001001_r274dp63x31y81_prompt_F158_coadd.asdf",
"r0099101001001001001_F158_visit_coadd.asdf",
"r0000101001001001001_0001_wfi01_cal.asdf",
],
ids=["L3", "L2", "L3skycell"],
Expand Down
2 changes: 1 addition & 1 deletion romancal/regtest/test_mos_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def run_mos(rtdata_module):
rtdata.get_asn("WFI/image/L3_regtest_asn.json")

# Test Pipeline
output = "r0099101001001001001_F158_visit_i2d.asdf"
output = "r0099101001001001001_F158_visit_coadd.asdf"
rtdata.output = output

args = [
Expand Down
2 changes: 1 addition & 1 deletion romancal/regtest/test_mos_skycell_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def run_mos(rtdata_module):

# Test Pipeline
rtdata.get_asn("WFI/image/L3_mosaic_asn.json")
output = "r0099101001001001001_r274dp63x31y81_prompt_F158_i2d.asdf"
output = "r0099101001001001001_r274dp63x31y81_prompt_F158_coadd.asdf"
rtdata.output = output
args = [
"roman_mos",
Expand Down
4 changes: 2 additions & 2 deletions romancal/resample/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def resample_group(self, input_models, indices):
output_root = "_".join(
example_image.meta.filename.replace(output_type, "").split("_")[:-1]
)
output_model.meta.filename = f"{output_root}_outlier_i2d{output_type}"
output_model.meta.filename = f"{output_root}_outlier_coadd{output_type}"
input_models.shelve(example_image, indices[0], modify=False)
output_model.meta.basic.location_name = self.location_name
del example_image
Expand Down Expand Up @@ -315,7 +315,7 @@ def resample_many_to_many(self):
if not self.in_memory:
# build ModelLibrary as an association from the output files
# this saves memory if there are multiple groups
asn = asn_from_list(output_models, product_name="outlier_i2d")
asn = asn_from_list(output_models, product_name="outlier_coadd")
asn_dict = json.loads(
asn.dump()[1]
) # serializes the asn and converts to dict
Expand Down
18 changes: 9 additions & 9 deletions romancal/scripts/make_regtestdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,23 @@ l3name="r0099101001001001001_F158_visit"
asn_from_list r0000101001001001001_0001_wfi01_cal.asdf r0000101001001001001_0002_wfi01_cal.asdf r0000101001001001001_0003_wfi01_cal.asdf -o L3_regtest_asn.json --product-name $l3name
strun roman_mos L3_regtest_asn.json
cp L3_regtest_asn.json $outdir/roman-pipeline/dev/WFI/image/
cp ${l3name}_i2d.asdf $outdir/roman-pipeline/dev/WFI/image/
cp ${l3name}_i2d.asdf $outdir/roman-pipeline/dev/truth/WFI/image/
cp ${l3name}_coadd.asdf $outdir/roman-pipeline/dev/WFI/image/
cp ${l3name}_coadd.asdf $outdir/roman-pipeline/dev/truth/WFI/image/

# L3 catalog
strun romancal.step.SourceCatalogStep ${l3name}_i2d.asdf
strun romancal.step.SourceCatalogStep ${l3name}_coadd.asdf
cp ${l3name}_cat.asdf $outdir/roman-pipeline/dev/truth/WFI/image/


l3name="r0099101001001001001_r274dp63x31y81_prompt_F158"
asn_from_list r0000101001001001001_0001_wfi01_cal.asdf r0000101001001001001_0002_wfi01_cal.asdf r0000101001001001001_0003_wfi01_cal.asdf -o L3_mosaic_asn.json --product-name $l3name --target r274dp63x31y81
strun roman_mos L3_mosaic_asn.json
cp L3_mosaic_asn.json $outdir/roman-pipeline/dev/WFI/image/
cp ${l3name}_i2d.asdf $outdir/roman-pipeline/dev/WFI/image/
cp ${l3name}_i2d.asdf $outdir/roman-pipeline/dev/truth/WFI/image/
cp ${l3name}_coadd.asdf $outdir/roman-pipeline/dev/WFI/image/
cp ${l3name}_coadd.asdf $outdir/roman-pipeline/dev/truth/WFI/image/

# L3 catalog
strun romancal.step.SourceCatalogStep ${l3name}_i2d.asdf
strun romancal.step.SourceCatalogStep ${l3name}_coadd.asdf
cp ${l3name}_cat.asdf $outdir/roman-pipeline/dev/truth/WFI/image/

# L2 catalog
Expand All @@ -210,14 +210,14 @@ cp r0000101001001001001_0001_wfi01_cat.asdf $outdir/roman-pipeline/dev/truth/WFI
l3name="r0099101001001001001_r274dp63x31y81_prompt_F158"
asn_from_list --product-name=$l3name r0000101001001001001_0001_wfi01_cal.asdf r0000101001001001001_0002_wfi01_cal.asdf r0000101001001001001_0003_wfi01_cal.asdf -o L3_m1_asn.json
strun roman_mos L3_m1_asn.json
cp ${l3name}_i2d.asdf $outdir/roman-pipeline/dev/truth/WFI/image/
cp ${l3name}_coadd.asdf $outdir/roman-pipeline/dev/truth/WFI/image/

# L3 skycell catalog
strun romancal.step.SourceCatalogStep ${l3name}_i2d.asdf
strun romancal.step.SourceCatalogStep ${l3name}_coadd.asdf
cp ${l3name}_cat.asdf $outdir/roman-pipeline/dev/truth/WFI/image/

# multiband catalog
asn_from_list --product-name=${l3name}_mbcat ${l3name}_i2d.asdf -o L3_skycell_mbcat_asn.json
asn_from_list --product-name=${l3name}_mbcat ${l3name}_coadd.asdf -o L3_skycell_mbcat_asn.json
strun romancal.step.MultibandCatalogStep L3_skycell_mbcat_asn.json --deblend True

# tests passing suffix to the pipeline
Expand Down

0 comments on commit ec4f412

Please sign in to comment.