Skip to content

When theres no ROIs, disable fitting buttons and plot empty spectrum#3124

Open
MikeSullivan7 wants to merge 2 commits into
mainfrom
3123_no_rois_fitting_tab_keyerror
Open

When theres no ROIs, disable fitting buttons and plot empty spectrum#3124
MikeSullivan7 wants to merge 2 commits into
mainfrom
3123_no_rois_fitting_tab_keyerror

Conversation

@MikeSullivan7
Copy link
Copy Markdown
Collaborator

Issue Closes #3123

Description

There are now checks when the Fitting Tab is activated so that when we are in ROI mode and all ROIs have been deleted from the table, an empty spectrum is plotted and the "From ROI" and "Run All Fit" buttons are disabled as there is no data to fit against.

Developer Testing

  • I have verified unit tests pass locally: python -m pytest -vs
  • ...

Acceptance Criteria and Reviewer Testing

  • Unit tests pass locally: python -m pytest -vs
  • Load in data and open Spectrum Viewer
  • With an ROI activate, open the Fitting Tab and check that it behaves as normal.
  • Go back to the Image Tab and delete the ROI so that the table is completely empty
  • Go to the Fitting Tab and check that the ROI Selection Widget is empty, and that the relevant buttons are disabled.
  • Add an ROI and go back to the Fitting Tab, check that everything is enabled as usual.

@MikeSullivan7 MikeSullivan7 marked this pull request as ready for review April 23, 2026 13:08
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 23, 2026

Coverage Status

coverage: 67.959% (-0.04%) from 67.998% — 3123_no_rois_fitting_tab_keyerror into main

Comment thread mantidimaging/gui/windows/spectrum_viewer/fitting_form.py Outdated
@ashleymeigh2
Copy link
Copy Markdown
Collaborator

KeyError occurs here because no ROI is selected in the fitting form dropdown.
current_roi_name is empty ('') at this point, so roi_dict lookup fails.

@MikeSullivan7 MikeSullivan7 force-pushed the 3123_no_rois_fitting_tab_keyerror branch 2 times, most recently from 8bb229f to 1736263 Compare May 5, 2026 16:10
@ashleymeigh2 ashleymeigh2 force-pushed the 3123_no_rois_fitting_tab_keyerror branch 2 times, most recently from f340492 to 1736263 Compare May 19, 2026 14:22
@ashleymeigh2 ashleymeigh2 force-pushed the 3123_no_rois_fitting_tab_keyerror branch from 1736263 to fcb2788 Compare May 19, 2026 14:26
@ashleymeigh2 ashleymeigh2 requested a review from RasmiaKulan May 19, 2026 14:34
@RasmiaKulan
Copy link
Copy Markdown
Collaborator

looks good

@RasmiaKulan RasmiaKulan added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spectrum Viewer: Deleteing all ROIs then opening Fitting Tab gives KeyError

4 participants