-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from oirlab/port_merge_subarrays_step2
Refactored merge_subarrays_step
- Loading branch information
Showing
4 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
test: | ||
pytest -v liger_iris_pipeline/tests/test_datamodels.py liger_iris_pipeline/tests/test_dark.py liger_iris_pipeline/tests/test_rop.py liger_iris_pipeline/tests/test_utils.py liger_iris_pipeline/tests/test_normalize.py liger_iris_pipeline/tests/test_assign_wcs.py liger_iris_pipeline/tests/test_asdf_schema.py liger_iris_pipeline/tests/test_preprocess_flatfield.py liger_iris_pipeline/tests/test_image2.py | ||
pytest -v liger_iris_pipeline/tests/test_datamodels.py liger_iris_pipeline/tests/test_dark.py liger_iris_pipeline/tests/test_rop.py liger_iris_pipeline/tests/test_utils.py liger_iris_pipeline/tests/test_normalize.py liger_iris_pipeline/tests/test_assign_wcs.py liger_iris_pipeline/tests/test_asdf_schema.py liger_iris_pipeline/tests/test_preprocess_flatfield.py liger_iris_pipeline/tests/test_image2.py liger_iris_pipeline/tests/test_merge_subarrays.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Imports | ||
import liger_iris_pipeline | ||
liger_iris_pipeline.monkeypatch_jwst_datamodels() | ||
import numpy as np | ||
|
||
import json | ||
|
||
# See README.md for notes on testing data | ||
from liger_iris_pipeline.tests.test_utils import get_data_from_url | ||
|
||
|
||
def test_merge_subarrays(tmp_path): | ||
|
||
# Download the test data | ||
reduced_science_frame_filename = get_data_from_url("48911932") | ||
reduced_subarray1_filename = get_data_from_url("48911917") | ||
reduced_subarray2_filename = get_data_from_url("48911914") | ||
|
||
# Create an ASN for this test | ||
asn = { | ||
"asn_rule": "Asn_Image", | ||
"asn_pool": "pool", | ||
"asn_type": "image3", | ||
"products": [ | ||
{ | ||
"name": "test_merge_subarrays_asn", | ||
"members": [ | ||
{ | ||
"expname": reduced_science_frame_filename, | ||
"exptype": "science" | ||
}, | ||
{ | ||
"expname": reduced_subarray1_filename, | ||
"exptype": "science" | ||
}, | ||
{ | ||
"expname": reduced_subarray2_filename, | ||
"exptype": "science" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
||
# Save to file | ||
asn_temp_filename = tmp_path / "test_asn.json" | ||
with open(asn_temp_filename, "w+") as f: | ||
json.dump(asn, f) | ||
|
||
# Run the merge subarray pipeline | ||
result = liger_iris_pipeline.MergeSubarraysStep().call(asn_temp_filename) | ||
|
||
# Check that the image is valid | ||
assert np.all(np.logical_not(np.isnan(result.data))) |