Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spectrum viewer: cant add an ROI after exporting CSV #2422

Open
samtygier-stfc opened this issue Nov 29, 2024 · 0 comments · May be fixed by #2458
Open

Spectrum viewer: cant add an ROI after exporting CSV #2422

samtygier-stfc opened this issue Nov 29, 2024 · 0 comments · May be fixed by #2458
Assignees

Comments

@samtygier-stfc
Copy link
Collaborator

Summary

After exporting a CSV file, it is not possible to add an ROI

Steps To Reproduce

Open a dataset (without the spectra file), open the spectum viewer
Click "Add" to add an ROI
Click "Export Spectrum" and choose name to save an CSV file
Click "Add" to add an ROI

Expected Behaviour

Add should be able to add an new ROI

Current Behaviour

The first add works, but after exporting, it fails

Context

Happens on current main, also back on the 2.8 release

Failure Logs

024-11-29 16:05:50,476 [mantidimaging.gui.windows.main.view:L591] ERROR: Traceback (most recent call last):
  File "/home/sam/git/mantidimaging/mantidimaging/gui/windows/spectrum_viewer/view.py", line 385, in set_new_roi
    self.presenter.do_add_roi()
  File "/home/sam/git/mantidimaging/mantidimaging/gui/windows/spectrum_viewer/presenter.py", line 348, in do_add_roi
    self.view.set_spectrum(roi_name, spectrum)
  File "/home/sam/git/mantidimaging/mantidimaging/gui/windows/spectrum_viewer/view.py", line 335, in set_spectrum
    self.show_visible_spectrums()
  File "/home/sam/git/mantidimaging/mantidimaging/gui/windows/spectrum_viewer/view.py", line 439, in show_visible_spectrums
    self.spectrum_widget.spectrum.plot(self.presenter.model.tof_data,
  File "/home/sam/mambaforge/envs/mantidimaging-dev/lib/python3.12/site-packages/pyqtgraph/graphicsItems/PlotItem/PlotItem.py", line 630, in plot
    item = PlotDataItem(*args, **kargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sam/mambaforge/envs/mantidimaging-dev/lib/python3.12/site-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 375, in __init__
    self.setData(*args, **kargs)
  File "/home/sam/mambaforge/envs/mantidimaging-dev/lib/python3.12/site-packages/pyqtgraph/graphicsItems/PlotDataItem.py", line 741, in setData
    raise TypeError('When passing two unnamed arguments, both must be a list or array of values. (got %s, %s)' % (str(type(args[0])), str(type(args[1]))))
TypeError: When passing two unnamed arguments, both must be a list or array of values. (got <class 'NoneType'>, <class 'numpy.ndarray'>)

A quick investigation shows that the in show_visible_spectrums() the value of self.presenter.model.tof_data is None.

This does not happen if there is a spectra file loaded.

@JackEAllen JackEAllen moved this from Todo to Review in Mantid Imaging Work Jan 10, 2025
@JackEAllen JackEAllen moved this from Review to In Progress in Mantid Imaging Work Jan 10, 2025
@ashleymeigh2 ashleymeigh2 self-assigned this Jan 15, 2025
@ashleymeigh2 ashleymeigh2 linked a pull request Jan 15, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants