Commit ae250755 authored by Yan's avatar Yan
Browse files

Fix: arrow chromatogram select, export msspec

* exporting MS spectrum fixed - problem with time selection
* arrow chromatogram selection fixed
parent e053c026
......@@ -14,7 +14,7 @@ from . import zcetools_help
from . import reactivitytools
__version__ = "0.0.53"
__version__ = "0.0.54"
__all__ = ['config', 'datatools', 'docks', 'drltools', 'datasets',
......
from PyQt5 import QtWidgets
import numpy as np
import prasopes.config as cf
import prasopes.datatools as dt
import os.path
......@@ -37,9 +38,13 @@ def export_dial(augCanvas, main_window):
exp_f_name = get_save_filename(
"Export spectrum", "dat table (*.dat)", "dat", main_window)
if exp_f_name != '':
alltimes = np.concatenate([i[0] for i in augCanvas.ds.chromatograms])
mint = augCanvas.ds.mintime if augCanvas.ds.mintime != -np.inf else\
min(alltimes)
maxt = augCanvas.ds.maxtime if augCanvas.ds.maxtime != np.inf else\
max(alltimes)
description = ("{}_{:.4}-{:.4}_minutes_of_the_aquisition".format(
os.path.basename(augCanvas.ds.filename),
augCanvas.chrom['t_start'], augCanvas.chrom['t_end']))
os.path.basename(augCanvas.ds.filename), mint, maxt))
expf = open(exp_f_name, 'w')
expf.write(dt.specttostr(augCanvas.spectplot, description=description))
expf.close
......@@ -7,6 +7,7 @@ from matplotlib.widgets import SpanSelector
import numpy as np
import prasopes.datatools as dt
import prasopes.config as cf
import prasopes.datasets as ds
import matplotlib
matplotlib.use("Qt5Agg")
......@@ -274,6 +275,7 @@ def pick_times(x_min, x_max, augCanvas):
plot_subtime(augCanvas)
@ds.logdecor
def shift_times(event, augCanvas):
"""shifts times when arrow is pressed"""
if event.key() == QtCore.Qt.Key_Left:
......@@ -282,13 +284,13 @@ def shift_times(event, augCanvas):
move = +1
else:
return
if not np.array_equal(augCanvas.chrom['timesarg'], []):
x_min, x_max = augCanvas.chrom['t_start'], augCanvas.chrom['t_end']
alltimes = np.concatenate([subset['chrom_dat'][0] for subset
in augCanvas.ds])
if not np.array_equal(augCanvas.ds.get_chromargs(), []):
x_min, x_max = augCanvas.ds.mintime, augCanvas.ds.maxtime
alltimes = np.concatenate([subset[0] for subset
in augCanvas.ds.chromatograms])
times = dt.argsubselect(alltimes, x_min, x_max) + move
goodtimes = np.where((times < len(alltimes)) & ~(times < 0))[0]
if not np.array_equal(goodtimes, []):
if goodtimes.size:
x_min, x_max = alltimes[times[goodtimes[[0, -1]]]]
pick_times(x_min, x_max, augCanvas)
......
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