Commit 20fb193a authored by 3Yan's avatar 3Yan
Browse files

Reactivity minor fix, hardening

* Empty parameters array handling routine to prevent crash.
parent da91f65b
......@@ -18,7 +18,7 @@ import logging
logger = logging.getLogger('drlLogger')
logger = logging.getLogger('reactivityLogger')
def update_parselect(augCanvas, parselect):
index = parselect.currentIndex()
......@@ -53,10 +53,18 @@ def pop_dial(augCanvas, drls, graph, labels, parselect, coef1, coef2):
lastpos = i
elif float(params[i][0]) > time:
elif float(params[i][0]) > time and i > 0:
# i>0 condition to handle possibility of invalid first scan.
# (was observed in-wild on TSQ once)
if len(toavg) != 0:
pressures.append([time, np.average(toavg)])
if len(pressures) == 0:
QtWidgets.QMessageBox.critical(None, "No times loaded",
"Did not located any valid parameters.\n"
"It is either start of the acquisition,\n"
"or the timestamps has been corrupted.")
nptpressures = np.asarray(pressures).T[0]
goodtimes = np.where([t in nptpressures for t in times])
for i in range(1,len(intensities)):
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