Skip to content

Commit

Permalink
Update resample test to use new files. (spacetelescope#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
schlafly authored Nov 17, 2023
2 parents 53a8c7c + 7e33b40 commit 79586ea
Showing 1 changed file with 7 additions and 43 deletions.
50 changes: 7 additions & 43 deletions romancal/regtest/test_resample.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import json
from io import StringIO

import numpy as np
import pytest
from metrics_logger.decorators import metrics_logger
Expand All @@ -12,54 +9,21 @@
from .regtestdata import compare_asdf


def create_asn_file(
output_filename: str = "resample_output.asdf",
members_filename_list: list = None,
):
asn_dict = {
"asn_type": "None",
"asn_rule": "DMS_ELPP_Base",
"version_id": "null",
"code_version": "0.9.1.dev28+ge987cc9.d20230106",
"degraded_status": "No known degraded exposures in association.",
"program": "noprogram",
"constraints": "No constraints",
"asn_id": "a3001",
"target": "none",
"asn_pool": "test_pool_name",
"products": [
{
"name": output_filename,
"members": [
{"expname": x, "exptype": "science"} for x in members_filename_list
],
}
],
}
asn_content = json.dumps(asn_dict)
asn_file_path = "sample_asn.json"
asn_file = StringIO()
asn_file.write(asn_content)
with open(asn_file_path, mode="w") as f:
print(asn_file.getvalue(), file=f)

return asn_file_path


@metrics_logger("DMS342", "DMS343", "DMS344", "DMS345")
@pytest.mark.bigdata
def test_resample_single_file(rtdata, ignore_asdf_paths):
input_data = [
"r0000501001001001001_01101_0001_WFI02_cal_proc_resample.asdf",
"r0000501001001001001_01101_0002_WFI02_cal_proc_resample.asdf",
"r0000101001001001001_01101_0001_WFI01_cal.asdf",
"r0000101001001001001_01101_0002_WFI01_cal.asdf",
]
output_data = "resample_output_resamplestep.asdf"
truth_data = "resample_truth_resamplestep.asdf"
output_data = "mosaic_resamplestep.asdf"

[rtdata.get_data(f"WFI/image/{data}") for data in input_data]
rtdata.get_truth(f"truth/WFI/image/{truth_data}")
asnfn = "mosaic_asn.json"
rtdata.get_data(f"WFI/image/{asnfn}")
rtdata.get_truth(f"truth/WFI/image/{output_data}")

rtdata.input = create_asn_file(members_filename_list=input_data)
rtdata.input = asnfn
rtdata.output = output_data

# instantiate ResampleStep (for running and log access)
Expand Down

0 comments on commit 79586ea

Please sign in to comment.