visualdynamics.plot.amplitude_spectrum¶
amplitude_spectrum
¶
A record's amplitude spectrum, drawn with its window and correction named on it.
One channel of a core.amplitude_spectrum.AmplitudeSpectrum, in peak
units of the unit system, against frequency. The title names what the
lines were scaled by, because an amplitude read off a windowed transform
means nothing without it: the window, its amplitude correction, the
line spacing and the frames whose magnitudes were averaged, then how far
low this window reads a sine that falls midway between two lines. The
tallest line above DC is marked with a downward triangle, its amplitude
and frequency written beside it and in the legend.
Nothing is told apart by hue alone: there is one curve, the reading is a triangle with its value in words, and every mark is named in the legend under the plot. The amplitude axis is logarithmic by default, so a tone and the floor it stands on are both seen; a line at zero, which a log axis cannot place, is left out of the drawing and not of the reading.
Functions:
| Name | Description |
|---|---|
display_scale |
(factor, unit) that put channel |
title_text |
The plot's title: the channel and the window with its correction, |
build_amplitude_spectrum |
Draw channel |
Functions:¶
display_scale
¶
(factor, unit) that put channel record's amplitudes, stored in
SI, into unit_system's units: 1/9.80665 and 'g' for an
acceleration shown in g; 1 and '' for a channel whose units are not
declared. An amplitude is a size, so it converts by the unit's scale
alone, never with an offset.
Source code in src/visualdynamics/plot/amplitude_spectrum.py
title_text
¶
The plot's title: the channel and the window with its correction, then the spacing, the frames averaged and the window's loss between lines. Two lines, joined by an HTML break.
Source code in src/visualdynamics/plot/amplitude_spectrum.py
build_amplitude_spectrum
¶
build_amplitude_spectrum(layout: Any, spectrum: Any, record: int = 0, *, unit_system: Any = None, theme: Any = None, log: bool = True, band: tuple[float, float] | None = None) -> tuple[float, float] | None
Draw channel record of spectrum, an AmplitudeSpectrum, into
layout, with its tallest line marked.
Amplitudes are drawn in unit_system's units, on a logarithmic axis
unless log is False. band is (low, high) in Hz for the tallest
line to be looked for in, as AmplitudeSpectrum.tallest takes it.
Returns that line as (frequency, amplitude in SI), or None when the
band holds no line.