Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update resample test to use new files. #1009

Merged
merged 7 commits into from
Nov 17, 2023
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