Skip to content

Commit

Permalink
remove MainWindowModel.add_180_deg_to_dataset and associated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeSullivan7 committed Nov 20, 2024
1 parent a94ebb1 commit 31d961d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
9 changes: 0 additions & 9 deletions mantidimaging/gui/windows/main/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,6 @@ def get_stack_with_images(self, images: ImageStack) -> StackVisualiserView:
return sv
raise RuntimeError(f"Did not find stack {images} in stacks! Stacks: {self.stack_visualisers.items()}")

def add_180_deg_file_to_dataset(self, dataset_id: uuid.UUID, _180_deg_file: str) -> None:
"""
Loads a 180 file then adds it to the dataset, creates a stack window, and updates the dataset tree view.
:param dataset_id: The ID of the dataset to update.
:param _180_deg_file: The filename for the 180 file.
"""
proj180deg = self.model.add_180_deg_to_dataset(dataset_id, _180_deg_file)
self.add_images_to_existing_dataset(dataset_id, proj180deg, "proj_180")

def add_projection_angles_to_sample(self, stack_id: uuid.UUID, proj_angles: ProjectionAngles) -> None:
self.model.add_projection_angles_to_sample(stack_id, proj_angles)

Expand Down
24 changes: 0 additions & 24 deletions mantidimaging/gui/windows/main/test/model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,30 +217,6 @@ def test_add_log_to_sample_no_stack(self, load_log: mock.Mock):

stack_mock.assert_called_with(images_id)

@mock.patch('mantidimaging.core.io.loader.load_stack_from_group')
def test_add_180_deg_to_dataset(self, load: mock.Mock):
_180_file = "180 file"
dataset_id = "id"
self.model.datasets[dataset_id] = dataset_mock = StrictDataset(sample=generate_images())
load.return_value = _180_stack = generate_images()
self.model.add_180_deg_to_dataset(dataset_id=dataset_id, _180_deg_file=_180_file)

load_arg = load.call_args[0][0]
self.assertEqual(load_arg.first_file().name, _180_file)
self.assertEqual(_180_stack, dataset_mock.proj180deg)

@mock.patch('mantidimaging.core.io.loader.load')
def test_add_180_deg_to_dataset_no_dataset(self, load: mock.Mock):
"""
Test in add_180_deg_to_stack when get_images_by_uuid returns None
"""
_180_file = "180 file"
dataset_id = "id"
self.assertRaises(RuntimeError,
self.model.add_180_deg_to_dataset,
dataset_id=dataset_id,
_180_deg_file=_180_file)

def test_add_projection_angles_to_sample_no_stack(self):
proj_angles = ProjectionAngles(np.arange(0, 10))
images_id = "id"
Expand Down

0 comments on commit 31d961d

Please sign in to comment.