Commit 19e56f2e authored by Yan's avatar Yan
Browse files

stretched long lines

parent f5253e0b
......@@ -63,8 +63,9 @@ def pan_factory(axis, plot=None, an=None):
elif event.button == 1 and event.inaxes == ax:
ax.start_pan(event.x, event.y, event.button)
id_drag = fig.canvas.mpl_connect('motion_notify_event', lambda action: drag_fun(action, ax))
id_release = fig.canvas.mpl_connect('button_release_event',
lambda action: drag_end(action, id_drag, id_release, plot, an, ax))
id_release = fig.canvas.mpl_connect(
'button_release_event', lambda action: drag_end(
action, id_drag, id_release, plot, an, ax))
def drag_fun(event, ax):
ax.drag_pan(1, 'x', event.x, event.y)
......@@ -109,7 +110,8 @@ def populate(mpl_chromatogram, mpl_spectrum, data_set, time_sel, an, ms_s):
an.clear()
def update_span_selector(chrom, spec, d_set, ms_spec):
time_selector = SpanSelector(chrom,
lambda x_min, x_max: pick_times(x_min, x_max, spec, d_set, chrom, an, ms_spec),
lambda x_min, x_max: pick_times(
x_min, x_max,spec, d_set, chrom, an, ms_spec),
'horizontal',
useblit=True,
rectprops=dict(alpha=0.15, facecolor='purple'),
......@@ -189,7 +191,9 @@ def chrom_plot(chrom, times, tic):
chrom.ticklabel_format(scilimits=(0, 0), axis='y')
def open_file(chrom, spc, d_set, time_sel, an, ms_s):
filename=QtWidgets.QFileDialog.getOpenFileName(caption = "Open spectrum", filter="Finnigan RAW files (*.raw, *.RAW)")[0]
filename=QtWidgets.QFileDialog.getOpenFileName(
caption = "Open spectrum",
filter="Finnigan RAW files (*.raw, *.RAW)")[0]
if filename is '':
return
d_set['chrom_dat'], d_set['masses'], d_set['matrix'] = load_raw(filename)
......@@ -225,14 +229,19 @@ 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 x_min, x_max: pick_masses(x_min, x_max, spectrum, annotation, ms), 'horizontal', useblit=True, rectprops=dict(alpha=0.15, facecolor='purple'), button=3)
mass_selector = SpanSelector(
spectrum, lambda x_min, x_max: pick_masses(x_min, x_max, 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: open_file(chromatogram, spectrum, ds, timeSelector, annotation, ms), QtCore.Qt.CTRL + QtCore.Qt.Key_O)
file_menu.addAction('&Open..',
lambda: open_file(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