Commit 026f80ce authored by Yan's avatar Yan
Browse files

Minor fixes, TSQ zce for negative ions

* zcetools now support negative ions
* fixed glitches in annotation
parent 4e944fed
......@@ -66,6 +66,7 @@ def print_graph(data_set, mass_spec, chrom_spec, spect, fn):
painter.drawImage(QtCore.QPoint(0,0), img)
painter.end()
printfig = Figure(figsize=(10, 4), dpi=300)
canvas = FigureCanvas(printfig)
printplot = printfig.add_subplot(111)
printplot.set_xlim(spect.get_xlim())
printplot.set_ylim(spect.get_ylim())
......
......@@ -49,12 +49,12 @@ def pan_factory(axis, plot=None):
if event.dblclick and event.inaxes == ax:
ax.get_figure()
ax.autoscale(True)
if type(pd) is dict and "annotation" in pd:
ann_spec(ax, pd)
ymin = -0.01
if type(pd) is dict and "c_ymin" in pd:
ymin = pd['c_ymin']
ax.set_ylim(ax.get_ylim()[1]*ymin, ax.get_ylim()[1]*1.1)
if type(pd) is dict and "annotation" in pd:
ann_spec(ax, pd)
ax.figure.canvas.draw()
# otherwise pan
elif event.button == 1 and event.inaxes == ax:
......@@ -189,8 +189,8 @@ def ann_spec(ms_spec, msdata, ann_limit=0.01):
def sub_peaks(peakz, xrange, yrange, coef_x=10, coef_y=10):
"""Returns reasonable subselection of local maximas"""
sort_peaks = np.sort(np.array(peakz, dtype=[
('x', float),('y', float)]), order='y')[::-1]
sort_peaks = np.flipud(np.sort(np.array(peakz, dtype=[
('x', float),('y', float)]), order='y')).copy()
red_x = xrange / coef_x
red_y = yrange / coef_y
big_peaks = np.array([], dtype=[('x', float),('y', float)])
......@@ -288,6 +288,7 @@ def populate(mpl_chromatogram, mpl_spectrum, data_set,
spect['x'], spect['y'] = [i[1][k[0]][k[1]::2] for k in
(('x',j),('y',j))]
pop_plot(i[0], spect)
autozoomy(mpl_spectrum)
else:
pop_plot(*i)
mpl_chromatogram.figure.canvas.draw()
......@@ -28,7 +28,10 @@ def pop_dial(zcespec, gradspect, data_set, coff_d, grad_d,
coff_d['x'] = data_set['masses'] - 196
coff_d['y'] = np.mean(data_set['matrix'], axis=0)
grad_d['x'] = coff_d['x']
grad_d['y'] = -np.gradient(coff_d['y'])
halfl = int(len(grad_d['x'])/2)
grad_d['y'] = -np.gradient(coff_d['y'])\
if np.sum(coff_d['y'][:halfl]) > np.sum(coff_d['y'][halfl:])\
else np.gradient(coff_d['y'])
gradspect.axhline(0, color="#FF000088", linestyle=":")
zcespec.axhline(0, color="#0000FF88", linestyle=":")
gt.pop_plot(zcespec, coff_d)
......
......@@ -6,7 +6,6 @@ Acquiring DAC spectrum:
Limitations:
* The program does not perform any sanity check, be careful and know what you're doing
* The program expects to get an TSQ DAC as an imput and expects, that minimal value of that concrete DAC is -196.
* The program expects positive-ion mode. Code for the manual switch to negative-ions will be provided on-demand.
* You tell me.
Notes:
......
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