visualdynamics.viz.scalogram¶
scalogram
¶
The scalogram as a surface: time across, frequency back, amplitude up.
The flat picture shows magnitude as color, which is the usual way to draw three quantities on two axes, but a level read from color is only as accurate as the eye can match a shade against the color bar. A surface puts the third quantity on a third axis, where a ridge stands up and a floor is flat, and keeps the color as well, so each value is shown twice. A scalogram is a function of two variables, so it has a natural 3-D form, and the wavelet view opens in it (principle 1).
The depth axis is log frequency, spaced as the transform's rows are. A wavelet's bandwidth is a constant fraction of its center frequency, so the rows are evenly spaced by octave, and drawing them evenly spaced in linear frequency would put them in the wrong places. The axis is labeled in Hz.
The cone of influence is drawn as two translucent walls where the record's ends reach in. On the flat picture it is shading over the affected region; here the ridge passes behind it.
Functions:
| Name | Description |
|---|---|
add_scalogram |
Draw one channel's scalogram as a surface, colored by level, with |
plot_scalogram_stage |
One |
Functions:¶
add_scalogram
¶
add_scalogram(plotter: Any, magnitude: ndarray, times: ndarray, frequencies: ndarray, *, theme: Any = None, omega0: float = OMEGA0, time_label: str = 'time [s]', level_label: str = 'amplitude') -> dict[str, Any]
Draw one channel's scalogram as a surface, colored by level, with the cone of influence and the frequency labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plotter
|
Plotter
|
The plotter to draw into, cleared by the caller as for the waterfall. |
required |
magnitude
|
ndarray
|
Shape |
required |
times
|
ndarray
|
Seconds, one per column. |
required |
frequencies
|
ndarray
|
Hz, one per row, ascending and spaced evenly by octave. |
required |
theme
|
optional
|
The theme name or mapping. |
None
|
omega0
|
float
|
The wavelet's width, for the cone of influence. |
OMEGA0
|
time_label
|
str
|
Axis titles, units included. |
'time [s]'
|
level_label
|
str
|
Axis titles, units included. |
'time [s]'
|
Returns:
| Type | Description |
|---|---|
dict
|
|
Source code in src/visualdynamics/viz/scalogram.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
plot_scalogram_stage
¶
plot_scalogram_stage(history: Any, channel: int = 0, *, low: float | None = None, high: float | None = None, per_octave: int | None = None, omega0: float | None = None, unit_system: Any = None, screenshot: str | None = None, theme: Any = None, show: bool = True) -> Any
One channel's scalogram as a surface, as the app's wavelet view
first shows it, shown interactively or rendered to screenshot.
The settings (low, high, per_octave, omega0) are those of
plot.plot_scalogram and are read the same way
(core.wavelet.reading). Returns the image array when rendering to
a file, and otherwise the plotter.
from visualdynamics.viz.scalogram import plot_scalogram_stage
plot_scalogram_stage(history, screenshot='scalogram-3d.png')