Commit 699288f5 authored by Yan's avatar Yan
Browse files

DRLMOB - save/load table routine fixed

parent 4b810153
......@@ -14,7 +14,7 @@ from . import zcetools_help
from . import reactivitytools
__version__ = "0.0.46"
__version__ = "0.0.47"
__all__ = ['config', 'datatools', 'docks', 'drltools', 'datasets',
......
......@@ -329,6 +329,8 @@ def load_drltables(parent, dataset, drls, drlspectrum):
if filename != '':
names = []
masses = []
mobs = []
mob_widths=[]
peak_widths = []
states = []
corrections = []
......@@ -340,8 +342,8 @@ def load_drltables(parent, dataset, drls, drlspectrum):
for i in range(1, len(rawdata)):
rawline = rawdata[i].split(",")
n = len(rawline)
if n < 4 or not n % 2 == 0 or (rawline[3] not in map(
str, range(3))) or not (set(map(int, rawline[4:n:2]))
if n < 6 or not n % 2 == 0 or (rawline[5] not in map(
str, range(3))) or not (set(map(int, rawline[6:n:2]))
& set(range(-1, n)) or (n == 4)):
QtWidgets.QMessageBox.warning(
parent, "Load DRL config tables",
......@@ -349,8 +351,8 @@ def load_drltables(parent, dataset, drls, drlspectrum):
"Error encountered on line {}.\n"
"Cancelling request.".format(i+1))
return
for j, k in enumerate((names, masses, peak_widths,
states, *corrections)):
for j, k in enumerate((names, masses, peak_widths, mobs,
mob_widths, states, *corrections)):
if len(rawline) > j:
k.append(rawline[j])
for row in reversed(range(drls['pt'].rowCount())):
......@@ -362,10 +364,12 @@ def load_drltables(parent, dataset, drls, drlspectrum):
drls['pt'].item(i, 0).setText(names[i])
drls['pt'].item(i, 1).setText(masses[i])
drls['pt'].item(i, 2).setText(peak_widths[i])
drls['pt'].item(i, 4).setText(mobs[i])
drls['pt'].item(i, 5).setText(mob_widths[i])
# and after that the daughter table
drls['cors'].setValue(int((len(corrections) / 2)))
for i in range(len(names)):
for j in range(int((len(rawline)-4)/2)):
for j in range(int((len(rawline)-6)/2)):
drls['dt'].cellWidget(i, 1+j*2).setCurrentIndex(
int(corrections[0+j*2][i]))
drls['dt'].item(i, 2+j*2).setText(corrections[1+j*2][i])
......@@ -389,7 +393,7 @@ def save_drlconfig(drls, parent, exp_f_name=None):
"{}\n".format(cortext))
for row in range(drls['pt'].rowCount()):
vals = []
for i in range(3):
for i in (0,1,2,4,5):
vals.append(drls['pt'].item(row, i).text())
vals.append(drls['dt'].cellWidget(row, 0).checkState())
for i in range(drls['cors'].value()):
......
Markdown is supported
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