Commit f22afd99 authored by Yan's avatar Yan
Browse files

Export drlspectrum working

parent 5a7815df
......@@ -267,6 +267,26 @@ def save_drlconfig(ptable, dtable, parent):
expf.write("{}\n".format((",".join(map(str, vals)))))
expf.close()
def export_drlspectrum(parent, fn, ptable, dtable, ds):
if fn[0] is None:
QtWidgets.QMessageBox.warning(
main_window, "Export DRL dataset",
"Nothing to export, cancelling request")
return
names, times, intensities = get_daughterset(ptable, dtable, ds)
exp_f_name = ft.get_save_filename(
"Export DRL data", "comma-separated values (*.csv)", "csv", parent)
if exp_f_name is not '':
expf = open(exp_f_name, 'w')
expf.write("times, {}\n".format((",".join(names))))
for i in range(len(times)):
dataset = []
dataset.append(times[i])
for intensity in intensities:
dataset.append(intensity[i])
expf.write("{}\n".format((",".join(map(str, dataset)))))
expf.close()
def dialog(parent, ds, filename, mass_selector, spectrum, cache):
......@@ -323,6 +343,8 @@ def dialog(parent, ds, filename, mass_selector, spectrum, cache):
drl_load.clicked.connect(lambda: load_drlconfig(pt, dt))
drl_save.clicked.connect(lambda: save_drlconfig(
pt, dt, dial_widget))
drl_export.clicked.connect(lambda: export_drlspectrum(
dial_widget, filename, pt, dt, ds))
dial_widget.finished.connect(lambda: savecache(
cache, pt, dt, graph_canvas))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment