mantidproject / mantidimaging

Graphical toolkit for neutron imaging.
https://mantidproject.github.io/mantidimaging
GNU General Public License v3.0
10 stars 6 forks source link

FLASH PR: Add None to tof_mode type and default value of None on init #2212

Closed JackEAllen closed 1 month ago

JackEAllen commented 1 month ago

Issue

Closes FLASH PR

Description

Add a description of the changes made. Noticed a failiure on main when trying to open the spectrum viewer:

2024-05-28 13:34:06,149 [mantidimaging.core.utility.progress_reporting.progress:L241] INFO: Elapsed time: 13 sec.
2024-05-28 13:34:06,149 [mantidimaging.core.utility.progress_reporting.progress:L242] DEBUG: Memory usage after execution: 6422464.0 KB, 6271.9375 MB
2024-05-28 13:34:06,150 [mantidimaging.core.io.loader.loader:L174] DEBUG: No metadata file found
Shutter count file: <mantidimaging.core.io.instrument_log.ShutterCount object at 0x7163e4d8a920>
2024-05-28 13:34:17,454 [mantidimaging.gui.windows.main.view:L566] ERROR: Traceback (most recent call last):
  File "/mantidimaging/mantidimaging/gui/windows/spectrum_viewer/presenter.py", line 98, in handle_sample_change
    self.model.set_tof_unit_mode_for_stack()
  File "/mantidimaging/mantidimaging/gui/windows/spectrum_viewer/model.py", line 518, in set_tof_unit_mode_for_stack
    elif self.tof_mode == ToFUnitMode.ENERGY:
AttributeError: 'SpectrumViewerWindowModel' object has no attribute 'tof_mode'

2024-05-28 13:34:17,455 [mantidimaging.gui.mvp_base.view:L46] ERROR: show_error_dialog(): Uncaught exception AttributeError: 'SpectrumViewerWindowModel' object has no attribute 'tof_mode'

2024-05-28 13:34:20,996 [mantidimaging.gui.windows.main.view:L566] ERROR: Traceback (most recent call last):
  File "/mantidimaging/mantidimaging/gui/windows/main/view.py", line 438, in show_spectrum_viewer_window
    self.spectrum_viewer = SpectrumViewerWindowView(self)
  File "/mantidimaging/mantidimaging/gui/windows/spectrum_viewer/view.py", line 125, in __init__
    self.presenter.handle_tof_unit_change()
  File "/mantidimaging/mantidimaging/gui/windows/spectrum_viewer/presenter.py", line 352, in handle_tof_unit_change
    self.model.set_relevant_tof_units()
  File "/mantidimaging/mantidimaging/gui/windows/spectrum_viewer/model.py", line 499, in set_relevant_tof_units
    if self.tof_mode == ToFUnitMode.IMAGE_NUMBER or self.tof_data is None:
AttributeError: 'SpectrumViewerWindowModel' object has no attribute 'tof_mode'

2024-05-28 13:34:20,996 [mantidimaging.gui.mvp_base.view:L46] ERROR: show_error_dialog(): Uncaught exception AttributeError: 'SpectrumViewerWindowModel' object has no attribute 'tof_mode'

This was resolved by setting tof_modeto tof_mode: ToFUnitMode = ToFUnitMode.WAVELENGTH

Testing

Describe the tests that were used to verify your changes.

Acceptance Criteria

How should the reviewer test your changes?

Documentation

How have you changed the documentation to reflect your changes? All changes should be noted in the appropriate file in docs/release_notes

N/A

coveralls commented 1 month ago

Coverage Status

coverage: 72.735%. remained the same when pulling a17e6adb0477dcab8ed82f53f16b926b97ccc1ca on FLASH_PR_ToF_resolve_typing into 619bdd400f68c6ef35541e10a937916d056c71c2 on main.