Skip to content
Snippets Groups Projects
Commit 788fe3cc authored by Guenter Quast's avatar Guenter Quast
Browse files

mcpha: added two lines with meta data to histogram file

parent 0495396f
No related branches found
No related tags found
No related merge requests found
......@@ -684,12 +684,17 @@ class HstDisplay(QWidget, Ui_HstDisplay):
try:
dialog = QFileDialog(self, "Save hst file", path, "*.hst")
dialog.setDefaultSuffix("hst")
name = "histogram-%s.hst" % time.strftime("%Y%m%d-%H%M%S")
timestamp = time.strftime("%Y%m%d-%H%M%S")
name = "histogram-%s.hst" % timestamp
dialog.selectFile(name)
dialog.setAcceptMode(QFileDialog.AcceptSave)
if dialog.exec() == QDialog.Accepted:
name = dialog.selectedFiles()
np.savetxt(name[0], self.buffer, fmt="%u", newline=os.linesep)
np.savetxt(name[0],
self.buffer,
fmt="%u",
header ='mcpha spectrum ' + timestamp + '\n counts per channel',
newline=os.linesep)
self.log.print("histogram %d saved to file %s" % ((self.number + 1), name[0]))
except:
self.log.print("error: %s" % sys.exc_info()[1])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment