From 3dda6d88010956149495248215e0824ff8f2398c Mon Sep 17 00:00:00 2001 From: dkazanc Date: Mon, 18 Nov 2024 10:07:31 +0000 Subject: [PATCH] kernel estimation to work only for Tomopy Paganin implementation --- httomo/sweep_runner/param_sweep_runner.py | 4 ++-- tests/sweep_runner/test_param_sweep_runner.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/httomo/sweep_runner/param_sweep_runner.py b/httomo/sweep_runner/param_sweep_runner.py index a58fd515f..5aba3f834 100644 --- a/httomo/sweep_runner/param_sweep_runner.py +++ b/httomo/sweep_runner/param_sweep_runner.py @@ -148,9 +148,9 @@ def modify_loader_preview(self): ) raise ValueError(err_str) - # before modifying preview here we need to check if the block fits the memory if Paganin method is present in the pipeline + # before modifying preview here we need to check if the block fits the memory if Paganin method (TomoPy implementation) is present in the pipeline for method in self._pipeline._methods: - if "paganin" in method.method_name and method.sweep: + if "paganin_filter_tomopy" in method.method_name and method.sweep: # Specifically dealing with the Paganin filter variable kernel size, as if the kernel is large, # the larger preview needs to be taken in that case. So far this is the only method that # requires an extended preview. diff --git a/tests/sweep_runner/test_param_sweep_runner.py b/tests/sweep_runner/test_param_sweep_runner.py index d031006a8..928fbbff3 100644 --- a/tests/sweep_runner/test_param_sweep_runner.py +++ b/tests/sweep_runner/test_param_sweep_runner.py @@ -104,7 +104,7 @@ def test_after_prepare_block_attr_contains_data(mocker: MockerFixture): np.testing.assert_array_equal(runner.block.data, data) -def tests_preview_modifier_paganin(mocker: MockerFixture): +def tests_preview_modifier_paganin_tomopy(mocker: MockerFixture): SINO_SLICES = 100 GLOBAL_SHAPE = PREVIEWED_SLICES_SHAPE = (180, SINO_SLICES, 160) data = np.arange(np.prod(PREVIEWED_SLICES_SHAPE), dtype=np.uint16).reshape( @@ -127,7 +127,7 @@ def tests_preview_modifier_paganin(mocker: MockerFixture): ) class FakeModule: - def paganin(data: np.ndarray, alpha: float, pixel_size: float, energy: float, dist: float): # type: ignore + def paganin_filter_tomopy(data: np.ndarray, alpha: float, pixel_size: float, energy: float, dist: float): # type: ignore return data * alpha mocker.patch( @@ -188,7 +188,7 @@ def mock_make_data_source(padding) -> DataSetSource: sweep_method_wrapper = make_method_wrapper( method_repository=make_mock_repo(mocker), module_path="mocked_module_path.corr", - method_name="paganin", + method_name="paganin_filter_tomopy", comm=MPI.COMM_WORLD, preview_config=make_mock_preview_config(mocker), save_result=None,