Skip to content

Commit

Permalink
Small refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
samtygier-stfc committed Dec 11, 2024
1 parent d8a7eae commit f663a19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mantidimaging/core/reconstruct/cil_recon.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __call__(self, algo: Algorithm) -> None:
if isinstance(algo, PDHG):
forward_projection = algo.operator.direct(algo.solution)[1].as_array()
data = algo.f[1].b.as_array()
if len(forward_projection.shape) == 3:
if forward_projection.ndim == 3:
# For a full 3D recon, just select the middle slice
slice = forward_projection.shape[0] // 2
forward_projection = forward_projection[slice]
Expand Down
9 changes: 5 additions & 4 deletions mantidimaging/gui/dialogs/async_task/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ def progress_update(self) -> None:
extra_info = progress_info[-1].extra_info
self.progress_updated.emit(self.progress.completion(), msg if msg is not None else '')

if extra_info and 'losses' in extra_info:
self.update_progress_plot(extra_info['iterations'], extra_info['losses'])
if extra_info:
if 'losses' in extra_info:
self.update_progress_plot(extra_info['iterations'], extra_info['losses'])

if extra_info and 'residual' in extra_info:
self.progress_residual_plot_updated.emit(extra_info["residual"])
if 'residual' in extra_info:
self.progress_residual_plot_updated.emit(extra_info["residual"])

def show_stop_button(self, show: bool = False) -> None:
self.view.show_cancel_button(show)
Expand Down

0 comments on commit f663a19

Please sign in to comment.