From eb7268bbdf7cca7ff3937ab7d890ef363302e891 Mon Sep 17 00:00:00 2001 From: Alex Kong Date: Thu, 21 Nov 2024 11:54:55 -0800 Subject: [PATCH] Fix test to ensure the first two tests work for all channels partially imaged, and last test for only one --- tests/bin_extraction_test.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/bin_extraction_test.py b/tests/bin_extraction_test.py index 834af1b0..a8b52218 100644 --- a/tests/bin_extraction_test.py +++ b/tests/bin_extraction_test.py @@ -153,10 +153,15 @@ def test_incomplete_fov_check(): # change fov-2 to have zero values in the bottom of image fov2_data = load_utils.load_imgs_from_tree(extraction_dir, fovs=["fov-2-scan-1"]) - fov2_data[:, 10:, :, 0] = 0 + fov2_data_partial = fov2_data.copy() + fov2_data_partial[:, 10:, :, :] = 0 image_utils.save_image( os.path.join(extraction_dir, "fov-2-scan-1", "Au.tiff"), - fov2_data.loc["fov-2-scan-1", :, :, "Au"], + fov2_data_partial.loc["fov-2-scan-1", :, :, "Au"], + ) + image_utils.save_image( + os.path.join(extraction_dir, "fov-2-scan-1", "chan2.tiff"), + fov2_data_partial.loc["fov-2-scan-1", :, :, "chan2"], ) # test warning for partial fovs (checking 1 channel img) @@ -173,6 +178,11 @@ def test_incomplete_fov_check(): ) # test that increasing the number of channels to check causes no warning + # NOTE: this case specifically tests if only a subset of channels are partially imaged + image_utils.save_image( + os.path.join(extraction_dir, "fov-2-scan-1", "chan2.tiff"), + fov2_data.loc["fov-2-scan-1", :, :, "chan2"], + ) with warnings.catch_warnings(): warnings.simplefilter("error") bin_extraction.incomplete_fov_check(