Commit 967c266c authored by 3Yan's avatar 3Yan
Browse files

DRL - improved stability

* better algorithm to detect incompatible files when loading DRL table
* fixed bug which caused crashes when increasing columncount
* reduced workload when descreasing columncount
parent d6d89659
......@@ -243,6 +243,7 @@ def corcount_changed(ds, drls, drlspectrum):
if diff == 0:
return
elif diff > 0:
drls['dt'].blockSignals(True)
drls['dt'].setColumnCount(1 + (drls['cors'].value() * 2))
newcors = []
for col in range(drls['dt'].columnCount() - (diff * 2),
......@@ -262,8 +263,11 @@ def corcount_changed(ds, drls, drlspectrum):
dcolums.append("corrected for ({})".format(i+1))
dcolums.append("factor ({})".format(i+1))
drls['dt'].setHorizontalHeaderLabels(dcolums)
drls['dt'].blockSignals(False)
else:
drls['dt'].blockSignals(True)
drls['dt'].setColumnCount(1 + (drls['cors'].value() * 2))
drls['dt'].blockSignals(False)
update_drlspectrum(ds, drls, drlspectrum)
......@@ -387,13 +391,14 @@ def load_drltables(parent, dataset, drls, drlspectrum):
for i in range(1, len(rawdata)):
rawline = rawdata[i].split(",")
n = len(rawline)
if n < 6 or not n % 2 == 0 or (int(rawline[3]) not in
range(3)) or not (set(map(int, rawline[4:n:2])) &
set(range(-1, n))):
if n < 6 or not n % 2 == 0 or (rawline[3] not in map(
str,range(3))) or not (set(map(int, rawline[4:n:2]))
& set(range(-1, n))):
QtWidgets.QMessageBox.warning(
parent, "Load DRL config tables",
"Config file corrupted on line {},"
" cancelling request".format(i+1))
"Wrong or corrupted config file.\n"
"Error encountered on line {}.\n"
"Cancelling request.".format(i+1))
return
for j, k in enumerate((names, masses, peak_widths,
states, *corrections)):
......
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