Commit e9f135f1 authored by 3Yan's avatar 3Yan
Browse files

Reactivity - annotation

* angewandte style
parent 7865a269
...@@ -13,7 +13,7 @@ from . import zcetools_help ...@@ -13,7 +13,7 @@ from . import zcetools_help
from . import reactivitytools from . import reactivitytools
__version__ = "0.0.29" __version__ = "0.0.30"
__all__ = ['config', 'datatools', 'docks', 'drltools', 'drltoos_gui', 'filetools', __all__ = ['config', 'datatools', 'docks', 'drltools', 'drltoos_gui', 'filetools',
......
...@@ -127,16 +127,13 @@ def pop_dial(augCanvas, drls, graph, labels, parselect): ...@@ -127,16 +127,13 @@ def pop_dial(augCanvas, drls, graph, labels, parselect):
# Do not do anything when data set is not populated # Do not do anything when data set is not populated
if len(augCanvas.ds) == 0: if len(augCanvas.ds) == 0:
return return
parint = parselect.currentIndex()
coef1 = settings.value( def getconfval(name, type, parselect=parselect):
"reactivity/coef_a_par{}".format(parint), type=float) par = "reactivity/{}_par{}".format(name, parselect.currentIndex())
coef2 = settings.value( logger.debug("Getting "+par)
"reactivity/coef_b_par{}".format(parint), type=float) return settings.value(par, type=type)
markersize = settings.value(
"reactivity/markersize_par{}".format(parint), type=float)
showlabel = settings.value(
"reactivity/showlabel_par{}".format(parint), type=int)
graph.clear() graph.clear()
labels['xlabel'] = getconfval("xlabel", str)
gt.pop_plot([0], [0], graph, labels) gt.pop_plot([0], [0], graph, labels)
names, times, intensities = drl.get_daughterset(augCanvas.ds, drls) names, times, intensities = drl.get_daughterset(augCanvas.ds, drls)
colorargs = [row for row in range(drls['dt'].rowCount()) colorargs = [row for row in range(drls['dt'].rowCount())
...@@ -156,6 +153,8 @@ def pop_dial(augCanvas, drls, graph, labels, parselect): ...@@ -156,6 +153,8 @@ def pop_dial(augCanvas, drls, graph, labels, parselect):
pressures = [] pressures = []
lastpos = 0 lastpos = 0
coef1 = getconfval("coef_a", float)
coef2 = getconfval("coef_b", float)
for time in times: for time in times:
toavg = [] toavg = []
for i in range(lastpos, parlen): for i in range(lastpos, parlen):
...@@ -178,8 +177,7 @@ def pop_dial(augCanvas, drls, graph, labels, parselect): ...@@ -178,8 +177,7 @@ def pop_dial(augCanvas, drls, graph, labels, parselect):
return return
nptpressures = np.asarray(pressures).T[0] nptpressures = np.asarray(pressures).T[0]
goodtimes = np.where([t in nptpressures for t in times]) goodtimes = np.where([t in nptpressures for t in times])
alpha = settings.value("reactivity/transparency_par{}".format( alpha = getconfval("transparency", float)
parint), type=int)
transcolors = [np.append(i, alpha) for i in gt.colors] transcolors = [np.append(i, alpha) for i in gt.colors]
for i in range(1, len(intensities)): for i in range(1, len(intensities)):
label = drls['pt'].item(colorargs[i], 0).text() label = drls['pt'].item(colorargs[i], 0).text()
...@@ -189,11 +187,13 @@ def pop_dial(augCanvas, drls, graph, labels, parselect): ...@@ -189,11 +187,13 @@ def pop_dial(augCanvas, drls, graph, labels, parselect):
graph.plot(np.asarray(pressures).T[1], relint[goodtimes], graph.plot(np.asarray(pressures).T[1], relint[goodtimes],
label=label, color=(transcolors[ label=label, color=(transcolors[
colorargs[i] % len(transcolors)] / 255), marker=".", colorargs[i] % len(transcolors)] / 255), marker=".",
markersize=markersize, linestyle="None") markersize=getconfval("markersize", float),
if showlabel: linestyle="None")
legend = graph.legend(loc=settings.value( if getconfval("showlabel", int):
"reactivity/labelloc_par{}".format(parint), type=float)) legend = graph.legend(loc=getconfval("labelloc", int))
[lh._legmarker.set_alpha(1) for lh in legend.legendHandles] [lh._legmarker.set_alpha(1) for lh in legend.legendHandles]
graph.text(0, 1, getconfval("figann", str), va="top",
transform=graph.figure.transFigure, in_layout=False)
graph.autoscale(True) graph.autoscale(True)
graph.figure.canvas.draw() graph.figure.canvas.draw()
...@@ -201,7 +201,8 @@ def pop_dial(augCanvas, drls, graph, labels, parselect): ...@@ -201,7 +201,8 @@ def pop_dial(augCanvas, drls, graph, labels, parselect):
def main_window(parent, augCanvas, update_signal, drls): def main_window(parent, augCanvas, update_signal, drls):
"""constructs a dialog window""" """constructs a dialog window"""
reactlabels = dict(name="", xlabel="pressure (mT)", ylabel="rel intensity") reactlabels = dict(name="", xlabel="pressure (mT)",
ylabel="$Intensity$ $\\it→$")
def onclose(widget, event, update_fnc): def onclose(widget, event, update_fnc):
logger.debug("ZCE window custom close routine called") logger.debug("ZCE window custom close routine called")
...@@ -234,19 +235,14 @@ def main_window(parent, augCanvas, update_signal, drls): ...@@ -234,19 +235,14 @@ def main_window(parent, augCanvas, update_signal, drls):
formula = QtWidgets.QLabel( formula = QtWidgets.QLabel(
"Formula for the x-axis: (Parameter - a) * b") "Formula for the x-axis: (Parameter - a) * b")
xannlayout = reactivityParam(parselect, str, "xlabel", "x axis label:") xannlayout = reactivityParam(parselect, str, "xlabel", "x axis label:")
def changevalue(x):
reactlabels['xlabel'] = x
dialspect.set_xlabel(x)
graph_canvas.draw()
xannlayout.dial.textChanged.connect(changevalue)
xannlayout.addStretch() xannlayout.addStretch()
figann = reactivityParam(parselect, str, "figann", "Figure annotation:")
translayout = reactivityParam( translayout = reactivityParam(
parselect, int, "transparency", "Transparency (0-255): ", 0, 255) parselect, int, "transparency", "Transparency (0-255): ", 0, 255)
translayout.addStretch() translayout.addStretch()
labelloclayout = reactivityParam( labelloclayout = reactivityParam(
parselect, int, "labelloc", "Label location (0-10): ", 0, 10) parselect, int, "labelloc", "Label location (0-10): ", 0, 10)
layouts = [xannlayout, translayout, labelloclayout] layouts = [xannlayout, figann, translayout, labelloclayout]
layouts.append(reactivityParam( layouts.append(reactivityParam(
parselect, int, "showlabel", "Show Label? (0-1): ", 0, 1)) parselect, int, "showlabel", "Show Label? (0-1): ", 0, 1))
layouts.append(reactivityParam( layouts.append(reactivityParam(
...@@ -254,7 +250,7 @@ def main_window(parent, augCanvas, update_signal, drls): ...@@ -254,7 +250,7 @@ def main_window(parent, augCanvas, update_signal, drls):
layouts.append(reactivityParam(parselect, float, "coef_a", "a: ")) layouts.append(reactivityParam(parselect, float, "coef_a", "a: "))
layouts.append(reactivityParam(parselect, float, "coef_b", "b: ")) layouts.append(reactivityParam(parselect, float, "coef_b", "b: "))
pushbtn = QtWidgets.QPushButton("Recalculate") pushbtn = QtWidgets.QPushButton("Update")
pushbtn.clicked.connect(lambda: pop_dial( pushbtn.clicked.connect(lambda: pop_dial(
augCanvas, drls, dialspect, reactlabels, parselect)) augCanvas, drls, dialspect, reactlabels, parselect))
......
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