diff --git a/mantidimaging/gui/windows/recon/model.py b/mantidimaging/gui/windows/recon/model.py index 3c0e3d32350..d736b71f963 100644 --- a/mantidimaging/gui/windows/recon/model.py +++ b/mantidimaging/gui/windows/recon/model.py @@ -2,7 +2,7 @@ # SPDX - License - Identifier: GPL-3.0-or-later from __future__ import annotations from logging import getLogger -from typing import List, Optional, Tuple, Union, TYPE_CHECKING +from typing import List, Optional, Tuple, Union, TYPE_CHECKING, Any import numpy as np @@ -33,17 +33,8 @@ def __init__(self, data_model: CorTiltPointQtModel): self._preview_slice_idx = 0 self._selected_row = 0 self.data_model = data_model - self._last_result = None self._last_cor = ScalarCoR(0.0) - @property - def last_result(self) -> None: - return self._last_result - - @last_result.setter - def last_result(self, value): - self._last_result = value - @property def selected_row(self) -> int: return self._selected_row @@ -69,11 +60,11 @@ def preview_slice_idx(self, value: int) -> None: self._preview_slice_idx = value @property - def last_cor(self): + def last_cor(self) -> ScalarCoR: return self._last_cor @last_cor.setter - def last_cor(self, value): + def last_cor(self, value: ScalarCoR) -> None: self._last_cor = value @property @@ -121,9 +112,6 @@ def do_fit(self) -> bool: display_name="Calculated COR/Tilt", **self.data_model.stack_properties) - # Cache last result - self.last_result = self.data_model.stack_properties - # Async task needs a non-None result of some sort return True @@ -190,7 +178,7 @@ def slices(self) -> np.ndarray: return self.data_model.slices @staticmethod - def load_allowed_recon_kwargs() -> dict: + def load_allowed_recon_kwargs() -> dict[str, Any]: d = tomopy_allowed_kwargs() if CudaChecker().cuda_is_present(): d.update(astra_allowed_kwargs()) @@ -202,7 +190,7 @@ def get_allowed_filters(alg_name: str) -> list: reconstructor = get_reconstructor_for(alg_name) return reconstructor.allowed_filters() - def get_me_a_cor(self, cor: Optional[ScalarCoR] = None): + def get_me_a_cor(self, cor: Optional[ScalarCoR] = None) -> ScalarCoR: if cor is not None: # a rotation has been passed in! return cor @@ -217,12 +205,11 @@ def get_me_a_cor(self, cor: Optional[ScalarCoR] = None): def get_cor_for_slice_from_regression(self) -> ScalarCoR: return ScalarCoR(self.data_model.get_cor_from_regression(self.preview_slice_idx)) - def reset_selected_row(self): + def reset_selected_row(self) -> None: self.selected_row = 0 - def set_precalculated(self, cor: ScalarCoR, tilt: Degrees): + def set_precalculated(self, cor: ScalarCoR, tilt: Degrees) -> None: self.data_model.set_precalculated(cor, tilt) - self.last_result = self.data_model.stack_properties def is_current_stack(self, uuid: "uuid.UUID") -> bool: return self.stack_id == uuid diff --git a/mantidimaging/gui/windows/recon/test/model_test.py b/mantidimaging/gui/windows/recon/test/model_test.py index 6fcdfa67ac8..60117199778 100644 --- a/mantidimaging/gui/windows/recon/test/model_test.py +++ b/mantidimaging/gui/windows/recon/test/model_test.py @@ -29,7 +29,6 @@ def setUp(self): def test_empty_init(self): m = ReconstructWindowModel(CorTiltPointQtModel()) self.assertIsNone(m.images) - self.assertIsNone(m.last_result) def test_find_initial_cor_returns_0_0_without_data(self): self.model.initial_select_data(None) @@ -93,7 +92,6 @@ def test_do_fit(self): self.model.data_model.add_point(1, 300, 350) self.model.do_fit() self.assertTrue(const.OPERATION_HISTORY in self.model.images.metadata) - self.assertEqual(self.model.last_result, self.model.data_model.stack_properties) @mock.patch('mantidimaging.gui.windows.recon.model.get_reconstructor_for') def test_run_preview_recon(self, mock_get_reconstructor_for):