Animations
BaseAnimatedPlot
Base class for animated plots that can share a figure and GridSpec.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fig
|
Figure
|
Figura principal. |
required |
grid
|
GridSpec
|
Layout de subplots. |
required |
pos
|
tuple | int
|
Posição no GridSpec. |
required |
fps
|
int
|
Frames por segundo. |
30
|
duration
|
float
|
Duração da animação. |
3.0
|
filename
|
str
|
Nome padrão do arquivo (caso deseje salvar). |
'animation.gif'
|
out_dir
|
str
|
Diretório padrão de saída. |
'../../out'
|
animate(frames)
Cria o objeto de animação sem salvar e registra o plot na figura.
save_gif(filename=None)
Salva individualmente o GIF desse plot (caso queira).
ConstellationAnimatedPlot
Bases: BaseAnimatedPlot
Class for plotting signals in the constellation domain, receiving the signals \(d_I\) and \(d_Q\), performing the plot in phase \(I\) and quadrature \(Q\), according to the expression below.
Where
- \(s(t)\): Complex signal.
- \(d_I(t)\): In-phase signal.
- \(d_Q(t)\): Quadrature signal.
The constellation plot can be normalized by a normalization factor given by:
Where
- \(\text{A}\): Desired amplitude, defined as
1
. - \(\varphi\): Normalization factor.
- \(N\): Number of samples.
- \(I(n)\) and \(Q(n)\): In-phase and quadrature signals.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fig
|
Figure
|
Figure object |
required |
grid
|
GridSpec
|
GridSpec object |
required |
pos
|
int
|
Plot position |
required |
dI
|
ndarray
|
In-phase signal |
required |
dQ
|
ndarray
|
Quadrature signal |
required |
Examples:
- Modulator Constellation/Phase Example:
create_animation(rows=1, cols=1, figsize=(16, 9))
Creates a figure with GridSpec
, returning the fig
and grid
objects for plotting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rows
|
int
|
Number of rows in the GridSpec |
1
|
cols
|
int
|
Number of columns in the GridSpec |
1
|
figsize
|
Tuple[int, int]
|
Figure size |
(16, 9)
|
Returns:
Type | Description |
---|---|
Tuple[plt.Figure, gridspec.GridSpec]: Tuple with the figure and GridSpec objects |
save_animation(fig, filename, out_dir='../../media', fps=30)
Saves the figure in <out_dir>/<filename>
from the script root directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fig
|
Figure
|
Matplotlib |
required |
filename
|
str
|
Output file name |
required |
out_dir
|
str
|
Output directory |
'../../media'
|
Raises:
Type | Description |
---|---|
ValueError
|
If the output directory is invalid |