Commit b8fbfc68 authored by Yan's avatar Yan
Browse files

PEP8 cleanup

parent 79b374bd
"""Prasopes init"""
from . import config
from . import datatools
from . import datasets
from . import docks
from . import drltools
from . import filetools
......@@ -16,6 +17,7 @@ from . import reactivitytools
__version__ = "0.0.37"
__all__ = ['config', 'datatools', 'docks', 'drltools', 'drltoos_gui', 'filetools',
'graphtools', 'imagetools', 'predictmz', 'tangoicons', 'zcetools',
'zcetools_help', 'reactivitytools']
__all__ = ['config', 'datatools', 'docks', 'drltools', 'datasets',
'drltoos_gui', 'filetools', 'graphtools', 'imagetools',
'predictmz', 'tangoicons', 'zcetools', 'zcetools_help',
'reactivitytools']
......@@ -4,18 +4,15 @@ from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from PyQt5 import QtPrintSupport
from rawprasslib import load_raw
from prasopes.predictmz import predict as getmzpattern
from pathlib import Path
try:
from rawautoparams import load_params
import rawautoparams
autoparams = True
except ImportError:
autoparams = False
import copy
import rawprasslib
import numpy as np
import prasopes.config as cf
import prasopes.datatools as dt
import prasopes.drltools_gui as drlgui
......@@ -55,7 +52,7 @@ def show_exception_and_exit(exc_type, exc_value, tb):
traceback.print_exception(exc_type, exc_value, tb)
details = "\n".join(traceback.format_exception(exc_type, exc_value, tb))
errmsg = "\n".join(traceback.format_exception_only(exc_type, exc_value))\
+ ("\n The program might misbehave, do you want to continue?")
+ ("\n The program might misbehave, do you want to continue?")
msgbox = QtWidgets.QMessageBox(
3, "Exception!", errmsg,
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
......@@ -69,7 +66,7 @@ def load_file(parent, augCanvas, update, settings, loadthread, filename=None,
nothreading=False):
"""populates dataset and plots it"""
directory = augCanvas.ds.filename if augCanvas.ds\
else settings.value("open_folder")
else settings.value("open_folder")
filename = filename or QtWidgets.QFileDialog.getOpenFileName(
caption="Open spectrum", directory=directory,
filter="All supported formats (*.raw *.RAW *.d);;"
......@@ -199,7 +196,7 @@ def oddeven_changed(augCanvas, config, oddevenact):
def legendvis_changed(augCanvas, config, legendact):
config.setValue("view/legend",legendact.isChecked())
config.setValue("view/legend", legendact.isChecked())
if augCanvas.chromplot.get_legend():
for ax in (augCanvas.spectplot, augCanvas.chromplot):
ax.get_legend().set_visible(config.value("view/legend", type=bool))
......@@ -218,7 +215,7 @@ def paint_override(self, augCanvas):
self.conftype.format("onlymanann"), type=bool)))
for i, line in enumerate(data)]
legend = 1
if legend == True:
if legend:
self.plot.legend(loc=2)
else:
[gt.pop_plot(*line, self.plot, texts, i)
......@@ -253,7 +250,7 @@ def key_pressed(event, augCanvas, config, update):
def about(parent):
"""constructs window with "about" info"""
rawparver = rawautoparams.__version__ if autoparams else\
"library not found"
"library not found"
QtWidgets.QMessageBox.information(
parent, "About Prasopes",
......
......@@ -89,7 +89,7 @@ def posvarconf(label, value, config, num="int"):
def checkboxconf(label, value, config):
checkbox = QtWidgets.QCheckBox(label)
checkbox.setChecked(config.value(value,type=bool))
checkbox.setChecked(config.value(value, type=bool))
checkbox.stateChanged.connect(lambda: config.setValue(
value, checkbox.checkState()))
return checkbox
......@@ -146,12 +146,12 @@ def dial(parent):
timstoflayout.addLayout(posvarconf(
"Bins - MS", "timstof/ms_bins", config, "nonint"))
timstoflayout.addLayout(posvarconf(
"Maximum number of samples - mobility", "timstof/mob_sampling", config))
"Maximum number of samples - mobility", "timstof/mob_sampling",
config))
timstoflayout.addLayout(posvarconf(
"Bins - mobility", "timstof/mob_bins", config, "nonint"))
tabs.addTab(timstoftab, "timsTOF")
close_button = QtWidgets.QPushButton("Close")
close_button.clicked.connect(dialog.close)
......
......@@ -3,13 +3,11 @@ from rawprasslib import load_raw
from opentimspy.opentims import OpenTIMS
try:
from rawautoparams import load_params
import rawautoparams
autoparams = True
except ImportError:
autoparams = False
import numpy as np
import logging
import opentims_bruker_bridge
import os.path
import pathlib
import prasopes.config as cf
......@@ -18,6 +16,7 @@ import prasopes.datatools as dt
logger = logging.getLogger('dsLogger')
class Dataset():
def __init__(self, rawfile):
self.filename = rawfile
......@@ -71,23 +70,24 @@ class ThermoRawDataset(Dataset):
cf.settings().value("tmp_location"))
self.chromatograms = self.get_chromatograms()
self.mintime, self.maxtime = [self.chromatograms[i][0][i]
for i in (0,-1)]
for i in (0, -1)]
if autoparams:
try:
self.params, rawheaders, self.machtype = load_params(
self.filename, cf.settings().value("tmp_location"))
segments = [len(i[0]) for i in self.chromatograms]
indicies = [sum(segments[:i+1]) for i,j in enumerate(segments)]
indicies = [sum(segments[:i+1])
for i, j in enumerate(segments)]
self.headers = np.split(rawheaders, indicies)[:-1]
except Exception as pex:
except Exception:
self.params, self.machtype, self.headers = None, None, None
def get_chromatograms(self):
if cf.settings().value("view/oddeven", type=bool):
chroms = []
for i in self.dataset:
for j in (0,1):
chroms.append([i[0][ax, :][j::2] for ax in (0,1)])
for j in (0, 1):
chroms.append([i[0][ax, :][j::2] for ax in (0, 1)])
else:
chroms = [i[0] for i in self.dataset]
return chroms
......@@ -97,20 +97,20 @@ class ThermoRawDataset(Dataset):
maxt = maxt or self.maxtime
args = self.get_chromargs(mint, maxt)
spectra = []
for i,subset in enumerate(self.dataset):
for i, subset in enumerate(self.dataset):
if cf.settings().value("view/oddeven", type=bool):
for j in (0,1):
for j in (0, 1):
if len(subset[2][args[i*2+j][j::2]]):
yvalz = np.mean(subset[2][args[i*2+j][j::2]], axis=0)
spectra.append([subset[1], yvalz])
else:
spectra.append([[],[]])
spectra.append([[], []])
else:
if len(subset[2][args[i]]):
yvalz = np.mean(subset[2][args[i]], axis=0)
spectra.append([subset[1], yvalz])
else:
spectra.append([[],[]])
spectra.append([[], []])
return spectra
def get_peakchrom(self, startmass, endmass):
......@@ -131,10 +131,11 @@ class BrukerTimsDataset(Dataset):
if(os.path.isdir(self.filename)):
self.dataset = OpenTIMS(pathlib.Path(self.filename))
else:
self.dataset = OpenTIMS(pathlib.Path(os.path.dirname(self.filename)))
self.dataset = OpenTIMS(
pathlib.Path(os.path.dirname(self.filename)))
self.chromatograms = self.get_chromatograms()
self.mintime, self.maxtime = [self.chromatograms[i][0][i]
for i in (0,-1)]
for i in (0, -1)]
def sampletimes(self, mint, maxt, timescap):
frames = dt.argsubselect(self.dataset.retention_times,
......@@ -155,20 +156,19 @@ class BrukerTimsDataset(Dataset):
def get_chromatograms(self):
logger.info("getting timsTOF chromatogram")
keys = ('retention_time', 'intensity')
times = self.dataset.retention_times / 60
#devNote - summing is fast, asarray is fast, iterating is slow.
# devNote - summing is fast, asarray is fast, iterating is slow.
intensities = np.asarray([
np.sum(i['intensity']) for i in self.dataset.query_iter(
self.dataset.ms1_frames, columns=('intensity',))])
return [[times,intensities]]
self.dataset.ms1_frames, columns=('intensity',))])
return [[times, intensities]]
def get_spectra(self, mint=None, maxt=None):
logger.info("getting timsTOF spectra")
mint = mint or self.mintime
maxt = maxt or self.maxtime
framessel = self.sampletimes(mint, maxt,
cf.settings().value("timstof/ms_sampling", type=int))
framessel = self.sampletimes(mint, maxt, cf.settings().value(
"timstof/ms_sampling", type=int))
massints = self.dataset.query(framessel, columns=('mz', 'intensity'))
masses, ints = self.binit(
massints['mz'], massints['intensity'],
......@@ -180,7 +180,7 @@ class BrukerTimsDataset(Dataset):
intensity = np.divide([
np.sum(i['intensity'][dt.argsubselect(i['mz'], startm, endm)])
for i in self.dataset.query_iter(
self.dataset.ms1_frames, columns=('intensity','mz'))],
self.dataset.ms1_frames, columns=('intensity', 'mz'))],
np.clip(self.chromatograms[0][1], np.finfo(np.float32).eps, None))
return intensity
......@@ -188,8 +188,8 @@ class BrukerTimsDataset(Dataset):
logger.info("getting timsTOF mobilogram")
mint = mint or self.mintime
maxt = maxt or self.maxtime
framessel = self.sampletimes(mint, maxt,
cf.settings().value("timstof/mob_sampling", type=int))
framessel = self.sampletimes(mint, maxt, cf.settings().value(
"timstof/mob_sampling", type=int))
massintstof = self.dataset.query(
framessel, columns=('mz', 'intensity', 'inv_ion_mobility'))
goodargs = dt.argsubselect(massintstof['mz'], startm, endm)
......
......@@ -15,7 +15,8 @@ def argsubselect(array, minimum, maximum):
return args
def specttostr(augCanvas, delim=" ", names=["mass","ion_count"], units=["m/z",""], description = ""):
def specttostr(augCanvas, delim=" ", names=["mass", "ion_count"],
units=["m/z", ""], description=""):
lines = augCanvas.get_lines()
formnames = delim.join([delim.join(names) for i in range(len(lines))])
formunits = (delim).join([delim.join(units) for i in range(len(lines))])
......@@ -37,7 +38,8 @@ def clip_spectstr(augCanvas):
description = ("{}_{:.4}-{:.4}_minutes_of_the_aquisition".format(
os.path.basename(augCanvas.ds.filename),
augCanvas.ds.mintime, augCanvas.ds.maxtime))
string = specttostr(augCanvas.spectplot, delim="\t", description=description)
string = specttostr(augCanvas.spectplot, delim="\t",
description=description)
QtWidgets.QApplication.clipboard().clear()
[QtWidgets.QApplication.clipboard().setText(string, i) for i in range(2)]
......
......@@ -96,10 +96,9 @@ def treeDockWidget(actionname, cfval, update, loadfnc, parent,
dirview.setModel(fileModel)
sortorder = QtWidgets.QComboBox()
sortorder.addItems(("name","time"))
sortorder.currentIndexChanged.connect(lambda index:
fileModel.sort(index and 3, 1))
sortorder.addItems(("name", "time"))
sortorder.currentIndexChanged.connect(
lambda index: fileModel.sort(index and 3, 1))
orderlayout = QtWidgets.QHBoxLayout()
orderlayout.addStretch(1)
......
#!/usr/bin/env python3
from matplotlib.backends.backend_qt5agg import\
FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from PyQt5 import QtPrintSupport
import matplotlib
import numpy as np
import prasopes.datatools as dt
import prasopes.graphtools as gt
import prasopes.filetools as ft
import prasopes.config as cf
import os.path
import logging
matplotlib.use("Qt5Agg")
......
......@@ -43,7 +43,7 @@ def update_profile(pt, row, dataset):
spectrum.clear()
limits = []
spectra = dataset.get_spectra(-np.inf, np.inf)
for i,spectxy in enumerate(spectra):
for i, spectxy in enumerate(spectra):
massargs = drl.get_massargs(pt, row, spectxy[0])
spectrum.plot(spectxy[0], spectxy[1], ':', color='gray')
spectrum.plot(spectxy[0][massargs], spectxy[1][massargs],
......@@ -489,6 +489,7 @@ def paste_clip(ds, drls, drlspectrum):
and i < table.rowCount():
table.item(i, j).setText(col)
def paint_override(self, ds, drls, drlspectrum):
update_drlspectrum(ds, drls, self.plot)
self.plot.set_xlim(drlspectrum.get_xlim())
......@@ -640,8 +641,8 @@ def main_window(parent, augCanvas, update_signal):
drl_print.clicked.connect(lambda: print_graph(ds, drls))
drl_export.clicked.connect(lambda: export_drlspectrum(
main_widget, ds, drls))
drl_reactivity.clicked.connect(lambda: rt.main_window(parent,
augCanvas, update_signal, drls))
drl_reactivity.clicked.connect(lambda: rt.main_window(
parent, augCanvas, update_signal, drls))
drls['pt'].itemChanged.connect(lambda item: ptable_changed(
item.row(), item.column(), ds, drls, chromplot))
......
......@@ -125,7 +125,7 @@ class AugSpanSelector(SpanSelector):
class FixedScalarFormatter(matplotlib.ticker.ScalarFormatter):
def __init__(self):
super().__init__()
self._powerlimits = (0,0)
self._powerlimits = (0, 0)
def _set_format(self):
"""_set_format override"""
......@@ -243,9 +243,9 @@ def plot_subtime(augCanvas):
for i, args in enumerate(chromargs):
if len(args):
dots_x, dots_y = [augCanvas.ds.chromatograms[i][j][args]
for j in (0,1)]
for j in (0, 1)]
augCanvas.chromplot.plot(dots_x, dots_y, '.', color=(
colors[i % len(colors)]/255))
colors[i % len(colors)]/255))
augCanvas.spectplot.set_xlim(slims[0])
if not cf.settings().value("view/autozoomy", type=bool):
......@@ -308,8 +308,8 @@ def ann_spec(ms_spec, msdata, ann_limit=0.01):
"""annotate spectrum
First define the array, in which the annotation should occur.
Then remove values which are invalid as local maximas. Local maximas are then
reduced to a representation of the important ones by the sub_peaks
Then remove values which are invalid as local maximas. Local maximas are
then reduced to a representation of the important ones by the sub_peaks
function"""
def sub_peaks(peakz, hardpeaks, xrange, yrange, coef_x=15, coef_y=20):
......@@ -334,12 +334,13 @@ def ann_spec(ms_spec, msdata, ann_limit=0.01):
# Thanks to:
# https://gist.github.com/ben741/d8c70b608d96d9f7ed231086b237ba6b
minlim = ms_spec.get_ylim()[1] * ann_limit
lims = [*ms_spec.get_xlim(),*ms_spec.get_ylim()]
lims = [*ms_spec.get_xlim(), *ms_spec.get_ylim()]
maxargs = np.where((xdata[1:-1] > lims[0]) & (xdata[1:-1] < lims[1]) &
(ydata[1:-1] > minlim) & (ydata[1:-1] < lims[3]) &
(ydata[1:-1] > ydata[0:-2]) &
(ydata[1:-1] > ydata[2:]))[0] + 1
peakline = np.empty([len(maxargs)], dtype=[('x', np.float32), ('y', np.float32)])
peakline = np.empty([len(maxargs)], dtype=[('x', np.float32),
('y', np.float32)])
peakline['x'], peakline['y'] = xdata[maxargs], ydata[maxargs]
peaks.append(peakline)
......@@ -367,7 +368,8 @@ def ann_spec(ms_spec, msdata, ann_limit=0.01):
msdata['annotation'].append(peaktext)
def pop_plot(xdata, ydata, plot, plot_data, colornum=0, legend=None, annotate=True):
def pop_plot(xdata, ydata, plot, plot_data, colornum=0,
legend=None, annotate=True):
"""Define and populate plot"""
if len(xdata):
plot.plot(xdata, ydata, linewidth=1, color=(
......@@ -384,8 +386,8 @@ def pop_plot(xdata, ydata, plot, plot_data, colornum=0, legend=None, annotate=Tr
plot_data['texts'] = [plot.annotate(
a.get_text(), a.xy, picker=True, bbox=ann_bbox, in_layout=False)
for a in plot_data['texts']]
if "annotation" in plot_data and annotate == True:
ann_spec(plot, plot_data)
if "annotation" in plot_data and annotate:
ann_spec(plot, plot_data)
if "xtics" in plot_data:
plot.locator_params(nbins=plot_data["xtics"], axis='x')
plot.minorticks_on()
......@@ -456,9 +458,10 @@ def populate(augCanvas):
legend = legendize(augCanvas.ds.headers[i], augCanvas)
else:
legend = None
pop_plot(msxy[i][0], msxy[i][1], augCanvas.spectplot, augCanvas.ms, i, legend)
pop_plot(msxy[i][0], msxy[i][1], augCanvas.spectplot,
augCanvas.ms, i, legend)
pop_plot(chromxy[i][0], chromxy[i][1], augCanvas.chromplot,
augCanvas.chrom, i, legend)
augCanvas.chrom, i, legend)
for ax in (augCanvas.spectplot, augCanvas.chromplot):
if augCanvas.ds.headers:
ax.legend(loc=2)
......
......@@ -6,9 +6,9 @@ from io import BytesIO
from PyQt5 import QtGui
from PyQt5 import QtPrintSupport
from PyQt5 import QtWidgets
import prasopes.graphtools as gt
import prasopes.config as cf
class ImagePainter:
"""base class for painting image into cache"""
def __init__(self, configname, painttarget=None):
......
......@@ -4,8 +4,6 @@ from matplotlib.backends.backend_qt5agg import\
from matplotlib.figure import Figure
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from io import BytesIO
import matplotlib
import numpy as np
import prasopes.datatools as dt
......@@ -37,7 +35,8 @@ class reactivityParam(QtWidgets.QHBoxLayout):
logger.debug("Getting "+par)
return settings.value(par, type=type)
def setconfval(x, name=self.valname, parselect=parselect, tabber=tabber):
def setconfval(x, name=self.valname,
parselect=parselect, tabber=tabber):
ind = -1 if tabber.currentIndex() else parselect.currentIndex()
par = "reactivity/{}_par{}".format(name, ind)
logger.debug("Setting "+par)
......@@ -97,7 +96,7 @@ def export_dial(augCanvas, drls, grph, labels, parselect):
names = ["pressure", "rel._intensity"]
units = ["mTorr", ""]
description = os.path.basename(augCanvas.ds.filename) + " " +\
" -- ".join([line._label for line in grph.get_lines()])
" -- ".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
......@@ -170,7 +169,7 @@ def pop_dial(augCanvas, drls, graph, labels, parselect):
params[i][parselect.currentIndex()])-coef1)*coef2)
lastpos = i
elif float(params[i][0]) > time and i > 0:
# i>0 condition to handle possibility of invalid first scan.
# i>0 condition to handle invalid first scan.
# (was observed in-wild on TSQ once)
break
if len(toavg) != 0:
......@@ -197,7 +196,7 @@ def pop_dial(augCanvas, drls, graph, labels, parselect):
linestyle="None")
else:
transheads = headers.T
hdrindex = min(getconfval("headerindex", int),len(headers.T)-1)
hdrindex = min(getconfval("headerindex", int), len(headers.T)-1)
graph.plot(transheads[hdrindex], relint,
label=label, color=(transcolors[
colorargs[i] % len(transcolors)] / 255), marker=".",
......@@ -267,14 +266,16 @@ def main_window(parent, augCanvas, update_signal, drls):
formula = QtWidgets.QLabel(
"Formula for the x-axis: (Parameter - a) * b")
xannlayout = reactivityParam(parselect, tabber, str, "xlabel", "x axis label:")
xannlayout = reactivityParam(parselect, tabber, str,
"xlabel", "x axis label:")
xannlayout.addStretch()
figann = reactivityParam(parselect, tabber, str, "figann", "Figure annotation:")
translayout = reactivityParam(
parselect, tabber, int, "transparency", "Transparency (0-255): ", 0, 255)
figann = reactivityParam(parselect, tabber, str,
"figann", "Figure annotation:")
translayout = reactivityParam(parselect, tabber, int, "transparency",
"Transparency (0-255): ", 0, 255)
translayout.addStretch()
labelloclayout = reactivityParam(
parselect, tabber, int, "labelloc", "Label location (0-10): ", 0, 10)
parselect, tabber, int, "labelloc", "Label location (0-10): ", 0, 10)
layouts = [xannlayout, figann, translayout, labelloclayout]
layouts.append(reactivityParam(
parselect, tabber, int, "showlabel", "Show Label? (0-1): ", 0, 1))
......@@ -302,7 +303,8 @@ def main_window(parent, augCanvas, update_signal, drls):
tabber.addTab(parselect_widget, "Parameter")
tabber.addTab(headerselect, "Header")
tabber.setCurrentIndex(settings.value("reactivity/activetab", type=int))
tabber.currentChanged.connect(lambda index: tab_changed(lambda: update_fnc(), index))
tabber.currentChanged.connect(
lambda index: tab_changed(lambda: update_fnc(), index))
dial_layout = QtWidgets.QVBoxLayout(dial_widget)
dial_layout.addWidget(graph_canvas, stretch=1)
......
......@@ -2,7 +2,6 @@
from matplotlib.backends.backend_qt5agg import\
FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5 import QtGui
import matplotlib
......@@ -39,8 +38,9 @@ def update_profile(table, row, dataset):
spectrum = table.cellWidget(row, 5).figure.get_axes()[0]
spectrum.clear()
limits = []
spectra = dataset.get_spectra(*[drl.floatize(table, row, i) for i in (1,2)])
for i,spectxy in enumerate(spectra):
spectra = dataset.get_spectra(*[drl.floatize(table, row, i)
for i in (1, 2)])
for i, spectxy in enumerate(spectra):
massargs = get_massargs(table, row, spectxy[0])
spectrum.plot(spectxy[0], spectxy[1], ':', color='gray')
spectrum.plot(spectxy[0][massargs], spectxy[1][massargs],
......@@ -57,7 +57,7 @@ def update_profile(table, row, dataset):
def ionstable_changed(row, col, ds, table):
if col in (1,2,3,4):
if col in (1, 2, 3, 4):
update_profile(table, row, ds)
table.blockSignals(True)
table.item(row, 0).setBackground(QtGui.QBrush(
......@@ -70,15 +70,15 @@ def pop_dial(augCanvas, dialspect, ionstable, labels):
dialspect.clear()
gt.pop_plot([], [], dialspect, labels)
for row in range(ionstable.rowCount()):
name = ionstable.item(row, 0).text()
startm = drl.floatize(ionstable, row, 3)\
- (drl.floatize(ionstable, row, 4) / 2)
endm = drl.floatize(ionstable, row, 3)\
+ (drl.floatize(ionstable, row, 4) / 2)
[tstart, tend] = [drl.floatize(ionstable, row, i) for i in (1,2)]
spectrum = ds.get_mobilogram(startm, endm, tstart, tend)
dialspect.plot(spectrum[0], spectrum[1], label=name,
color=(gt.colors[row % len(gt.colors)] / 255))
name = ionstable.item(row, 0).text()
startm = drl.floatize(ionstable, row, 3)\
- (drl.floatize(ionstable, row, 4) / 2)
endm = drl.floatize(ionstable, row, 3)\
+ (drl.floatize(ionstable, row, 4) / 2)
[tstart, tend] = [drl.floatize(ionstable, row, i) for i in (1, 2)]
spectrum = ds.get_mobilogram(startm, endm, tstart, tend)
dialspect.plot(spectrum[0], spectrum[1], label=name,
color=(gt.colors[row % len(gt.colors)] / 255))
if ionstable.rowCount():
dialspect.autoscale(True)
dialspect.legend(loc=2)
......@@ -98,7 +98,7 @@ def add_row(ds, dialspect, ionstable):
ionstable.setItem(newrow, i, QtWidgets.QTableWidgetItem())
if newrow != 0:
val = drl.floatize(ionstable, newrow-1, i)
if i not in (1,2,4):
if i not in (1, 2, 4):
val = val+1
ionstable.item(newrow, i).setText(str(val))
......@@ -137,7 +137,7 @@ def export_dial(augCanvas, grph):
names = ["time", "intensity"]
units = ["sec??", ""]
description = os.path.basename(augCanvas.ds.filename) + " " +\
" -- ".join([line._label for line in grph.get_lines()])
" -- ".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
......@@ -170,12 +170,12 @@ def main_window(parent, augCanvas, update_signal):
graph_canvas = FigureCanvas(dial_graph)
graph_canvas.setStyleSheet("background-color:transparent;")
graph_canvas.setAutoFillBackground(False)
gt.zoom_factory(dialspect, 1.15, reactlabels)
gt.pan_factory(dialspect, reactlabels)
ionstable = dt.table(["Name", "Start time (min)", "End time (min)",
"Mass (m/z)", "Peak width", "Profile"])
"Mass (m/z)", "Peak width", "Profile"])
else:
ionstable = cache[0]
graph_canvas = cache[1]
......
......@@ -6,7 +6,6 @@ from PyQt5 import QtGui
from PyQt5 import QtWidgets
from PyQt5 import QtPrintSupport
from prasopes.zcetools_help import helpstr
from io import BytesIO
import numpy as np
import prasopes.graphtools as gt
import prasopes.filetools as ft
......@@ -129,7 +128,8 @@ def key_pressed(event, ds, coff, coffgrad):
if event.key() == QtCore.Qt.Key_C:
if event.modifiers().__int__() == QtCore.Qt.ControlModifier:
painter = imgt.ImagePainter("zcespec")
painter.popfig = lambda: paint_override(painter, ds, coff, coffgrad)
painter.popfig = lambda: paint_override(
painter, ds, coff, coffgrad)
painter.clip()