-
Notifications
You must be signed in to change notification settings - Fork 10
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
Save the pump-probe output to file #315
base: dev
Are you sure you want to change the base?
Conversation
I could have sworn that this MR is open for a longer time, at least I'm sure I've looked at the code soon after you committed in July. LGTM 🙂 |
@@ -65,6 +65,8 @@ def __init__(self, *args, **kwargs): | |||
self._abs_difference_cb.setChecked(True) | |||
|
|||
self._reset_btn = QPushButton("Reset") | |||
self.save_btn = QPushButton("Save to 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.
would rather prefer a QAction in a toolbar on this window instead of a button to save to files.
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.
Hmm, @CammilleCC I leave this up to you. I think either UI is acceptable.
if not len(self._queue): | ||
return |
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.
It would be better if the button itself was disabled when there is no data to save, rather than silently exiting.
# Get the current data | ||
if not len(self._queue): | ||
return | ||
data = self._queue[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.
This changed in #318, the GUI now receives a dict
of all the data from the workers. So here we'd now need self._queue[0]["processed"]
.
# Copy reference file from tmp folder to desired destination | ||
os.makedirs(osp.dirname(filepath), exist_ok=True) |
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.
This comment doesn't seem to match the code? And why is it necessary to use os.makedirs()
here? I thought we could trust that any directory returned by QFileDialog.getSaveFileName()
already exists since the user would need to create it first in the dialog.
intensity_sub = pp.y | ||
|
||
if position is None: | ||
return |
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 this should show an error dialog to make it clear to the user that nothing happened.
intensity_subtracted=intensity_sub) | ||
elif filter is SaveFile.TXT: | ||
# write out conversion to tabular ASCII | ||
with open(filepath, 'w') as f: |
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.
Could we use Python's csv
library here?
Apologies for my shockingly slow review 🙈 |
SPB requested to have a saved file for the pump-probe values. We now offer an ASCII and an NPZ output.