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

Save the pump-probe output to file #315

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Save the pump-probe output to file #315

wants to merge 2 commits into from

Conversation

CammilleCC
Copy link
Contributor

@CammilleCC CammilleCC commented Sep 8, 2021

SPB requested to have a saved file for the pump-probe values. We now offer an ASCII and an NPZ output.

@dallanto
Copy link
Contributor

dallanto commented Sep 8, 2021

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")
Copy link
Contributor

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.

Copy link
Member

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.

Comment on lines +159 to +160
if not len(self._queue):
return
Copy link
Member

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]
Copy link
Member

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"].

Comment on lines +177 to +178
# Copy reference file from tmp folder to desired destination
os.makedirs(osp.dirname(filepath), exist_ok=True)
Copy link
Member

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
Copy link
Member

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:
Copy link
Member

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?

@JamesWrigley
Copy link
Member

Apologies for my shockingly slow review 🙈

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.

4 participants