Commit 466284cc authored by Christian Rohlfing's avatar Christian Rohlfing
Browse files

Merge branch 'development-lab' of git.rwth-aachen.de:IENT/gdet3-demos into development-lab

parents f65e5429 8b9fc970
......@@ -26,7 +26,7 @@ class pzPoint():
class pzPlot():
pp = np.array([])
pz = np.array([])
roc = {'sigma': [0, 0], 'lleft': None, 'lright': None, 'hatch': None, 'inf': 12}
roc = {'sigma': [0, 0], 'plot': None, 'inf': 12}
qdelta = 0.1
qthresh = 0.1
fig = None
......@@ -37,7 +37,8 @@ class pzPlot():
mode = 'p'
mode_types = {'Polstelle': 'p', 'Nullstelle': 'z'}
action = 'add'
action_types = {'Hinzufügen / Löschen': 'add', 'Konvergenzbereich ändern': 'roc'}
action_locked = False
action_types = {'Hinzufügen': 'add', 'Löschen': 'del', 'Konvergenzbereich ändern': 'roc'}
H = None
Hlog = None
......@@ -101,17 +102,25 @@ class pzPlot():
self.ax.set_title('Pol- /Nullstellen Diagramm', fontsize='12')
def onclick(event):
if not self.action == 'roc':
if event.button == 1: # Left click
self.action = 'add'
elif event.button == 2 or event.button == 3: # Middle or right click
self.action = 'del'
if self.action == 'add' and event.key == 'shift':
self.action = 'del'
if event.inaxes != self.ax: return
if self.filter != 'man': return
p = event.xdata + 1j * event.ydata
self.update_point(p, self.mode)
def onkeypress(event):
self.action_locked = True if self.action == 'del' else False
self.w_action_type.children[0].value = 'Löschen'
def onkeyrelease(event):
if not self.action_locked:
self.w_action_type.children[0].value = 'Hinzufügen'
self.fig.canvas.mpl_connect('button_press_event', onclick)
self.fig.canvas.mpl_connect('key_press_event', onkeypress)
self.fig.canvas.mpl_connect('key_release_event', onkeyrelease)
self.handles['axh'] = plt.subplot(gs[0, 1])
self.handles['axh'].set_title('Impulsantwort', fontsize='12')
......@@ -139,7 +148,7 @@ class pzPlot():
# Widgets
self.w_filter_type = interactive(self.update_filter,filtr=widgets.Dropdown(options=list(self.filter_types.keys()), value="Sprungfunktion", description='Filter'))
self.w_action_type = interactive(self.update_action,action=widgets.Dropdown(options=list(self.action_types.keys()),value="Hinzufügen / Löschen", description='Modus', disabled=True))
self.w_action_type = interactive(self.update_action,action=widgets.Dropdown(options=list(self.action_types.keys()),value="Hinzufügen", description='Modus', disabled=True))
self.w_point_type = interactive(self.update_mode,mode=widgets.Dropdown(options=list(self.mode_types.keys()), value="Polstelle", description='Typ', disabled=True))
self.w_amp_type = interactive(self.update_amp, H0=widgets.IntSlider(min=1,max=10,step=1,value=1), description="H0")
self.w_no_of_poles = interactive(self.update_no_of_poles, P=widgets.IntSlider(min=1,max=7,step=1,value=1), description="P")
......@@ -282,20 +291,14 @@ class pzPlot():
self.roc['sigma'][0] = left
self.roc['sigma'][1] = right
xx = [self.roc['sigma'][0], self.roc['sigma'][1]]
xx = np.array([self.roc['sigma'][0], self.roc['sigma'][1]])
y1 = [-12, -12]
y2 = [12, 12]
if self.roc['lleft'] is None:
# TODO - Use ient_plot_lroc instead
self.roc['lleft'], = self.ax.plot([xx[0], xx[0]], [y1[0], y2[0]], ls="--", c="rwth-50")
self.roc['lright'], = self.ax.plot([xx[1], xx[1]], [y1[0], y2[0]], ls="--", c="rwth-50")
self.roc['hatch'] = self.ax.fill_between(xx, y1, y2, facecolor="none", hatch="\\", edgecolor="rwth-50", linewidth=0.0)
if self.roc['plot'] is None:
self.roc['plot'] = ient_plot_lroc(self.ax, xx)
else:
self.roc['lleft'].set_xdata([xx[0], xx[0]])
self.roc['lright'].set_xdata([xx[1], xx[1]])
self.roc['hatch'].remove()
self.roc['hatch'] = self.ax.fill_between(xx, y1, y2, facecolor="none", hatch="\\", edgecolor="rwth-50", linewidth=0.0)
self.roc['plot'] = ient_update_lroc(self.ax, self.roc['plot'], xx)
self.update_plot()
# path = pzp.roc['hatch'].get_paths()[0]
......
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