Skip to content

Commit

Permalink
kernel estimation to work only for Tomopy Paganin implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dkazanc committed Nov 18, 2024
1 parent 38ad1f0 commit 3dda6d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions httomo/sweep_runner/param_sweep_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions tests/sweep_runner/test_param_sweep_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3dda6d8

Please sign in to comment.