Skip to content

Commit

Permalink
made suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeigh committed Jan 9, 2025
1 parent 28f1f60 commit 165971f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
1 change: 0 additions & 1 deletion mantidimaging/gui/windows/spectrum_viewer/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ def do_add_roi(self) -> None:
raise ValueError(f"ROI name already exists: {roi_name}")
height, width = self.model.get_image_shape()
roi = SensibleROI.from_list([0, 0, width, height])
self.model._roi_ranges[roi_name] = roi
self.view.spectrum_widget.add_roi(roi, roi_name)
spectrum = self.model.get_spectrum(roi, self.spectrum_mode, self.view.shuttercount_norm_enabled())
self.view.set_spectrum(roi_name, spectrum)
Expand Down
11 changes: 1 addition & 10 deletions mantidimaging/gui/windows/spectrum_viewer/test/model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,6 @@ def test_WHEN_rois_deleted_THEN_name_generator_is_reset(self):
self.assertEqual(self.model.roi_name_generator(), "roi_1")
self.assertEqual(self.model.roi_name_generator(), "roi_2")

def test_when_new_roi_set_THEN_roi_name_added_to_list_of_roi_names(self):
self.model.set_stack(generate_images())
self.model._roi_ranges["new_roi"] = SensibleROI.from_list([0, 0, 10, 10])
self.assertIn("new_roi", self.model._roi_ranges)
self.assertListEqual(list(self.model._roi_ranges.keys()), ["all", "new_roi"])

@parameterized.expand([
("False", None, False),
("True", ImageStack(np.ones([10, 11, 12])), True),
Expand Down Expand Up @@ -479,10 +473,7 @@ def test_save_single_rits_spectrum(self, mock_save_rits_roi):
_, mock_path = self._make_mock_path_stream()
with mock.patch.object(self.model, "save_roi_coords"):
self.model.save_single_rits_spectrum(mock_path, ErrorMode.STANDARD_DEVIATION)
mock_save_rits_roi.assert_called_once_with(
mock_path,
mock.ANY,
SensibleROI.from_list([0, 0, 5, 5]))
mock_save_rits_roi.assert_called_once_with(mock_path, mock.ANY, SensibleROI.from_list([0, 0, 5, 5]))

@mock.patch.object(SpectrumViewerWindowModel, "export_spectrum_to_rits")
def test_save_rits_correct_transmission(self, mock_save_rits_roi):
Expand Down

0 comments on commit 165971f

Please sign in to comment.