Skip to content

Commit

Permalink
Refactor unit tests and code update to deal with split of L2 and L3 f…
Browse files Browse the repository at this point in the history
…iles.
  • Loading branch information
mairanteodoro committed Apr 4, 2024
1 parent 0d55b2e commit 6baa3b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
21 changes: 12 additions & 9 deletions romancal/outlier_detection/tests/test_outlier_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ def test_outlier_valid_input_asn(tmp_path, base_image, create_mock_asn_file):
asn_filepath = create_mock_asn_file(tmp_path)

res = OutlierDetectionStep.call(
asn_filepath, output_dir=tmp_path.as_posix(), in_memory=True
asn_filepath,
output_dir=tmp_path.as_posix(),
in_memory=True,
resample_data=False,
)

# assert step.skip is False
Expand All @@ -107,7 +110,11 @@ def test_outlier_valid_input_modelcontainer(tmp_path, base_image):

mc = ModelContainer([img_1, img_2])

res = OutlierDetectionStep.call(mc, in_memory=True)
res = OutlierDetectionStep.call(
mc,
in_memory=True,
resample_data=False,
)

assert all(x.meta.cal_step.outlier_detection == "COMPLETE" for x in res)

Expand Down Expand Up @@ -192,22 +199,18 @@ def test_outlier_do_detection_write_files_to_custom_location(
"backg": 0.0,
"kernel_size": "7 7",
"save_intermediate_results": False,
"resample_data": True,
"resample_data": False,
"good_bits": 0,
"allowed_memory": None,
"in_memory": outlier_step.in_memory,
"make_output_path": outlier_step.make_output_path,
"resample_suffix": "i2d",
}

blot_path_1 = tmp_path / img_1.meta.filename.replace(".asdf", "_blot.asdf")
blot_path_2 = tmp_path / img_2.meta.filename.replace(".asdf", "_blot.asdf")
# meta.filename for the median image created by OutlierDetection.do_detection()
median_path = tmp_path / "drizzled_median.asdf"

outlier_files_path = [
blot_path_1,
blot_path_2,
median_path,
]

Expand Down Expand Up @@ -264,7 +267,7 @@ def test_outlier_do_detection_find_outliers(tmp_path, base_image, clean_up_after
"backg": 0.0,
"kernel_size": "7 7",
"save_intermediate_results": False,
"resample_data": True,
"resample_data": False,
"good_bits": 0,
"allowed_memory": None,
"in_memory": outlier_step.in_memory,
Expand Down Expand Up @@ -338,7 +341,7 @@ def test_outlier_do_detection_do_not_find_outliers_in_identical_images(
"backg": 0.0,
"kernel_size": "7 7",
"save_intermediate_results": False,
"resample_data": True,
"resample_data": False,
"good_bits": 0,
"allowed_memory": None,
"in_memory": outlier_step.in_memory,
Expand Down
1 change: 1 addition & 0 deletions romancal/resample/tests/test_resample_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from gwcs import coordinate_frames as cf
from roman_datamodels import datamodels, maker_utils

from romancal.datamodels import ModelContainer
from romancal.resample import ResampleStep, resample_utils


Expand Down

0 comments on commit 6baa3b6

Please sign in to comment.