Commit 6d5f7e79 authored by Yan's avatar Yan
Browse files

minor fixes in stylistics

zoom selection by right button in mass spectrum
parent 295314ba
......@@ -80,6 +80,10 @@ def pan_factory(ax, plot=None, an=None):
fig = ax.get_figure()
fig.canvas.mpl_connect('button_press_event', pan_fun)
def pick_masses(xmin, xmax, ax, an, plot):
ax.set_xlim(xmin,xmax)
annSpectr(spectrum, plot['x'], plot['y'], an)
ax.figure.canvas.draw()
def picktimes(xmin, xmax, mplspectrum, dataset, mplchromatogram, an, ms_s):
start_scan = 0
......@@ -132,7 +136,6 @@ def annSpectr(spectrum,mass,intensity,an):
end = np.argmax(mass>borders[1])
if end == 0:
end = np.argmax(mass)
#peaks = find_peaks(intensity, height=spectrum.get_ylim()[1]/100)
peaks = find_peaks(intensity[start:end], height=spectrum.get_ylim()[1]/100)
peaks = peaks[0] + start
sp = sub_peaks(peaks,mass,intensity,spectrum.get_xlim()[1]-spectrum.get_xlim()[0],spectrum.get_ylim()[1]-spectrum.get_ylim()[0])
......@@ -198,13 +201,14 @@ if __name__=="__main__":
zoom_factory(chromatogram, 1.15)
pan_factory(spectrum, ms, annotation)
zoom_factory(spectrum, 1.15, ms, annotation)
mass_selector = SpanSelector(spectrum, lambda xmin, xmax: pick_masses(xmin, xmax, spectrum, annotation, ms), 'horizontal', useblit=True, rectprops=dict(alpha=0.15, facecolor='purple'),button=3)
app = QtWidgets.QApplication(sys.argv)
main_window = QtWidgets.QMainWindow()
file_menu = QtWidgets.QMenu('&File',main_window)
main_window.menuBar().addMenu(file_menu)
file_menu.addAction('&Open..', lambda: openFile(chromatogram,spectrum, ds, timeSelector,annotation, ms), QtCore.Qt.CTRL + QtCore.Qt.Key_O)
file_menu.addAction('&Open..', lambda: openFile(chromatogram,spectrum, ds, timeSelector, annotation, ms), QtCore.Qt.CTRL + QtCore.Qt.Key_O)
file_menu.addAction('&Quit', main_window.close, QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
main_widget = QtWidgets.QWidget(main_window)
......
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