Commit 95f1bff0 authored by Yan's avatar Yan
Browse files

Fixed correct-to, improved drl stability

parent 171f0ff3
......@@ -44,6 +44,7 @@ def update_profile(start, end, spectrum, dataset):
spectrum.set_ylim(ymax*-0.1, ymax*1.2)
spectrum.figure.canvas.draw()
def get_daughterset(ptable, dtable, ds):
names = []
times = ds['chrom_dat'][0,:]
......@@ -62,10 +63,10 @@ def get_daughterset(ptable, dtable, ds):
startm = dt.floatize(ptable.cellWidget(cor,1).text())
endm = dt.floatize(ptable.cellWidget(cor,2).text())
massargs = dt.argsubselect(ds['masses'], startm, endm)
corrections = ((np.sum(
correction = ((np.sum(
ds['matrix'].T[massargs].T, axis=1))\
/ ds['chrom_dat'][1]) * factor
itensity = intensities - corrections
/ ds['chrom_dat'][1]) * factor
intensity = intensity - correction
intensities.append(intensity)
names.append(dtable.item(row,1).text())
return names, times, intensities
......@@ -86,17 +87,19 @@ def update_drlspectrum(ptable, dtable, ds, drlspectrum):
bottom=np.amax(intensities)*-0.01)
drlspectrum.figure.canvas.draw()
def getTableItemList(ptable):
ion_list = []
for i in range(ptable.rowCount()):
if type(ptable.cellWidget(i, 0)) is not type(None):
name = ptable.cellWidget(i, 0).text()
else:
name = ""
text = "{} ({}-{})".format(
name, (ptable.cellWidget(i, 1).text()),
(ptable.cellWidget(i, 2).text()))
ion_list.append(text)
for row in range(ptable.rowCount()):
text = []
for i in range(3):
if type(ptable.cellWidget(row, i)) is not type(None):
frg = ptable.cellWidget(row, i).text()
else:
frg = ""
text.append(frg)
line = "{} ({}-{})".format(*text)
ion_list.append(line)
return ion_list
......@@ -116,15 +119,14 @@ def update_drl(start_mz, end_mz, spectrum, dataset, pname, dname,
start_mz.setText(str(start))
end_mz.setText(str(end))
dname.setText("{} ({:.2f}-{:.2f})".format(
pname.text(), start, end))
for i in (range(dtable.rowCount())):
index = dtable.cellWidget(i,2).currentIndex()
dtable.cellWidget(i,2).clear()
dtable.cellWidget(i,2).addItem("")
dtable.cellWidget(i,2).addItems(getTableItemList(ptable))
dtable.cellWidget(i,2).setCurrentIndex(index)
ptnames = getTableItemList(ptable)
for row in range(dtable.rowCount()):
dtable.item(row,1).setText(ptnames[row])
index = dtable.cellWidget(row,2).currentIndex()
dtable.cellWidget(row,2).clear()
dtable.cellWidget(row,2).addItem("")
dtable.cellWidget(row,2).addItems(getTableItemList(ptable))
dtable.cellWidget(row,2).setCurrentIndex(index)
update_profile(start, end, spectrum, dataset)
update_drlspectrum(ptable, dtable, dataset, drlspectrum)
......@@ -236,6 +238,18 @@ def iontable(labels, exp_col):
return table
def load_drlconfig(ptable, dtable):
#will be substituted with something that can vwork in future
if 0 == 1:
for row in reversed(range(ptable.rowCount())):
dtable.removeRow(row)
ptable.removeRow(row)
def save_drlconfig(ptable, dtable):
print("hello")
def dialog(parent, ds, filename, mass_selector, spectrum, cache):
"""constructs a dialog window"""
......@@ -287,6 +301,8 @@ def dialog(parent, ds, filename, mass_selector, spectrum, cache):
btn_add.clicked.connect(lambda: add_line(
dial_widget, mass_selector, spectrum, ds, pt, dt, chromplot))
btn_rem.clicked.connect(lambda: remove_rows(pt,dt))
drl_load.clicked.connect(lambda: load_drlconfig(pt, dt))
drl_save.clicked.connect(lambda: save_drlconfig(pt, dt))
dial_widget.finished.connect(lambda: savecache(cache, pt, dt, graph_canvas))
main_layout = QtWidgets.QVBoxLayout(dial_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