...
 
Commits (4)
......@@ -13,7 +13,7 @@ from . import zcetools_help
from . import reactivitytools
__version__ = "0.0.2200"
__version__ = "0.0.21"
__all__ = ['config', 'datatools', 'docks', 'drltools', 'drltoos_gui', 'filetools',
......
......@@ -44,6 +44,13 @@ class QStatusBarLogger(logging.Handler):
self.trigger.signal.emit()
def show_exception_and_exit(exc_type, exc_value, tb):
import traceback
traceback.print_exception(exc_type, exc_value, tb)
raw_input("Press key to exit.")
sys.exit(-1)
def load_file(parent, augCanvas, update, settings, loadthread, filename=None):
"""populates dataset and plots it"""
directory = augCanvas.filename or settings.value("open_folder")
......@@ -243,6 +250,9 @@ def about(parent):
def main():
# thx to: https://stackoverflow.com/questions/779675/stop-python-from-closing-on-error/781074#781074
sys.excepthook = show_exception_and_exit
app = QtWidgets.QApplication(sys.argv)
loadthread = QtCore.QThread()
......
......@@ -18,7 +18,7 @@ import logging
matplotlib.use("Qt5Agg")
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):
toavg.append((float(params[i][parselect.currentIndex()])
-coef1.value())*coef2.value())
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)
break
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.")
return
nptpressures = np.asarray(pressures).T[0]
goodtimes = np.where([t in nptpressures for t in times])
for i in range(1,len(intensities)):
......