Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and ericpre committed Jul 3, 2024
1 parent 586e91e commit 53e2617
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions rsciio/tests/registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
'protochips/random_csv_file.csv' be37c2ef6a4edbb66b69746d8c05cf860a3e3a321237ded84ad810b2b7c7731d
'quantumdetector/Merlin_Single_Quad.zip' 38cc7f4f580502c591e4b83c25e15b2e50cdc7e678881698dcd9b17ff5096048
'quantumdetector/Merlin_navigation4x2_ROI.zip' bde0830c13d1885d822c1df81a26ef20169b84124c372cfa7f7709be0efe78af
'quantumdetector/Merlin_navigation4x2_signalNx256_ROI.zip' 77f2faccadf9b1b4f0f80262b993bc06cabf8d70357460f8b3d92a5c554dd526
'renishaw/renishaw_test_exptime10_acc1.wdf' c056dc49abaad1e7e9744562d5219f52c7a10534ef052eefd8263ad024bcf43b
'renishaw/renishaw_test_exptime1_acc1.wdf' bc23e1f2644d37dd5b572e587bbcf6db08f33dc7e1480c232b04ef17efa63ba6
'renishaw/renishaw_test_exptime1_acc2.wdf' 7fb5fb09a079d1af672d3d37c5cbf3d950a6d0783791505c6f42d7d104790711
Expand Down
26 changes: 14 additions & 12 deletions rsciio/tests/test_quantumdetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
TEST_DATA_DIR = Path(__file__).parent / "data" / "quantumdetector"
ZIP_FILE = TEST_DATA_DIR / "Merlin_Single_Quad.zip"
ZIP_FILE2 = TEST_DATA_DIR / "Merlin_navigation4x2_ROI.zip"
ZIP_FILE3 = TEST_DATA_DIR / 'Merlin_navigation4x2_signalNx256_ROI.zip'
ZIP_FILE3 = TEST_DATA_DIR / "Merlin_navigation4x2_signalNx256_ROI.zip"
TEST_DATA_DIR_UNZIPPED = TEST_DATA_DIR / "unzipped"


Expand All @@ -58,8 +58,10 @@
for depth in [1, 6, 12, 24]
]

SIGNAL_ROI_FNAME_LIST = ['002_merlin_test_roi_sig256x128_nav4x2_hot_pixel_52x_39y.mib',
'003_merlin_test_roi_sig256x64_nav4x2_hot_pixel_52x_39y.mib']
SIGNAL_ROI_FNAME_LIST = [
"002_merlin_test_roi_sig256x128_nav4x2_hot_pixel_52x_39y.mib",
"003_merlin_test_roi_sig256x64_nav4x2_hot_pixel_52x_39y.mib",
]


def filter_list(fname_list, string):
Expand All @@ -80,7 +82,6 @@ def setup_module():
zipped.extractall(TEST_DATA_DIR_UNZIPPED)



def teardown_module():
# necessary on windows, to help closing the files...
gc.collect()
Expand Down Expand Up @@ -422,22 +423,23 @@ def test_distributed(lazy):
np.testing.assert_array_equal(s.data, s2.data)


@pytest.mark.parametrize("fname", SIGNAL_ROI_FNAME_LIST)
@pytest.mark.parametrize("fname", SIGNAL_ROI_FNAME_LIST)
def test_hot_pixel_signal_ROI(fname):
s = hs.load(TEST_DATA_DIR_UNZIPPED / fname)
for i in s:
for j in i:
data = j.data
xy = np.argwhere(data==data.max())
xy = np.argwhere(data == data.max())
assert len(xy) == 1
coord_shifted = np.array(*xy) - np.array([data.shape[0], 0])
assert np.all(coord_shifted == np.array([-40,52]))
assert np.all(coord_shifted == np.array([-40, 52]))


@pytest.mark.parametrize('fname', SIGNAL_ROI_FNAME_LIST)
@pytest.mark.parametrize("fname", SIGNAL_ROI_FNAME_LIST)
def test_signal_shape_ROI(fname):
s = hs.load(TEST_DATA_DIR_UNZIPPED / fname)
assert s.axes_manager.navigation_shape == (4, 2)
if 'sig256x64' in fname:
assert s.axes_manager.signal_shape == (256,64)
if 'sig256x128' in fname:
assert s.axes_manager.signal_shape == (256,128)
if "sig256x64" in fname:
assert s.axes_manager.signal_shape == (256, 64)
if "sig256x128" in fname:
assert s.axes_manager.signal_shape == (256, 128)

0 comments on commit 53e2617

Please sign in to comment.