Commit d96495d8 authored by Yan's avatar Yan
Browse files

Fix time select, separate DRL, export (1/2).

parent 26dd2ab0
......@@ -107,6 +107,23 @@ def pick_times(x_min, x_max, mpl_spectrum, data_set, mpl_chromatogram,
start_scan = i
if times > x_max and end_scan is None:
end_scan = i
if start_scan == end_scan:
if start_scan == 0:
end_scan=1
elif start_scan == None:
end_scan=len(data_set['chrom_dat'][0, :])
start_scan=end_scan-1
else:
time=(x_min+x_max)/2
d1 = time - data_set['chrom_dat'][0,start_scan-1]
d2 = data_set['chrom_dat'][0,start_scan] - time
if d1 < d2:
start_scan -=1
elif d1 > d2:
end_scan +=1
else:
start_scan -=1
end_scan = start_scan + 2
mpl_spectrum.clear()
annotations.clear()
mass_spect['x'] = data_set['masses']
......@@ -231,6 +248,14 @@ def open_file(chrom, spc, d_set, time_sel, an, ms_s):
= load_raw(filename)
populate(chrom, spc, d_set, time_sel, an, ms_s)
def export():
"""exports the chromatogram into the .dat file format"""
filename=QtWidgets.QFileDialog.getSaveFileName(
caption = "Export spectrum",
filter="dat table format (*.dat)")[0]
if filename is '':
return
if __name__=="__main__":
#ds for data_set
......@@ -277,11 +302,11 @@ if __name__=="__main__":
lambda: open_file(chromatogram, spectrum, ds, timeSelector,
annotation, ms),
QtCore.Qt.CTRL + QtCore.Qt.Key_O)
file_menu.addAction('&Export..', lambda: export(),
QtCore.Qt.CTRL + QtCore.Qt.Key_E)
file_menu.addAction('&Quit', main_window.close,
QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
tools_menu = QtWidgets.QMenu('&Tools', main_window)
main_window.menuBar().addMenu(tools_menu)
tools_menu.addAction('&DRL..', lambda: print("hello"))
main_widget = QtWidgets.QWidget(main_window)
main_window.setCentralWidget(main_widget)
......
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