From df512413da567e5da8d16822c8888d0da0133b91 Mon Sep 17 00:00:00 2001 From: Pat Gunn Date: Tue, 2 Apr 2024 15:06:49 -0400 Subject: [PATCH 1/3] VERSION: post-release to 1.10.6 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index db77e0ee9..7b4d9a4ff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.10.5 +1.10.6 From fe3f84f49a56d52f811a86c10131dd2ebd2e5379 Mon Sep 17 00:00:00 2001 From: Pat Gunn Date: Tue, 2 Apr 2024 22:14:58 -0400 Subject: [PATCH 2/3] test_sbx: Use distinct tiff files and don't clean them up afterwards, to get around file locking issues on windows (fixing release blocker) --- caiman/tests/test_sbx.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/caiman/tests/test_sbx.py b/caiman/tests/test_sbx.py index 9aa1538ae..3b03fbc5a 100644 --- a/caiman/tests/test_sbx.py +++ b/caiman/tests/test_sbx.py @@ -91,15 +91,16 @@ def test_load_subind(): def test_sbx_to_tif(): - tif_file = os.path.join(caiman_datadir(), 'temp', 'from_sbx.tif') try: + tif_file = os.path.join(caiman_datadir(), 'temp', 'sbxtest1.tif') file_2d = os.path.join(TESTDATA_PATH, '2d_sbx.sbx') data_2d_from_sbx = cm.load(file_2d) sbx_utils.sbx_to_tif(file_2d, fileout=tif_file) data_2d_from_tif = cm.load(tif_file) npt.assert_array_almost_equal(data_2d_from_sbx, data_2d_from_tif, err_msg='Data do not match when loaded from .sbx vs. .tif') - + + tif_file = os.path.join(caiman_datadir(), 'temp', 'sbxtest2.tif') file_3d = os.path.join(TESTDATA_PATH, '3d_sbx_1.sbx') data_3d_from_sbx = cm.load(file_3d, is3D=True) sbx_utils.sbx_to_tif(file_3d, fileout=tif_file) @@ -116,32 +117,28 @@ def test_sbx_to_tif(): assert False, 'Shape of tif plane is wrong' # with subindices + tif_file = os.path.join(caiman_datadir(), 'temp', 'sbxtest3.tif') subinds = (slice(0, None, 2), [0, 1, 3], slice(None)) sbx_utils.sbx_to_tif(file_2d, fileout=tif_file, subindices=subinds) sub_data_from_tif = cm.load(tif_file) npt.assert_array_almost_equal(data_2d_from_sbx[subinds_to_ix(subinds, data_2d_from_sbx.shape)], sub_data_from_tif) # with plane + tif_file = os.path.join(caiman_datadir(), 'temp', 'sbxtest4.tif') sbx_utils.sbx_to_tif(file_3d, fileout=tif_file, plane=0) plane_data_from_tif = cm.load(tif_file) npt.assert_array_almost_equal(data_3d_from_sbx[:, :, :, 0], plane_data_from_tif) - - finally: - # cleanup - if os.path.isfile(tif_file): - os.remove(tif_file) - - def test_sbx_chain_to_tif(): - tif_file = os.path.join(caiman_datadir(), 'temp', 'from_sbx.tif') try: + tif_file = os.path.join(caiman_datadir(), 'temp', 'sbxtest5.tif') file_3d_1 = os.path.join(TESTDATA_PATH, '3d_sbx_1.sbx') data_3d_1 = sbx_utils.sbxread(file_3d_1) file_3d_2 = os.path.join(TESTDATA_PATH, '3d_sbx_2.sbx') data_3d_2 = sbx_utils.sbxread(file_3d_2) # normal chain + tif_file = os.path.join(caiman_datadir(), 'temp', 'sbxtest6.tif') sbx_utils.sbx_chain_to_tif([file_3d_1, file_3d_2], fileout=tif_file) data_chain_tif = cm.load(tif_file, is3D=True) data_chain_gt = np.concatenate([data_3d_1, data_3d_2], axis=0) @@ -149,6 +146,7 @@ def test_sbx_chain_to_tif(): err_msg='Tif from chain does not match expected') # matching subindices + tif_file = os.path.join(caiman_datadir(), 'temp', 'sbxtest7.tif') sbx_utils.sbx_chain_to_tif([file_3d_1, file_3d_2], fileout=tif_file, subindices=(slice(None), slice(0, None, 2))) data_chain_tif = cm.load(tif_file, is3D=True) @@ -157,6 +155,7 @@ def test_sbx_chain_to_tif(): err_msg='Tif from chain with subindices does not match expected') # non-matching subindices with compatible shapes + tif_file = os.path.join(caiman_datadir(), 'temp', 'sbxtest8.tif') subinds_1 = (slice(None), [0, 1, 3], slice(0, None, 2), [0, 2]) subinds_2 = (slice(1, None), [-4, -2, -1], slice(1, None, 2), [1, 3]) sbx_utils.sbx_chain_to_tif([file_3d_1, file_3d_2], fileout=tif_file, @@ -166,9 +165,3 @@ def test_sbx_chain_to_tif(): data_3d_2[subinds_to_ix(subinds_2, data_3d_2.shape)]], axis=0) npt.assert_array_almost_equal(data_chain_tif, data_chain_gt, err_msg='Tif from chain with non-matching subindices does not match expected') - - finally: - # cleanup - if os.path.isfile(tif_file): - os.remove(tif_file) - \ No newline at end of file From b312f1020e0c92d7706aa8ca0e28e86407f5bb0f Mon Sep 17 00:00:00 2001 From: Pat Gunn Date: Tue, 2 Apr 2024 22:26:14 -0400 Subject: [PATCH 3/3] test_sbx: fix assert --- caiman/tests/test_sbx.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/caiman/tests/test_sbx.py b/caiman/tests/test_sbx.py index 3b03fbc5a..6c18ad95b 100644 --- a/caiman/tests/test_sbx.py +++ b/caiman/tests/test_sbx.py @@ -128,6 +128,8 @@ def test_sbx_to_tif(): sbx_utils.sbx_to_tif(file_3d, fileout=tif_file, plane=0) plane_data_from_tif = cm.load(tif_file) npt.assert_array_almost_equal(data_3d_from_sbx[:, :, :, 0], plane_data_from_tif) + except: + assert False def test_sbx_chain_to_tif(): try: @@ -165,3 +167,5 @@ def test_sbx_chain_to_tif(): data_3d_2[subinds_to_ix(subinds_2, data_3d_2.shape)]], axis=0) npt.assert_array_almost_equal(data_chain_tif, data_chain_gt, err_msg='Tif from chain with non-matching subindices does not match expected') + except: + assert False