Commit e9f135f1 authored by 3Yan's avatar 3Yan

Reactivity - annotation

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