Skip to content

Commit

Permalink
Merge pull request #882 from neutrons/fix_nopeakcollection_crash
Browse files Browse the repository at this point in the history
disable export fitting when no file is loaded
  • Loading branch information
fanchercm authored Oct 3, 2024
2 parents c47162d + 38fc765 commit 62eb44b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
1 change: 1 addition & 0 deletions pyrs/interface/peak_fitting/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def load_and_plot(self, hidra_file_name):
o_gui.enabled_sub_runs_interation_widgets(True)
# o_gui.enabled_fitting_widgets(True)
o_gui.enabled_data_fit_plot(True)
o_gui.enabled_export_csv_widgets(False)
o_gui.enabled_peak_ranges_widgets(True)
o_gui.enabled_1dplot_widgets(True)

Expand Down
29 changes: 16 additions & 13 deletions pyrs/interface/peak_fitting/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,22 @@ def select_output_folder(self):
self._csv_file_name = os.path.join(out_folder, self.parent._project_name + '.csv')

def create_csv(self):
peaks = self.parent.fit_result.peakcollections
sample_logs = self.parent.hidra_workspace._sample_logs

print("sample_log: {}".format(sample_logs))

generator = SummaryGenerator(self._csv_file_name,
log_list=sample_logs.keys())
generator.setHeaderInformation(dict())
generator.write_csv(sample_logs, peaks)

new_message = self.parent.current_root_statusbar_message + "\t\t\t\t Last Exported CSV: {}" \
"".format(self._csv_file_name)
self.parent.ui.statusbar.showMessage(new_message)
try:
peaks = self.parent.fit_result.peakcollections
sample_logs = self.parent.hidra_workspace._sample_logs

print("sample_log: {}".format(sample_logs))

generator = SummaryGenerator(self._csv_file_name,
log_list=sample_logs.keys())
generator.setHeaderInformation(dict())
generator.write_csv(sample_logs, peaks)

new_message = self.parent.current_root_statusbar_message + "\t\t\t\t Last Exported CSV: {}" \
"".format(self._csv_file_name)
self.parent.ui.statusbar.showMessage(new_message)
except AttributeError:
pass

def _retrieve_project(self):
_hidra_project_file = self.parent.hidra_workspace._project_file
Expand Down

1 comment on commit 62eb44b

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitLab pipeline for pyrs-dev has been submitted for this commit: "https://code.ornl.gov/sns-hfir-scse/deployments/pyrs-deploy/-/pipelines/621438"

Please sign in to comment.