Commit b67aaada 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 4ba34c92 fccb1d90
......@@ -47,96 +47,50 @@
%% Cell type:code id: tags:
``` python
n = np.linspace(-10, 10, 21)
m = np.linspace(-40, 40, 81) # m Achse
s_type = h_type = ''; s_n0 = h_n0 = 0
M_s = M_h = 1
b_s = b_h = .5
n0 = -2
container_s = container_h = None
def convolution(s, h):
# Convolve s and h numerically
return signal.convolve(s(m), h(m), mode='same')
signal_types = {'Dirac-Impuls' : lambda n, b, M: np.where(n==0, 1, 0),
'Sprungfunktion' : lambda n, b, M: np.where(n>=0, 1, 0),
'Exponentialimpuls' : lambda n, b, M: unitstep(n)*b**n,
'Rechteck' : lambda n, b, M: unitstep(n+M) - unitstep(n-M-1)
}
def _update_b_s(_b_s):
global b_s
b_s = _b_s
update_signals(s_type, s_n0, h_type, h_n0)
def _update_M_s(_M_s):
global M_s
M_s = _M_s
update_signals(s_type, s_n0, h_type, h_n0)
def _update_b_h(_b_h):
global b_h
b_h = _b_h
update_signals(s_type, s_n0, h_type, h_n0)
def _update_M_h(_M_h):
global M_h
M_h = _M_h
update_signals(s_type, s_n0, h_type, h_n0)
# widgets for setting parameters b and M
w_b_s = interactive(_update_b_s, _b_s=widgets.FloatSlider(min=.1, max=1, value=.5, step=.1, description=r'$b_s$', style=ient_wdgtl_style))
w_b_h = interactive(_update_b_h, _b_h=widgets.FloatSlider(min=.1, max=1, value=.5, step=.1, description=r'$b_h$', style=ient_wdgtl_style))
w_M_s = interactive(_update_M_s, _M_s=widgets.FloatSlider(min=0, max=5, value=1, step=1, description=r'$M_s$', style=ient_wdgtl_style))
w_M_h = interactive(_update_M_h, _M_h=widgets.FloatSlider(min=0, max=5, value=1, step=1, description=r'$M_h$', style=ient_wdgtl_style))
box = HBox([])
fig0, axs0 = plt.subplots(1, 2, figsize=(8,2)); container_s = container_h = None
@widgets.interact(_s_type=widgets.Dropdown(options=list(signal_types.keys()), description=r'Wähle $s(n)$:'),
_s_n0=widgets.FloatSlider(min=-5, max=5, value=0, step=1, description=r'Verschiebung $n_0$', style=ient_wdgtl_style),
_h_type=widgets.Dropdown(options=list(signal_types.keys()), description=r'Wähle $h(n)$:'),
_h_n0=widgets.FloatSlider(min=-5, max=5, value=0, step=1, description=r'Verschiebung $n_0$', style=ient_wdgtl_style))
def update_signals(_s_type, _s_n0, _h_type, _h_n0):
# set global variables
global s_type, s_n0, h_type, h_n0
s_type = _s_type; s_n0 = _s_n0; h_type = _h_type; h_n0 = _h_n0
fig0, axs0 = plt.subplots(1, 2, figsize=(ient_fig_width, ient_fig_width/4));
def update_signals(s_type, s_n0, h_type, h_n0, b_s, b_h, M_s, M_h):
# show widgets according to chosen s and h
w_b_s.layout.visibility = 'visible' if s_type == 'Exponentialimpuls' else 'hidden'; w_M_s.layout.visibility = 'visible' if s_type == 'Rechteck' else 'hidden'
w_b_h.layout.visibility = 'visible' if h_type == 'Exponentialimpuls' else 'hidden'; w_M_h.layout.visibility = 'visible' if h_type == 'Rechteck' else 'hidden'
# calculate s(m-n0) and h(m-n0)
global s, h, gn, container_s, container_h # reused in second interactive plot
s = lambda m: signal_types[_s_type]((m-_s_n0), b_s, M_s); # s(m-n0)
h = lambda m: signal_types[_h_type]((m-_h_n0), b_h, M_h); # h(m-n0)
s = lambda m: signal_types[s_type]((m-s_n0), b_s, M_s); # s(m-n0)
h = lambda m: signal_types[h_type]((m-h_n0), b_h, M_h); # h(m-n0)
gn = convolution(s, h) # numerical convolution
# update second plot if existing
try:
global n0
update_plot(n0)
except NameError:
pass
# show widgets according to chosen s and h
children = []
if _s_type == 'Exponentialimpuls':
children.append(w_b_s)
elif _s_type == 'Rechteck':
children.append(w_M_s)
if _h_type == 'Rechteck':
children.append(w_M_h)
elif _h_type == 'Exponentialimpuls':
children.append(w_b_h)
box.children = children
# display s and h plots
if container_s is None:
ax = axs0[0];
container_s = ient_stem(ax, m, s(m), 'rwth')
ax.set_xticks(np.arange(-10, 11, step=2))
ax.set_xlabel(r'$\rightarrow n$'); ax.set_ylabel(r'$\uparrow s(n)$')
ax.set_xlim([-10.9, 10.9]); ax.set_ylim([-1.19, 1.19]); ient_axis(ax); ient_grid(ax);
ax.set_xlim([-10.9, 10.9]); ax.set_ylim([-.19, 1.19]); ient_axis(ax); ient_grid(ax);
ax = axs0[1];
container_h = ient_stem(ax, m, h(m), 'rwth')
ax.set_xticks(np.arange(-10, 11, step=2))
ax.set_xlabel(r'$\rightarrow n$'); ax.set_ylabel(r'$\uparrow h(n)$')
......@@ -145,11 +99,22 @@
else:
ient_stem_set_ydata(container_s, s(m))
ient_stem_set_ydata(container_h, h(m))
display(box)
# Widgets
w_s_type=widgets.Dropdown(options=list(signal_types.keys()), description=r'Wähle $s(n)$:', style=ient_wdgtl_style)
w_s_n0=widgets.FloatSlider(min=-5, max=5, value=0, step=1, description=r'Verschiebung $n_0$', style=ient_wdgtl_style)
w_h_type=widgets.Dropdown(options=list(signal_types.keys()), description=r'Wähle $h(n)$:', style=ient_wdgtl_style)
w_h_n0=widgets.FloatSlider(min=-5, max=5, value=0, step=1, description=r'Verschiebung $n_0$', style=ient_wdgtl_style)
w_b_s=widgets.FloatSlider(min=.1, max=1, value=.5, step=.1, description=r'$b_s$', style=ient_wdgtl_style)
w_b_h=widgets.FloatSlider(min=.1, max=1, value=.5, step=.1, description=r'$b_h$', style=ient_wdgtl_style)
w_M_s=widgets.FloatSlider(min=0, max=5, value=1, step=1, description=r'$M_s$', style=ient_wdgtl_style)
w_M_h=widgets.FloatSlider(min=0, max=5, value=1, step=1, description=r'$M_h$', style=ient_wdgtl_style)
w = widgets.interactive(update_signals, s_type=w_s_type, s_n0=w_s_n0, h_type=w_h_type, h_n0 =w_h_n0, b_s=w_b_s, b_h=w_b_h, M_s=w_M_s, M_h=w_M_h)
display(widgets.HBox((widgets.VBox((w_s_type, w_s_n0, w_b_s, w_M_s)), widgets.VBox((w_h_type, w_h_n0, w_b_h, w_M_h), layout=Layout(margin='0 0 0 100px'))))); w.update();
```
%% Cell type:markdown id: tags:
Anschließend kann hier die Faltung $g(n)=s(n)\ast h(n)$ der zuvor eingestellten Funktionen betrachtet werden.
......@@ -157,11 +122,11 @@
Über den Schieberegler kann der Wert für $n$ verändert werden und die Funktion $h(n-m)$ bewegt sich in der oberen Grafik. In der unteren Grafik ist das resultierende Ausgangssignal $g(n)$ zu sehen.
%% Cell type:code id: tags:
``` python
fig, axs = plt.subplots(2, 1, figsize=(8,6),) # gridspec_kw = {'width_ratios':[3, 1]}
fig, axs = plt.subplots(2, 1, **ient_landscape)
global n0
container_ss = container_hh = container_gg = None
@widgets.interact(n=widgets.FloatSlider(min=-10, max=10, value=n0, step=1, description='Verschiebung $n$', style=ient_wdgtl_style))
def update_plot(n):
global container_ss, container_hh, container_gg
......
......@@ -83,11 +83,11 @@
t,deltat = np.linspace(-10,10,50001, retstep=True) # t-axis
f,deltaf = np.linspace(-50,50,len(t), retstep=True) # f-axis
kMax = 16 # number of k values in sum for Sa(f)
# Plot
plt.close(); fig, axs = plt.subplots(4, 1); fig.canvas.layout.height = '800px'; plt.tight_layout();
plt.close(); fig, axs = plt.subplots(4, 1, **ient_landscape); plt.tight_layout();
@widgets.interact(s_type=widgets.Dropdown(options=list(signals_t.keys()), description=r'Wähle $s(t)$:'),
F=widgets.FloatSlider(min=0.1, max=2, value=0.9, step=.1, description=r'$F$', style=ient_wdgtl_style, continuous_update=False))
def update_plots(s_type, F):
s = lambda t: signals_t[s_type](t*F);
S = lambda f: signals_f[s_type](f, F);
......
......@@ -43,11 +43,12 @@
mit $Q$ Nullstellen $p_{\mathrm{N},q}$ und $R$ Polstellen $p_{\mathrm{P},r}$ betrachtet und verändert werden. Dargestellt ist ein Pol-/Nullstellendiagramm, sowie die zugehörige Impulsantwort und Übertragungsfunktion.
%% Cell type:code id: tags:
``` python
pzp = pzPlot()
fig = plt.figure(figsize=(10, 10/16*9))
pzp = pzPlot(fig)
```
%% Cell type:markdown id: tags:
### Anleitung
......
......@@ -117,11 +117,11 @@
Sa = Sa/T
fSadirac = f[np.where(Sa)]; Sadirac = Sa[np.where(Sa)]
# Plot
## Time domain
fig, axs = plt.subplots(2,1)
fig, axs = plt.subplots(2,1, **ient_landscape)
ax = axs[0]; ax.set_title('Zeitbereich');
ax.plot(t, s(t), color='rwth', linestyle='--', label=r'$s(t)$');
ient_plot_dirac(ax, nT, snT, 'rot', label=r'$s_\mathrm{a}(t)$')
ax.set_xlabel(r'$\rightarrow t$'); ax.set_xlim([-7.5,7.5]); ax.legend(loc=2); ient_grid(ax); ient_axis(ax);
## Frequency domain
......@@ -152,11 +152,11 @@
Nmax = np.ceil(t[-1]/T) # Parts of the infinite rect sum, should be infinity :)
for n in np.arange(-Nmax,Nmax+1):
s0 = s0 + rect((t-n*T)/T-0.5) * s(n*T)
# Plot
fig, ax = plt.subplots(); ax.set_title('Zeitbereich')
fig, ax = plt.subplots(**ient_landscape); ax.set_title('Zeitbereich')
ax.plot(t, s(t), 'rwth', linestyle='--', label=r'$s(t)$'); ax.plot(t, s0, 'rot', label=r'$s_0(t)$')
ax.set_xlabel(r'$\rightarrow t$'); ax.set_xlim([-2.9, 2.9]); ax.legend(loc=2); ient_grid(ax); ient_axis(ax);
```
%% Cell type:markdown id: tags:
......@@ -177,11 +177,11 @@
S_exp = np.exp(-1j*np.pi*f*T)
S0 = Sa * S_si * S_exp
# Plot
## Magnitude
fig, axs = plt.subplots(2,1);
fig, axs = plt.subplots(2,1, **ient_landscape);
ax = axs[0]; ax.set_title('Betrag')
ax.plot(f, np.abs(S_si*S_exp), 'k--', label=r'$|T\mathrm{si}(\pi f T)e^{-\mathrm{j}\pi f T}|$')
fS0dirac = f[np.where(S0)]; S0dirac = S0[np.where(S0)] # sample S0 and f
ient_plot_dirac(ax, fS0dirac, np.abs(S0dirac), 'rot', label=r'$|S_0(f)$|');
ax.set_xlim([-7.5,7.5]); ax.legend(loc=2); ax.set_xlabel(r'$\rightarrow f$'); ient_grid(ax); ient_axis(ax);
......@@ -211,11 +211,11 @@
H_eq = 1/(T*si(np.pi*T*f) * np.exp(-1j*np.pi*f*T))
## Overall reconstruction filter
H = H_lp * H_eq
# Plot
fig,axs = plt.subplots(2,1)
fig,axs = plt.subplots(2,1, **ient_landscape)
ax = axs[0]
ax.plot(f, np.abs(H_eq), 'k--', linewidth=1, label=r'$|H_\mathrm{eq}(f)|$')
ax.plot(f, np.abs(H), 'k', label=r'$|H(f)|$')
ax.set_xlim([-7.5,7.5]); ax.legend(loc=2); ax.set_ylim([-.1,21]);
ax.set_xlabel(r'$\rightarrow f$'); ient_grid(ax); ient_axis(ax);
......@@ -238,11 +238,11 @@
G = S0 * H*T;
g = ient_idft(G); g = np.fft.ifftshift(np.real(g)); # IDFT
G = np.real(G); # discards small imaginary numbers close to zero
# Plot
fig, axs = plt.subplots(2,1)
fig, axs = plt.subplots(2, 1, **ient_landscape)
ax = axs[0]; fGdirac = f[np.where(G)]; Gdirac = G[np.where(G)]
ient_plot_dirac(ax, fGdirac, Gdirac, 'grun');
ax.set_xlabel(r'$\rightarrow f$'); ax.set_ylabel(r'$\uparrow G(f)$', bbox=ient_wbbox);
ax.set_xlim([-7.5,7.5]); ient_grid(ax); ient_axis(ax);
......@@ -267,11 +267,11 @@
%% Cell type:code id: tags:
``` python
T0 = T/4 # width of rects for shape-top sampling
plt.close(); fig, axs = plt.subplots(4, 1); fig.canvas.layout.height = '800px'; plt.tight_layout();
plt.close(); fig, axs = plt.subplots(4, 1, **ient_landscape); fig.canvas.layout.height = '800px'; plt.tight_layout();
@widgets.interact(sampling_type=widgets.Dropdown(options=['Shape-top', 'Flat-top'], description=r'Art der Abtastung:', style=ient_wdgtl_style),
s_type=widgets.Dropdown(options=list(signals_t.keys()), description=r'Wähle $s(t)$:'),
F=widgets.FloatSlider(min=0.1, max=2, value=0.9, step=.1, description=r'$F$', style=ient_wdgtl_style, continuous_update=False))
def update_plots(sampling_type, s_type, F):
s = lambda t: signals_t[s_type](t*F);
......
......@@ -26,44 +26,17 @@
Zum Starten: Im Menü: Run <span class="fa-chevron-right fa"></span> Run All Cells auswählen.
%% Cell type:markdown id: tags:
### plotting pole zero plot in z-plane
%% Cell type:code id: tags:
``` python
n = np.linspace(-5, 5, 11)
pp = np.array([0.5, 2]); pz = np.array([0])
roc = np.array([0.5, 2])
#roc = np.array([-b, np.inf])
fig, axs = plt.subplots(1, 2)
ax = axs[0]
zroc = ient_plot_zroc(ax, roc)
ax.plot(np.real(pp), np.imag(pp), **ient_style_poles); ax.plot(np.real(pp), -np.imag(pp), **ient_style_poles)
ax.plot(np.real(pz), np.imag(pz), **ient_style_zeros); ax.plot(np.real(pz), -np.imag(pz), **ient_style_zeros)
ax.set_xlabel(r'$\rightarrow \mathrm{Re}$'); ax.set_ylabel(r'$\uparrow \mathrm{Im}$');
ax.set_xlim(np.min(n), np.max(n)); ax.set_ylim(ax.get_xlim()); ient_grid(ax); ient_axis(ax)
ax = axs[1]
h_n = ient_iz_ht(n, 1, pp, pz, roc= roc)
ax.set_xlabel(r'$\rightarrow \mathrm{n}$'); ax.set_ylabel(r'$\uparrow \mathrm{h(n)}$');
ax.set_xlim(np.min(n), np.max(n)); ient_update_ylim(ax, h_n, 0.19, 1e05); ient_grid(ax); ient_axis(ax)
ient_stem(ax, n, np.real(h_n))
```
%% Cell type:markdown id: tags:
## Interaktive Demo
%% Cell type:code id: tags:
``` python
zp = zPlot()
fig = plt.figure(figsize=(10, 10/16*9))
zp = zPlot(fig)
```
%% Cell type:markdown id: tags:
### Anleitung
......
......@@ -32,7 +32,7 @@ class pzPlot():
fig = None
ax = None
handles = {'ph': None, 'axh': None, 'pH': None, 'axH': None}
filter_types = {'Manuell' : 'man', 'Butterworth' : 'butr', 'Sprungfunktion' : 'unit',
filter_types = {'Manuell' : 'man', 'Butterworth' : 'butr', 'Sprungfunktion' : 'unit',
'Sinus' : 'sin', 'Cosinus' : 'cos'}
mode = 'p'
mode_types = {'Polstelle': 'p', 'Nullstelle': 'z'}
......@@ -44,7 +44,7 @@ class pzPlot():
P = 1 # no of poles for butterworth filter
def __init__(self, pp=np.array([0]), pz=np.array([]), ord_p=np.array([1]), ord_z=np.array([])):
def __init__(self, fig, pp=np.array([0]), pz=np.array([]), ord_p=np.array([1]), ord_z=np.array([])):
self.H0 = 1
self.filter = 'unit'
......@@ -57,7 +57,7 @@ class pzPlot():
self.t = np.linspace(-6, 6, num=self.length)
self.f = np.linspace(-6, 6, num=self.length)
self.open_figure()
self.open_figure(fig)
# Poles
......@@ -83,9 +83,8 @@ class pzPlot():
self.update_roc(1)
def open_figure(self):
def open_figure(self, fig):
fig = plt.figure(figsize=(8, 8))
gs = gridspec.GridSpec(2, 2)
# First axis for plotting s and h
......@@ -100,6 +99,7 @@ class pzPlot():
self.fig = fig
self.ax = ax
self.ax.set_title('Pol- /Nullstellen Diagramm', fontsize='12')
self.ax.set_aspect('equal', adjustable='datalim')
def onclick(event):
if self.action == 'add' and event.key == 'shift':
......@@ -126,7 +126,7 @@ class pzPlot():
self.handles['axh'].set_title('Impulsantwort', fontsize='12')
self.handles['axh'].set_xlabel(r'$\rightarrow t$')
self.handles['axh'].set_ylabel(r'$\uparrow h(t)$')
self.pbzErrortxt = self.handles['axh'].text(-7, 3.25,
self.pbzErrortxt = self.handles['axh'].text(-.6, .0125,
'Zählergrad größer als Nennergrad. \nKeine Partialbruchzerlegung möglich!',
fontsize=12, color='rot', visible=False, bbox=ient_wbbox)
self.handles['lineh'], = self.handles['axh'].plot(self.t, self.t)
......@@ -145,7 +145,7 @@ class pzPlot():
self.fig.canvas.layout.height = '600px'
fig.tight_layout();
#plt.subplots_adjust(wspace=.25)
# 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", description='Modus', disabled=True))
......@@ -360,9 +360,9 @@ class pzPlot():
def update_widgets(filtr):
if filtr == "Manuell":
b = False
else:
else:
b = True
self.w_action_type.children[0].disabled = b
self.w_point_type.children[0].disabled = b
......
......@@ -26,7 +26,7 @@ class pzPoint():
class zPlot():
pp = np.array([])
pz = np.array([])
roc = {'sigma': [0, 0], 'zroc' : None, 'inf': 12}
roc = {'sigma': [0, 0], 'zroc': None, 'inf': 12}
qdelta = 0.1
qthresh = 0.1
fig = None
......@@ -42,18 +42,19 @@ class zPlot():
H = None
Hlog = None
def __init__(self, pp=np.array([0]), pz=np.array([]), ord_p=np.array([1]), ord_z=np.array([])):
def __init__(self, fig, pp=np.array([0]), pz=np.array([]), ord_p=np.array([1]), ord_z=np.array([])):
self.H0 = 1
#self.filter = 'unit'
# self.filter = 'unit'
self.H0_txt = None
self.systemIsStable = True
self.length = 31
self.n = np.linspace(-15, 15, num=self.length)
self.f = np.linspace(-15, 15, num=1024)
self.open_figure()
self.open_figure(fig)
# Poles
return
......@@ -78,9 +79,8 @@ class zPlot():
self.update_roc(1)
def open_figure(self):
def open_figure(self, fig):
fig = plt.figure(figsize=(8, 8))
gs = gridspec.GridSpec(2, 2)
# First axis for plotting s and h
......@@ -95,6 +95,7 @@ class zPlot():
self.fig = fig
self.ax = ax
self.ax.set_title('Pol- /Nullstellen Diagramm', fontsize='12')
self.ax.set_aspect('equal')
def onclick(event):
if self.action == 'add' and event.key == 'shift':
......@@ -106,7 +107,7 @@ class zPlot():
self.update_point(p, self.mode)
def onkeypress(event):
self.action_locked = True if self.action == 'del' else False
self.action_locked = self.action == 'del'
self.w_action_type.children[0].value = 'Löschen'
def onkeyrelease(event):
......@@ -122,26 +123,19 @@ class zPlot():
self.handles['axh'].set_title('Impulsantwort', fontsize='12')
self.handles['axh'].set_xlabel(r'$\rightarrow n$')
self.handles['axh'].set_ylabel(r'$\uparrow h(n)$')
self.pbzErrortxt = self.handles['axh'].text(-7, 3.25,
'Zählergrad größer als Nennergrad. \nKeine Partialbruchzerlegung möglich!',
fontsize=12, color='rot', visible=False, bbox=ient_wbbox)
self.handles['containerh'] = ient_stem(self.handles['axh'], self.n, self.n)
ient_axis(self.handles['axh'])
self.handles['axH'] = plt.subplot(gs[1, 1])
self.handles['axH'].set_title('Übertragungsfunktion', fontsize='12')
self.handles['axH'].set_xlabel(r'$\rightarrow f$')
self.handles['axH'].set_ylabel(r'$\uparrow |H(f)|$ [dB]')
self.stabilitytxt = self.handles['axH'].text(-6, 0,
'Das System is nicht stabil!',
fontsize=12, color='rot', visible=False, bbox=ient_wbbox)
self.handles['lineH'], = self.handles['axH'].plot(self.f, self.f)
ient_axis(self.handles['axH'])
self.handles['axH'].spines['bottom'].set_position(('outward', 0))
# initial dirac plot
(self.cp, self.cn) = ient_plot_dirac(self.handles['axh'], [-1, 1], [-1, 1], 'rwth')
ient_dirac_set_data((self.cp, self.cn), [], [])
self.fig.canvas.layout.height = '600px'
fig.tight_layout();
# plt.subplots_adjust(wspace=.25)
# Widgets
self.w_filter_type = interactive(self.update_filter,
filtr=widgets.Dropdown(options=list(self.filter_types.keys()),
......@@ -225,6 +219,7 @@ class zPlot():
if self.action == 'add': # add new point
pPoint = pzPoint(p, neword)
if mode == 'p':
if p == 0: return
self.pp = np.append(self.pp, pPoint)
ind = self.pp.size - 1
plotstyle = ient_style_poles
......@@ -243,7 +238,7 @@ class zPlot():
else: # delete / update order
if self.action == 'add': # increase order
#pPoint.order += 1
# pPoint.order += 1
pass
elif self.action == 'del':
......@@ -300,15 +295,12 @@ class zPlot():
self.roc['sigma'][1] = right
xx = np.array([self.roc['sigma'][0], self.roc['sigma'][1]])
if self.roc['zroc'] is None:
self.roc['zroc'] = ient_plot_zroc(self.ax, xx)
else:
if self.roc['zroc'] is not None:
self.roc['zroc'].remove()
self.roc['zroc'] = ient_plot_zroc(self.ax, xx)
self.roc['zroc'] = ient_plot_zroc(self.ax, xx)
self.update_plot()
# path = pzp.roc['hatch'].get_paths()[0]
# path.vertices[path.vertices[:,0] == 1,0] = 2
def update_mode(self, mode):
self.mode = self.mode_types[mode]
......@@ -364,13 +356,8 @@ class zPlot():
self.pp = self.pz = np.array([])
def update_widgets(filtr):
if filtr == "Manuell":
b = False
else:
b = True
self.w_action_type.children[0].disabled = b
self.w_point_type.children[0].disabled = b
self.w_action_type.children[0].disabled = filtr != 'Manuell'
self.w_point_type.children[0].disabled = filtr != 'Manuell'
# add default filter poles and zeroes to plot
def def_points():
......@@ -417,15 +404,22 @@ class zPlot():
poles_order = np.array(list((x.order for x in self.pp)))
zeroes = np.array(list((x.p for x in self.pz)), dtype=complex)
zeroes_order = np.array(list((x.order for x in self.pz)))
roc = self.roc['sigma']
roc = np.around(self.roc['sigma'], 5)
# update n-domain
h_n = ient_iz_ht(self.n, self.H0, poles, zeroes, poles_order, zeroes_order, roc)
ient_stem_set_ydata(self.handles['containerh'], np.real(h_n))
ient_update_ylim(self.handles['axh'], h_n, 0.19, ymax=1e5)
self.systemIsStable = np.min(roc) < 1 < np.max(roc)
# update f-domain
H_f = ient_iz_Hf(self.f, self.H0, poles, zeroes, poles_order, zeroes_order, True)
if self.systemIsStable:
H_f = ient_iz_Hf(self.f, self.H0, poles, zeroes, poles_order, zeroes_order, True)
else:
H_f = np.ones(self.f.shape) * -.5
self.stabilitytxt.set_visible(not self.systemIsStable)
self.handles['lineH'].set_ydata(H_f)
ient_update_ylim(self.handles['axH'], H_f, 1.9, ymax=1e5)
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