Commit 97558ccc authored by 3Yan's avatar 3Yan

empty lines/cells handling improved

* check for empty-line in pop_plot
* reactivity export improved (now with labels)
* empty cells are now exported properly
parent 5592206e
......@@ -440,8 +440,8 @@ def main():
load_file(main_window, augCanvas, update, config, loadthread,
filename=sys.argv[1])
else:
gt.pop_plot(0, 0, augCanvas.spectplot, augCanvas.ms)
gt.pop_plot(0, 0, augCanvas.chromplot, augCanvas.chrom)
gt.pop_plot([], [], augCanvas.spectplot, augCanvas.ms)
gt.pop_plot([], [], augCanvas.chromplot, augCanvas.chrom)
main_window.show()
sys.exit(app.exec_())
......
......@@ -26,7 +26,8 @@ def specttostr(augCanvas, delim=" ", names=["mass","ion_count"], units=["m/z",""
for i in range(np.max([len(line.get_xdata()) for line in lines])):
pairs = [("{}"+delim+"{}").format(
line.get_xdata()[i], line.get_ydata()[i]) if
i < len(line.get_xdata()) else delim for line in lines]
i < len(line.get_xdata()) else "--"+delim+"--"
for line in lines]
strline = delim.join(pairs)+"\n"
strdata.append(strline)
strdata = "".join(strdata)
......
......@@ -66,7 +66,7 @@ def update_drlspectrum(ds, drls, drlspectrum):
names, times, intensities = drl.get_daughterset(ds, drls)
drlspectrum.clear()
gt.pop_plot(0, 0, drlspectrum, drls['graphlabels'])
gt.pop_plot([], [], drlspectrum, drls['graphlabels'])
drlspectrum.axvline(0, 0, 0.9, color="#FF000088", linestyle=":")
if drls['cutoff'].value() != 0:
......@@ -415,7 +415,7 @@ def print_graph(ds, drls):
printfig = Figure(figsize=(5, 2), dpi=100)
printplot = printfig.add_subplot(111)
printcanvas = FigureCanvas(printfig)
gt.pop_plot(0, 0, printplot, drls['graphlabels'])
gt.pop_plot([], [], printplot, drls['graphlabels'])
update_drlspectrum(ds, drls, printplot)
widget = QtWidgets.QDialog(None, windowTitle='Print preview')
layout = QtWidgets.QVBoxLayout(widget)
......@@ -571,7 +571,7 @@ def main_window(parent, augCanvas, update_signal):
graph_canvas.setAutoFillBackground(False)
gt.pan_factory(chromplot)
gt.zoom_factory(chromplot, 1.15)
gt.pop_plot(0, 0, chromplot, drls['graphlabels'])
gt.pop_plot([], [], chromplot, drls['graphlabels'])
dcolums = ["Name"]
for i in range(drls['cors'].value()):
......
......@@ -403,8 +403,9 @@ def ann_spec(ms_spec, msdata, ann_limit=0.01):
def pop_plot(xdata, ydata, plot, plot_data, colornum=0, legend=None, annotate=True):
"""Define and populate plot"""
plot.plot(xdata, ydata, linewidth=1, color=(
colors[colornum % len(colors)]/255), label=legend)
if len(xdata):
plot.plot(xdata, ydata, linewidth=1, color=(
colors[colornum % len(colors)]/255), label=legend)
plot.set_title(plot_data['name'], loc="right")
plot.set_xlabel(plot_data['xlabel'])
plot.set_ylabel(plot_data['ylabel'])
......
......@@ -80,7 +80,8 @@ def export_dial(augCanvas, drls, grph, labels, parselect):
if exp_f_name != '':
names = ["pressure", "rel._intensity"]
units = ["mTorr", ""]
description = os.path.basename(augCanvas.filename)
description = os.path.basename(augCanvas.filename) + " " +\
" -- ".join([line._label for line in grph.get_lines()])
expf = open(exp_f_name, 'w')
expf.write(dt.specttostr(grph, " ", names, units, description))
expf.close
......
Markdown is supported
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