Commit 08eb1dd2 authored by Yan's avatar Yan
Browse files

DRL upgrade

* daughter ion table is more responsive
* we are not dividing by zero anymore (at least I hope)
parent 4ef33003
......@@ -68,9 +68,10 @@ def get_intensity(row, ds, drls):
startm = floatize(drls['pt'], row, 1)
endm = floatize(drls['pt'], row, 2)
massargs = dt.argsubselect(ds['masses'], startm, endm)
nonzero_tic = list(map(lambda x: max(x, 1), ds['chrom_dat'][1]))
intensity = (np.sum(
ds['matrix'].T[massargs].T, axis=1)) / nonzero_tic
#prevent division by 0
intensity = np.divide(np.sum( ds['matrix'].T[massargs].T, axis=1),
np.clip(ds['chrom_dat'][1], np.nextafter(
0, 1, dtype=np.float32), None))
return intensity
......@@ -150,7 +151,10 @@ def update_drlspectrum(ds, drls, drlspectrum):
label = " {}".format(drls['pt'].item(row, 0).text())
intensity = intensities[i]
if drls['rel'].checkState() == 2:
intensity = intensity / np.sum(intensities, 0)
#Do not divide by 0
intensity = np.divide(intensity, np.clip(np.sum(
intensities, 0), np.nextafter(
0, 1, dtype=np.float32), None))
drlspectrum.plot(times, intensity, label=label,
color=(colors[row % len(colors)] / 255))
i += 1
......@@ -207,19 +211,20 @@ def ptable_changed(row, column, ds, drls, drlspectrum):
def dtable_changed(row, column, ds, drls, drlspectrum):
"""routine called by change of the dtable spectra"""
logger.info("Change in the daughter ion table detected")
#TODO: multiple corrections not incorporated!!!
if drls['dt'].cellWidget(row, 0).checkState() == 2:
if (column == 0)\
or (column == 2
and drls['dt'].cellWidget(row, 1).currentIndex() != 0):
update_drlspectrum(ds, drls, drlspectrum)
if (column == 0) or (column % 2 == 0 and drls['dt'].cellWidget(
row, column-1).currentIndex() != 0):
update_drlspectrum(ds, drls, drlspectrum)
def corr_changed(row, ds, drls, drlspectrum):
"""routine called by change of correction for ion"""
logger.info('''Change of the "correct to" detected''')
#TODO: multiple corrections not incorporated!!!
if (drls['dt'].cellWidget(row, 0).checkState() == 2
and floatize(drls['dt'], row, 2) != 0):
and floatize(drls['dt'], row, 2, False) != 0):
update_drlspectrum(ds, drls, drlspectrum)
......
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