-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix for ROI Addition After Exporting CSV #2458
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good! I have ran unit tests locally and manually tested by loading in a spectrum dataset, adding some ROIs, exporting data, then adding more ROIs.
Just a few small suggestions and happy to merge 🙂
spectrum_values = [v for v in self.spectrum_widget.spectrum_data_dict.values() if v is not None] | ||
tof_data = np.arange(len(spectrum_values[0]) if spectrum_values else 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we give V
a more descriptive name please
spectrum_values = [v for v in self.spectrum_widget.spectrum_data_dict.values() if v is not None] | ||
tof_data = np.arange(len(spectrum_values[0]) if spectrum_values else 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are okay to use .size
here as spectrum_values
should always be an np.ndarray.
tof_data = np.arange(spectrum_values[0].size if spectrum_values else 0)
@@ -437,9 +437,14 @@ def set_roi_visibility_flags(self, roi_name: str, visible: bool) -> None: | |||
self.show_visible_spectrums() | |||
|
|||
def show_visible_spectrums(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this method does a few things now, can we add a docstring to explain what the method does.
@@ -0,0 +1 @@ | |||
2422: Spectrum viewer: cant add an ROI after exporting CSV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we re-word this slightly to say what the proposed change is resolving, maybe something like:
"Spectrum viewer: Resolves a bug preventing a new ROI from being added after exporting to a CSV file,"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think would be good to understand why model.tof_data
is None
here after doing a CSV export.
It looks like it is set in model.set_stack()
and also in model.save_csv()
. Does it get set to None
by one of those?
Issue
Closes #2422
Description
This PR resolves an issue in the Spectrum Viewer where adding new ROIs fails after exporting a CSV file. The problem was caused by tof_data becoming unavailable post-export.
Acceptance Criteria
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
A new ROI should be successfully added and displayed in the Spectrum Viewer
Documentation
All changes should be noted in the appropriate file in docs/release_notes