diff --git a/changes/1448.outlier_detection.1.rst b/changes/1448.outlier_detection.1.rst new file mode 100644 index 000000000..2080601d1 --- /dev/null +++ b/changes/1448.outlier_detection.1.rst @@ -0,0 +1 @@ +Group by obs_id diff --git a/changes/1448.resample.2.rst b/changes/1448.resample.2.rst new file mode 100644 index 000000000..2080601d1 --- /dev/null +++ b/changes/1448.resample.2.rst @@ -0,0 +1 @@ +Group by obs_id diff --git a/changes/1448.tweakreg.0.rst b/changes/1448.tweakreg.0.rst new file mode 100644 index 000000000..2080601d1 --- /dev/null +++ b/changes/1448.tweakreg.0.rst @@ -0,0 +1 @@ +Group by obs_id diff --git a/romancal/datamodels/library.py b/romancal/datamodels/library.py index 7ca65551a..fa72195d7 100644 --- a/romancal/datamodels/library.py +++ b/romancal/datamodels/library.py @@ -75,8 +75,4 @@ def _mapping_to_group_id(mapping): """ Combine a number of file metadata values into a ``group_id`` string """ - return ( - "roman{program}{observation}{visit}" - "_{visit_file_group}{visit_file_sequence}{visit_file_activity}" - "_{exposure}" - ).format_map(mapping) + return "{obs_id}".format_map(mapping) diff --git a/romancal/outlier_detection/tests/test_outlier_detection.py b/romancal/outlier_detection/tests/test_outlier_detection.py index 4f8ecf68a..ac9fbbb33 100644 --- a/romancal/outlier_detection/tests/test_outlier_detection.py +++ b/romancal/outlier_detection/tests/test_outlier_detection.py @@ -142,7 +142,7 @@ def test_find_outliers(tmp_path, base_image, on_disk): img.data[42, 72] = source_value img.err[:] = err_value img.meta.filename = str(tmp_path / f"img{i}_suffix.asdf") - img.meta.observation.exposure = i + img.meta.observation.obs_id = str(i) img.meta.background.level = 0 imgs.append(img) diff --git a/romancal/resample/tests/test_resample.py b/romancal/resample/tests/test_resample.py index b20579f08..93d550485 100644 --- a/romancal/resample/tests/test_resample.py +++ b/romancal/resample/tests/test_resample.py @@ -253,6 +253,7 @@ def exposure_1(wfi_sca1, wfi_sca2, wfi_sca3): "2020-02-01T00:02:30", format="isot", scale="utc" ) sca.meta.observation["exposure"] = 1 + sca.meta.observation["obs_id"] = "1" return [wfi_sca1, wfi_sca2, wfi_sca3] @@ -268,6 +269,7 @@ def exposure_2(wfi_sca4, wfi_sca5, wfi_sca6): "2020-05-01T00:02:30", format="isot", scale="utc" ) sca.meta.observation["exposure"] = 2 + sca.meta.observation["obs_id"] = "2" return [wfi_sca4, wfi_sca5, wfi_sca6] diff --git a/romancal/tweakreg/tests/test_tweakreg.py b/romancal/tweakreg/tests/test_tweakreg.py index 63dad8e5a..b8434bccc 100644 --- a/romancal/tweakreg/tests/test_tweakreg.py +++ b/romancal/tweakreg/tests/test_tweakreg.py @@ -908,7 +908,9 @@ def test_tweakreg_handles_multiple_groups(tmp_path, base_image): add_tweakreg_catalog_attribute(tmp_path, img2, catalog_filename="img2") img1.meta.observation["program"] = "-program_id1" + img1.meta.observation["obs_id"] = "1" img2.meta.observation["program"] = "-program_id2" + img2.meta.observation["obs_id"] = "2" img1.meta["filename"] = "file1.asdf" img2.meta["filename"] = "file2.asdf" @@ -918,10 +920,7 @@ def test_tweakreg_handles_multiple_groups(tmp_path, base_image): assert len(res.group_names) == 2 with res: for r, i in zip(res, [img1, img2]): - assert ( - r.meta.group_id.split("-")[1] - == i.meta.observation.program.split("-")[1] - ) + assert r.meta.group_id == i.meta.observation.obs_id res.shelve(r, modify=False)