visualdynamics.plot.tone_readout¶
tone_readout
¶
A tone read off an autospectrum, drawn on the spike it was read from.
The reading (core.tone_readout.read_tone) puts two numbers side by
side that a plot of an ASD invites a reader to confuse: the height of
the spike, which moves with the line spacing and the window, and the
tone's amplitude, which does not. The overlay draws both at the tone:
- a stem from the floor up to the height this tone stands at for the spacing, window and placement in use, capped with a downward triangle. It is what a controller that draws its tone references on the ASD scales them to, and it lands on the spike's top when the reading is right, so a reading taken off the wrong spike, or a floor misjudged, shows as a triangle that misses;
- a dotted line at the floor, across the lines the tone was summed over, so what was taken away is seen;
- the amplitude in words beside the triangle, with the spike's height under it, and "between lines" when the tone sits far enough off a line that its spike reads short.
Shapes, line styles and words carry the meaning, not a color: the
overlay takes one color, the plot's foreground unless the caller passes
another. The items go on the plot's view box and are kept out of its
bounds, as plot.half_power's are: they are a reading of the data, not
data, so the legend, the copy and the plot's own preview never include
them, and drawing them never re-zooms the view.
ToneOverlay owns its items and moves them, so a cursor that reads on
every move updates the same items; add_tone_readout draws one reading
once, for a figure.
Classes:
| Name | Description |
|---|---|
ToneOverlay |
The items that draw one tone reading on a pyqtgraph plot. |
Functions:
| Name | Description |
|---|---|
label_text |
What the overlay writes beside a tone: its amplitude, then the |
add_tone_readout |
Draw |
display_units |
(amplitude scale, density scale, amplitude unit) for showing a |
Classes¶
ToneOverlay
¶
The items that draw one tone reading on a pyqtgraph plot.
Made once per plot with plot, the PlotItem to draw on, and
color, a pyqtgraph color (the plot's foreground by default); then
show(reading, ...) places them and clear() hides them. The words
go to the right of the triangle, or with above=True centered over
it, which is how a figure of several tones keeps them apart.
Methods:
| Name | Description |
|---|---|
items |
Every item the overlay draws with. |
show |
Place the overlay on |
clear |
Hide the overlay until the next |
remove |
Take the items off the plot for good. |
Source code in src/visualdynamics/plot/tone_readout.py
Methods:¶
items
¶
show
¶
show(reading: Any, frequencies: Any = None, *, scale: float = 1.0, density_scale: float | None = None, unit: str = '') -> None
Place the overlay on reading, a ToneReading.
frequencies are the spectrum's lines, which place the floor's
line across the lines summed; without them it spans the main
lobe about the tone. scale converts the amplitude for the
words and density_scale the densities for the drawing (the
square of scale when None), for a spectrum drawn in other
units than it was read in; unit names the amplitude's.
Source code in src/visualdynamics/plot/tone_readout.py
clear
¶
Functions:¶
label_text
¶
What the overlay writes beside a tone: its amplitude, then the
spike's height in the spectrum's units, then 'between lines' when
the spike reads short for it, or 'uncertain' when a note on the
reading bears on the amplitude. scale converts the amplitude into
unit; the density takes its square.
Source code in src/visualdynamics/plot/tone_readout.py
add_tone_readout
¶
add_tone_readout(plot: Any, reading: Any, frequencies: Any = None, *, color: Any = None, above: bool = False, scale: float = 1.0, density_scale: float | None = None, unit: str = '') -> ToneOverlay
Draw reading, a ToneReading, on plot and return the
overlay. color and above are as for ToneOverlay, the others
as for ToneOverlay.show.
Source code in src/visualdynamics/plot/tone_readout.py
display_units
¶
(amplitude scale, density scale, amplitude unit) for showing a
tone read off record record of data in unit_system: g and
g²/Hz for an acceleration's autospectrum shown in g, ones and an
empty unit for a record whose units are not declared or that is not
an autospectrum.