Skip to content

Commit

Permalink
add regtest that runs one of the skycell_asn outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Jan 30, 2025
1 parent 054a961 commit ba7fe03
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions romancal/regtest/test_skycell_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import os

import pytest
import roman_datamodels.datamodels as rdm

from romancal.associations import skycell_asn
from romancal.pipeline.mosaic_pipeline import MosaicPipeline

# mark all tests in this module
pytestmark = [pytest.mark.bigdata]
Expand Down Expand Up @@ -38,6 +40,24 @@ def run_skycell_asn(rtdata_module):
return rtdata


@pytest.fixture(scope="module")
def mosaic_pipeline_on_skycell_asn(run_skycell_asn):
rtdata = run_skycell_asn
rtdata.input = EXPECTED_FILENAMES[0]
rtdata.output = f"{rtdata.input.rsplit('_', maxsplit=1)[0]}_coadd.asdf"

# just run the first association (not all)
args = [
"roman_mos",
rtdata.input,
]

# we don't setup or fetch a truth file here as the aim of this
# test is to check the output is resampled onto a skycell
MosaicPipeline.from_cmdline(args)
return rtdata


@pytest.mark.parametrize("expected_filename", EXPECTED_FILENAMES)
def test_file_exists(run_skycell_asn, expected_filename):
"""Test that the expected json files were generated"""
Expand All @@ -49,3 +69,11 @@ def test_files_contain_wcsinfo(run_skycell_asn, expected_filename):
with open(expected_filename) as f:
asn = json.load(f)
assert "skycell_wcs_info" in asn


def test_mosaic_output_is_skycell(mosaic_pipeline_on_skycell_asn):
"""Check that the mos output for the generated association is on a skycell"""
rtdata = mosaic_pipeline_on_skycell_asn
filename = rtdata.output
with rdm.open(filename) as model:
assert model.meta.basic.location_name == "r274dp63x31y80"

0 comments on commit ba7fe03

Please sign in to comment.