Aufgrund einer Wartung wird GitLab am 21.09. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 21.09. between 8:00 and 9:00 am.

Commit c5435067 authored by Nicolas Ewald Alfons Horst's avatar Nicolas Ewald Alfons Horst
Browse files

update

parent f14b1ade
Pipeline #373428 passed with stage
in 4 minutes and 42 seconds
......@@ -5,6 +5,3 @@ RUN conda install --quiet --yes \
'scipy==1.4.1' && \
conda clean --all
# Copy workspace
COPY ./ /home/jovyan
......@@ -157,10 +157,10 @@
"RWTH_LANG": "EN"
},
"source": [
"### si-Function\n",
"### si Function\n",
"The si function is defined as $\\displaystyle \\mathrm{si}(t) = \\frac{\\sin(t)}{t}$\n",
"\n",
"It has the special property of reproducing itself when folded with itself: $\\mathrm{si(\\pi t)} = \\mathrm{si(\\pi t)} \\mathrm{si(\\pi t)}$. Also in optical and antenna systems a slit can be described as a spatial rect function (Bracewell, 1986). "
"It has the special property of reproducing itself when folded with itself: $\\mathrm{si(\\pi t)} = \\mathrm{si(\\pi t)} \\ast \\mathrm{si(\\pi t)}$. Also in optical and antenna systems a slit can be described as a spatial rect function (Bracewell, 1986). "
]
},
{
......
......@@ -57,6 +57,7 @@
" * [Real Sampling](GDET3_Real_Sampling.ipynb)\n",
" * [Demo Discrete Convolution Integral](GDET3_Discrete_Convolution.ipynb)\n",
" * [Discrete Fourier Transformation](GDET3_Discrete_Fourier-Transformation.ipynb)\n",
" * [Demo Discrete Fourier Transformation](GDET3_Discrete_Fourier-Transformation_GUI.ipynb)\n",
" * [Demo $z$-Transformation](GDET3_z-Transformation_GUI.ipynb)\n",
" \n",
" \n",
......
......@@ -113,26 +113,84 @@ class pzPlot():
self.ax.set_title(self.translate('Pole-zero plot'), fontsize='12')
self.ax.set_aspect('equal', adjustable='datalim')
def onclick(event):
if self.action == 'add' and event.key == 'shift':
self.action = 'del'
# * move indicates whether a drag is happening
# * selected_coords indicates selected coords when button is pressed
# * ghost_hpoint, ghost_hpoint_conj are the half transparent poles/zeroes to indicate where the newly created will be
self.move = False
self.selected_coords = None
self.ghost_hpoint = None
self.ghost_hpoint_conj = None
def on_btn_press(event):
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 = self.translate('delete')
# button press, reset move
self.move = False
# find closest point and set selected if there are any valid points nearby
p = event.xdata + 1j * event.ydata
self.selected_coords = p
def on_btn_release(event):
# press + no movement + release = click
if not self.move:
on_click(event)
# press + movement + release = drag
# if dragging process is finished
if self.move and self.find_closest_point(self.selected_coords, self.mode)[0] is not None:
# release move
self.move = False
# remove any ghosts from the figure and clear variables
if self.ghost_hpoint is not None:
self.ghost_hpoint.remove()
self.ghost_hpoint_conj.remove()
self.ghost_hpoint = None
self.ghost_hpoint_conj = None
# delete at press selected point
tmp_action = self.action
self.action = 'del'
self.update_point(self.selected_coords, self.mode)
# add new point at drag point
self.action = 'add'
on_click(event)
self.action = tmp_action
def on_motion(event):
# if button is pressed
if event.button == 1:
# lock move
self.move = True
# if a point was selected
if self.find_closest_point(self.selected_coords, self.mode)[0] is not None:
if self.ghost_hpoint is None:
# draw ghost point
if self.mode == 'p':
plotstyle = rwth_plots.style_poles
else:
plotstyle = rwth_plots.style_zeros
self.ghost_hpoint, = self.ax.plot(event.xdata, event.ydata, **plotstyle, alpha=.5)
if np.abs(event.ydata) > 0: # plot complex conjugated poles/zeroes
self.ghost_hpoint_conj, = self.ax.plot(event.xdata, -event.ydata, **plotstyle, alpha=.5)
else:
self.ghost_hpoint.set_data(event.xdata, event.ydata)
self.ghost_hpoint_conj.set_data(event.xdata, -event.ydata)
def onkeyrelease(event):
if not self.action_locked:
self.w_action_type.children[0].value = self.translate('add')
def on_click(event):
# update point
p = event.xdata + 1j * event.ydata
self.update_point(p, self.mode)
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.fig.canvas.mpl_connect('button_press_event', on_btn_press)
self.fig.canvas.mpl_connect('button_release_event', on_btn_release)
self.fig.canvas.mpl_connect('motion_notify_event', on_motion)
self.handles['axh'] = plt.subplot(gs[0, 1])
self.handles['axh'].set_title(self.translate('impulse response'), fontsize='12')
......@@ -440,7 +498,7 @@ class pzPlot():
if not (roc[0] <= 0 <= roc[1]):
S_f = np.full(self.f.shape, np.NaN)
else:
S_f = rwth_transforms.ilaplace_Hf(self.f, self.H0, poles, zeroes, poles_order, zeroes_order, dB=True)
S_f = rwth_transforms.ilaplace_Hf(self.f, self.H0, poles, zeroes, poles_order, zeroes_order, dB=True).round(8)
# process signals
# delete existing dirac
......
......@@ -112,26 +112,87 @@ class zPlot():
self.ax.set_title(self.translate('Pole-zero plot'), fontsize='12')
self.ax.set_aspect('equal')
def onclick(event):
if self.action == 'add' and event.key == 'shift':
self.action = 'del'
# * move indicates whether a drag is happening
# * selected_coords indicates selected coords when button is pressed
# * ghost_hpoint, ghost_hpoint_conj are the half transparent poles/zeroes to indicate where the newly created will be
self.move = False
self.selected_coords = None
self.ghost_hpoint = None
self.ghost_hpoint_conj = None
def on_btn_press(event):
if event.inaxes != self.ax: return
if self.filter != 'man': return
# button press, reset move
self.move = False
# find closest point and set selected if there are any valid points nearby
p = event.xdata + 1j * event.ydata
self.update_point(p, self.mode)
self.selected_coords = p
def on_btn_release(event):
# press + no movement + release = click
if not self.move:
on_click(event)
# press + movement + release = drag
# if dragging process is finished
if self.move and self.find_closest_point(self.selected_coords, self.mode)[0] is not None:
# release move
self.move = False
# remove any ghosts from the figure and clear variables
if self.ghost_hpoint is not None:
self.ghost_hpoint.remove()
self.ghost_hpoint_conj.remove()
self.ghost_hpoint = None
self.ghost_hpoint_conj = None
# delete at press selected point
tmp_action = self.action
self.action = 'del'
self.update_point(self.selected_coords, self.mode)
# add new point at drag point
self.action = 'add'
on_click(event)
self.action = tmp_action
def on_motion(event):
# if button is pressed
if event.button == 1:
# lock move
self.move = True
# if a point was selected
if self.find_closest_point(self.selected_coords, self.mode)[0] is not None:
if self.ghost_hpoint is None:
# draw ghost point
if self.mode == 'p':
plotstyle = rwth_plots.style_poles
else:
plotstyle = rwth_plots.style_zeros
self.ghost_hpoint, = self.ax.plot(event.xdata, event.ydata, **plotstyle, alpha=.5)
if np.abs(event.ydata) > 0: # plot complex conjugated poles/zeroes
self.ghost_hpoint_conj, = self.ax.plot(event.xdata, -event.ydata, **plotstyle, alpha=.5)
else:
self.ghost_hpoint.set_data(event.xdata, event.ydata)
self.ghost_hpoint_conj.set_data(event.xdata, -event.ydata)
def onkeypress(event):
self.action_locked = self.action == 'del'
self.w_action_type.children[0].value = self.translate('delete')
def on_click(event):
if self.filter != 'man': return
if event.inaxes != self.ax: return
def onkeyrelease(event):
if not self.action_locked:
self.w_action_type.children[0].value = self.translate('add')
# update point
p = event.xdata + 1j * event.ydata
self.update_point(p, self.mode)
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.fig.canvas.mpl_connect('button_press_event', on_btn_press)
self.fig.canvas.mpl_connect('button_release_event', on_btn_release)
self.fig.canvas.mpl_connect('motion_notify_event', on_motion)
self.handles['axh'] = plt.subplot(gs[0, 1])
self.handles['axh'].set_xlim(-15, 15);
......@@ -451,7 +512,7 @@ class zPlot():
# update f-domain
if self.systemIsStable:
H_f = np.abs(rwth_transforms.iz_Hf(self.f, self.H0, poles, zeroes, poles_order, zeroes_order, True))
H_f = np.abs(rwth_transforms.iz_Hf(self.f, self.H0, poles, zeroes, poles_order, zeroes_order, True)).round(8)
else:
H_f = np.ones(self.f.shape) * -.5
......
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