Commit 4ef33003 authored by Yan's avatar Yan
Browse files

DRL now allows factors lower than 0

parent 48f653ec
......@@ -26,12 +26,13 @@ class HBar(QtWidgets.QFrame):
self.setFrameShape(QtWidgets.QFrame.HLine)
def floatize(table, row, column):
def floatize(table, row, column, nonneg=True):
"""grabs the tableWidgetItem and transforms its text safely to
float, if the text is not acceptable as float, returns zero"""
imptext = table.item(row, column).text()
validator = QtGui.QDoubleValidator()
validator.setBottom(0)
if nonneg == True:
validator.setBottom(0)
status = validator.validate(imptext, 0)[0]
if status == QtGui.QValidator.Acceptable:
outfloat = float(imptext)
......@@ -74,6 +75,8 @@ def get_intensity(row, ds, drls):
def get_daughterset(ds, drls):
"""Fuction to acquire the curves of the daugher ions"""
logger.info("getting set of the daughter ions")
# TODO: write a less resources demanding function - probably "per-line"
names = []
times = ds['chrom_dat'][0, :] - drls['tshift'].value()
......@@ -85,7 +88,7 @@ def get_daughterset(ds, drls):
for i in range(drls['cors']):
cor = drls['dt'].cellWidget(row, 1+i*2).currentIndex() - 1
if cor not in (-2, -1):
factor = floatize(drls['dt'], row, 2+i*2)
factor = floatize(drls['dt'], row, 2+i*2, False)
correction = get_intensity(cor, ds, drls) * factor
intensity = intensity - correction
corlist.append("{} * {}".format(
......
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