visualdynamics.plot¶
plot
¶
2D plotting, built on pyqtgraph.
One renderer serves both the GUI and scripting, so the rules for how data is drawn — grouping by dimension, unit-aware labels, log magnitude in the frequency domain, legends — live here only.
Records are grouped by ordinate dimension, one stacked plot per dimension,
so an object mixing accelerations, forces and voltages lands on comparable
axes. Curves are clipped to the view and, on an evenly spaced axis,
peak-downsampled — what keeps million-sample time histories interactive.
In decades the spacing is not even and the downsampling stays off (see
_draw_shaped).
Functions:
| Name | Description |
|---|---|
axis_label |
Axis label for a dimension: a typeset unit, or a note when undefined. |
build_plot |
Draw one data array. See |
build_plots |
Draw several data arrays into one pyqtgraph GraphicsLayout. |
plot_data |
Plot a data array in a window, or to a file with |
save_plot |
Render a data array to an image file (.png or .svg), no window. |
plot_mac |
The MAC grid the GUI draws: |
plot_cmif |
The CMIF the fitting screen draws: the measured indicator, and |
plot_coherence_map |
The coherence map: frequency across, channel down, pinned 0..1. |
build_photos |
Photos stacked down a layout, each at its own aspect ratio with |
plot_photos |
The photos, as the app shows them. |
plot_series |
Several data arrays on one figure — what selecting more than one |
plot_comparison |
One control channel against its specification, shaded. |
plot_bars |
The comparison as a bar per control channel. |
plot_replication |
How closely a transient replicated the waveform it was asked for. |
Classes¶
Functions:¶
fit_label_axis
¶
Make a category axis wide enough for its widest label.
pyqtgraph draws no tick text that will not fit its axis, and says nothing: left to size itself, a left axis settles on the width a number needs, and a channel name or a label like "band-average, update" simply vanishes while the shorter ones draw (the bar charts found it first; the band-average paper again, 2026-09-26). Measured with the axis's own font, the label that is there is the label that is drawn.
Source code in src/visualdynamics/plot/__init__.py
legend_below
¶
legend_below(layout: Any, plot: Any, row: int, colors: dict | None = None, text_size: str | None = None) -> Any
A horizontal legend in its own layout row under the plot.
pyqtgraph's default legend floats inside the view, anchored to a
corner, and on a plot with any real content it lands on top of the
data — a specification's bands, an FRF's peaks — and neither can be
read (Brandon, 2026-09-01). Outside is the honest place: the plot
keeps its whole area, the names line up beneath it in columns, and
the entries still register themselves through plot.legend, so
every name= a curve was drawn with arrives as before.
Plots occupy the even rows of a layout (2 * row) and their
legends the odd ones — the window's row walker keys on
series_key, which a legend does not carry, so it steps past.
text_size is the labels' size, LEGEND_TEXT_SIZE when omitted.
Source code in src/visualdynamics/plot/__init__.py
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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
mac_frame_ratio
¶
Width over height for a MAC grid of this shape, clamped.
The frame outside the plot is sized by this and the aspect lock inside it is decided by the same clamp, so the two cannot disagree about whether cells are square — a frame narrower than the grid's own shape plus a lock inside it scrolls columns off the screen.
Source code in src/visualdynamics/plot/__init__.py
curve_colors
¶
The curve palette for a theme's plot background: the light set on a light background, the dark set on a dark one or with no theme given.
Source code in src/visualdynamics/plot/__init__.py
curve_color
¶
The nth curve's color, wrapping. The same cycle everywhere a
curve is drawn, so a record keeps its place in it between the app,
a standalone plot and the report; colors (a resolved theme) picks
the light or dark shade of it.
Source code in src/visualdynamics/plot/__init__.py
axis_label
¶
axis_label(dimension: str, unit_system: UnitSystem, hint: str | None = None) -> str
Axis label for a dimension: a typeset unit, or a note when undefined.
pyqtgraph renders label HTML, so a quotient dimension shows as a real stacked fraction rather than '(in/s**2)/lbf'.
A hint is what the source said the quantity was without saying what
scale it was on. The axis names it, since an unlabeled axis of
accelerations is less use than one that at least says 'acceleration'.
Source code in src/visualdynamics/plot/__init__.py
build_plot
¶
build_plot(layout: Any, data: Any, unit_system: UnitSystem | None = None, theme: Any = None, max_records: int = MAX_RECORDS, records: Sequence[int] | None = None, component: str = 'magnitude') -> tuple[int, int]
Draw one data array. See build_plots for several at once.
Source code in src/visualdynamics/plot/__init__.py
background_brush
¶
The plots' background: the same gradient the 3D view uses.
Anchored to the device rather than the scene, so it stays put while the data is panned and zoomed instead of sliding around behind it.
Source code in src/visualdynamics/plot/__init__.py
display_limits
¶
display_limits(data: Any, unit_system: UnitSystem) -> dict[str, ndarray]
A specification's limit curves in display units, or nothing.
Anything else is not a specification and has none, which is why this asks rather than testing the type: the plot does not need to know what a Specification is, only that some data brings bounds with it.
Source code in src/visualdynamics/plot/__init__.py
curve_budget
¶
How many curves each plot may draw, sharing one limit between them.
First come, first served lets the first plot spend the whole budget and leaves the next one empty — which is what selecting a spectrum and a time history did: one plot drew 45 curves and the other drew five.
Plots wanting less than an equal share release the rest to the others, so a two-channel plot beside a large one costs the large one almost nothing.
Source code in src/visualdynamics/plot/__init__.py
bounded_by_specification
¶
bounded_by_specification(series: Sequence[tuple[str | None, Any, Sequence[int] | None]], scales: dict[str, int] | None = None) -> tuple[Sequence[tuple[str | None, Any, Sequence[int] | None]], int]
Restrict PSDs to the records a selected specification actually bounds.
A specification is normally written for autospectra only, while a measured CPSD carries every cross term too. Drawn together, the 30 cross terms of a 6-channel CPSD are 30 curves with no limit anywhere near them — they are not wrong, they are just not the comparison being asked for, and they bury the six that are.
So when a specification is plotted alongside other PSDs, both are cut to the pairs they have in common. Nothing else is touched: a specification says nothing about a time history, and restricting one against it would drop every record for no reason.
The measured spectra are also drawn scaled to the specification
when a scaling applies — the standard practice for a run captured
below the 0 dB requirement (compliance.comparison_scale_db; held
on the object, or detected in whole dB). The scaling exists only in
the comparison: it is applied to a throwaway copy, the object's own
values are never touched, and a scaled curve says so in its legend
name. scales lets a caller who resolved the number with more
context — the app, which knows an octave PSD and the PSD it was
banded from share one scale — say what each named entry gets.
Returns (series, dropped).
Source code in src/visualdynamics/plot/__init__.py
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
scaled_for_comparison
¶
A throwaway copy of a spectrum with the comparison scale applied.
A shallow copy sharing everything but the values, because the whole point is that the object itself is never changed — the scale exists on the drawn comparison and nowhere else. The copy holds its scale at 0 so nothing downstream scales it again.
Source code in src/visualdynamics/plot/__init__.py
specification_pairs
¶
specification_pairs(series: Sequence[tuple[str | None, Any, Sequence[int] | None]]) -> list[tuple[str, str]]
The DOF pairs the plot draws one at a time, in the specification's own order.
Where there is a measurement, these are the pairs both sides have: a specification with its response is a comparison, and six of them on one axis is a thicket with no comparison visible in it.
A specification on its own is the same story without the second curve. Six targets and their two dozen limit lines are exactly as unreadable stacked together, so the channels are still offered one at a time — every channel the specification carries, since there is nothing to intersect them with.
Source code in src/visualdynamics/plot/__init__.py
only_pairs
¶
only_pairs(series: Sequence[tuple[str | None, Any, Sequence[int] | None]], pairs: Sequence[tuple[str, str]]) -> Sequence[tuple[str | None, Any, Sequence[int] | None]]
The series cut to these DOF pairs, leaving anything else alone.
The plural of only_pair, because a table under the plot can name
several channels at once where a drop-down names one.
Source code in src/visualdynamics/plot/__init__.py
only_pair
¶
only_pair(series: Sequence[tuple[str | None, Any, Sequence[int] | None]], pair: tuple[str, str]) -> Sequence[tuple[str | None, Any, Sequence[int] | None]]
The series cut to one DOF pair, leaving anything else alone.
Source code in src/visualdynamics/plot/__init__.py
pair_label
¶
How a DOF pair reads: the DOF alone when it is its own reference.
build_coherence_map
¶
build_coherence_map(layout: Any, series: Sequence[tuple[str | None, Any, Sequence[int] | None]], unit_system: UnitSystem | None = None, theme: Any = None) -> tuple[int, int]
Every channel's coherence at once: frequency across, channel down.
A line plot answers "is this channel good"; there is no reading 339 of them at once, and the curve budget means most are not even drawn. As a map the same data answers "which channels are bad, and where" in one look — a poor channel is a dark row, a poor band is a dark column.
Coherence is a bounded ratio, so the color scale is pinned to 0..1 rather than fitted to the data: a map whose scale moved with the selection would make a good channel look bad next to a better one.
Returns (rows_drawn, rows_requested); nothing is dropped, so they match.
Source code in src/visualdynamics/plot/__init__.py
cmif_curves
¶
cmif_curves(data: Any, records: Sequence[int] | None = None, unit_system: UnitSystem | None = None) -> tuple[ndarray, ndarray]
(singular values (k, freqs), display abscissa) — the CMIF.
The records assemble into the response x reference matrix they are — an absent pair is zero, the standard practical treatment of an incomplete matrix — and every frequency line gets a singular value decomposition. The largest singular value peaks at every mode; the second one peaking too is how a repeated root shows itself.
Source code in src/visualdynamics/plot/__init__.py
build_mac
¶
build_mac(view: Any, frequencies: ArrayLike, matrix: ArrayLike, theme: Any = None, column_frequencies: ArrayLike | None = None) -> tuple[int, int]
A MAC matrix as a viridis grid.
Rows and columns are modes, labeled by their frequencies; with
column_frequencies the grid is a cross-MAC — rows one set, columns
the other — and rectangular when the counts differ. The scale is
pinned 0..1 like the coherence map, because a MAC is a bounded
ratio. The color is the reading — per-cell numbers were tried and
made the grid too busy to read at a glance.
Source code in src/visualdynamics/plot/__init__.py
add_mode_markers
¶
Dashed bookmarks at each mode's frequency, labels staggered so clusters stay readable — the fitting screen's markers, wherever a modal synthesis is drawn.
The fitting screen keeps its subtle gray (the default); the resynthesis overlays pass the theme foreground instead — white on the dark theme, black on the light — so the markers read apart from the grid.
Source code in src/visualdynamics/plot/__init__.py
build_cmif
¶
build_cmif(layout: Any, series: Sequence[tuple[str | None, Any, Sequence[int] | None]], unit_system: UnitSystem | None = None, theme: Any = None) -> int
The Complex Mode Indicator Function of each selected FRF set.
One curve per singular value, log magnitude over frequency. A synthesized overlay's CMIF draws dashed in the measured set's colors, singular value for singular value — the modal model's indicator against the measurement's. Singular values that are numerically zero (a synthesis truncated below the reference count is rank-deficient) are dropped rather than drawn twenty decades down.
Returns the number of curves drawn.
Source code in src/visualdynamics/plot/__init__.py
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | |
build_plots
¶
build_plots(layout: Any, series: Sequence[tuple[str | None, Any, Sequence[int] | None]], unit_system: UnitSystem | None = None, theme: Any = None, max_records: int = MAX_RECORDS, component: str = 'magnitude') -> tuple[int, int]
Draw several data arrays into one pyqtgraph GraphicsLayout.
series is a list of (name, data, records); records may be None for
every record. Curves are grouped into a plot per (abscissa dimension,
ordinate dimension) pair, so selecting an FRF and a time history at once
stacks them on separate axes instead of nonsense-sharing one. Names
prefix the legend when more than one object is drawn.
component picks how complex frequency data is read: 'magnitude'
(log ordinate, the default), 'real', 'imag', or 'phase' (degrees,
axis pinned to ±180). Real data ignores it.
Returns (curves_drawn, curves_requested).
Source code in src/visualdynamics/plot/__init__.py
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 | |
drawing_shape
¶
'steps' | 'law' | 'line': how this object's curve is drawn.
The hard rule, for every reading of the plot — 2-D and the 3-D
waterfall alike: a density is drawn as the energy beneath it, so
the RMS is always the plain area under the curve on screen. A PSD,
a CPSD's terms and an octave-band PSD (interpolation == 'bin')
draw flat across each bin — what is summed when the object is
integrated — and a specification ('log_log') follows the power
law its breakpoints mean. Anything that is a value at a frequency
rather than an area — an FRF, a coherence, a linear spectrum, any
signed component — draws as the line it is; except a value that
belongs to a whole band, which draws flat across it, whatever
component is read: a banded coherence, or the phase of a banded
cross term, is one number for its band, not a sample at its center
(Brandon, 2026-09-27).
One implementation, consulted by build_plots and by
viz.waterfall, because a picture that disagrees with
Psd.area() is a picture of a number nobody computed. tagged
says a signed component (real/imag/phase) is being read, which is
never a density — but of a banded array, still a band's value.
Source code in src/visualdynamics/plot/__init__.py
step_outline
¶
step_outline(centers: ArrayLike, values: ArrayLike, widths: ArrayLike | None = None) -> tuple[ndarray, ndarray]
The flat-across-each-bin trace as explicit points.
What stepMode='center' has pyqtgraph draw for the 2-D plot, made
concrete for a renderer that only takes polylines — the 3-D
waterfall. Two points per bin on the bin's own edges (the same
bin_edges), values duplicated across, so the trapezoid under the
trace is exactly sum(value * width): the RMS is the area drawn.
values may be (records, lines); the outline is per row.
Source code in src/visualdynamics/plot/__init__.py
bin_edges
¶
The boundaries of the bins a set of line centers stands for.
A line of a discrete spectrum is a density over its own bin, so without more to go on the bin runs to the midpoint of the gap either side. Arithmetic midpoints, because FFT lines are evenly spaced in frequency.
widths is for a spectrum that knows better. An octave band's
center is the geometric mean of its own edges, so neither the
midpoints between neighbors nor the center plus and minus half a
width lands on them. Given the center and the width both, the edges
follow exactly: with c = sqrt(l u) and w = u - l,
u = (w + sqrt(w^2 + 4 c^2)) / 2, l = u - w
which is the positive root and needs no assumption about the bands tiling — though these do, so one edge array serves them all.
Source code in src/visualdynamics/plot/__init__.py
as_power_law
¶
as_power_law(frequencies: ArrayLike, values: ArrayLike, per_decade: int = POWER_LAW_POINTS) -> tuple[ndarray, ndarray]
A breakpoint curve resampled onto enough points to draw as one.
A specification's segments are power laws, and the plot's frequency axis is linear — so a straight line drawn between two breakpoints is not the curve the breakpoints mean, and for a decade-wide segment it runs well above it through the middle. Filled in, the polyline follows the law closely enough that the difference is under a pixel.
Left alone when the points are already dense: a controller writes its specification on the same line grid as everything else, and there is nothing between two adjacent lines to fill in.
Only over the band the specification is written for. A controller
writes zero outside it, and zero is a value the curve cannot be
drawn at on a log axis — it maps to -inf — while filling in across
it gives NaN. Either way the curve comes back full of holes, and a
gapped array is the one thing pyqtgraph cannot build a path from
safely (see gapless).
Source code in src/visualdynamics/plot/__init__.py
gapless
¶
One curve's points cut to the stretch it can be drawn over.
pyqtgraph builds a QPainterPath two ways. With no gaps it fills a
QPolygonF, which is Qt's own API. With gaps — more than 2% of the
points non-finite — it packs a byte buffer by hand and has Qt
deserialize it, against a private binary layout its own docstring
warns "may change in future versions of Qt". That is the path the
intermittent Bus error was raised from, and the only curve on the
plot taking it was a specification: 404 non-finite points in 1083,
because it is written to zero outside its band.
So a curve is cut to the run of it that says something rather than handed over with holes in. Nothing is bridged: the cut is the first and last point that can be drawn, so a curve that stops is drawn stopping.
Source code in src/visualdynamics/plot/__init__.py
data_curves
¶
The curves on a plot that are data, not the invisible edges the limit shading is built from.
Source code in src/visualdynamics/plot/__init__.py
zone_colors
¶
The fills of a specification's zones and of its exceedances, as QColors — one place, so the legend's swatch is the plot's fill.
Yellow between warning and abort; past abort, which way: red above,
blue below. Both were red once, which said "out of tolerance" and
left the direction to be read off the geometry — where every other
mark on the plot already says over in red and under in blue. The
exceedance boxes are the same hues, stronger (EXCEED_ALPHA).
Source code in src/visualdynamics/plot/__init__.py
zone_key
¶
What a specification's shading is called in a legend: the warning
band, the zones above and below abort and the exceedance marks, each
only when drawn (zones of 'warning', 'above', 'below'; exceeded
of 'exceed_over', 'exceed_under'), with each band's decibels when the
specification holds it at one value (found, from _zone_decibels).
One rule for every plot that shades them — the app's (build_plots)
and the report's, which must always match (Brandon, 2026-09-27).
Returns:
| Type | Description |
|---|---|
list of (str, str)
|
(zone, name), in the order a legend lists them. |
Source code in src/visualdynamics/plot/__init__.py
plot_data
¶
plot_data(data: DataArray, unit_system: UnitSystem | None = None, theme: Any = None, show: bool = True, title: str | None = None, size: tuple[int, int] = (1000, 700), path: str | PathLike | None = None, marks: str | None = None, **kwargs: Any) -> Any
Plot a data array in a window, or to a file with path.
Returns the DataPane (or the path). Complex data gets the component
box over it — the same control the app offers — so which part is
drawn is a choice rather than an argument. With show=True and no
Qt event loop already running, this blocks until the window is
closed.
marks puts a time history's own reading over the trace, which is
what the app's two toggles do: 'averaging' brackets the frames a
spectrum is averaged over, 'shocks' brackets the events an SRS is
computed from. Both are read from the history — whatever it carries,
or what the detector would suggest — and neither can be dragged
here, since there is nothing on the other end of a drag in a file.
Source code in src/visualdynamics/plot/__init__.py
save_plot
¶
save_plot(data: DataArray, path: str | PathLike, unit_system: UnitSystem | None = None, theme: Any = None, size: tuple[int, int] = (1200, 800), **kwargs: Any) -> Any
Render a data array to an image file (.png or .svg), no window.
Source code in src/visualdynamics/plot/__init__.py
render_image
¶
A widget painted into an image at ratio device pixels per
logical pixel.
The one way a plot becomes pixels. pyqtgraph's ImageExporter scales the scene to a requested width, and not evenly: exported at three times a plot's width, legend labels came out at a third of their set size and QFont tick labels half again too large, while HTML titles were right (the band-average paper's print figures, 2026-09-26). Painted through a painter whose device carries the ratio, the scene is laid out once, at its logical size, and every item — text, pens, fills — is drawn scaled by the same factor, as a high-density screen draws it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
|
QWidget
|
Laid out already, at its logical size. |
required |
ratio
|
float
|
Device pixels per logical pixel. |
1.0
|
background
|
color
|
What the image is filled with first; transparent when omitted. |
None
|
Returns:
| Type | Description |
|---|---|
QImage
|
|
Source code in src/visualdynamics/plot/__init__.py
2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 | |
save_image
¶
save_image(widget: Any, path: str | PathLike, *, dpi: float | None = None, theme: Any = None) -> str
A laid-out plot widget written to a .png, at dpi for print.
The widget is drawn at its logical size scaled by dpi / 96
(render_image), on the theme's plot background, and the file says
its resolution, so a figure laid out at 3.42 in (328 logical pixels)
and saved at 300 dpi is 1026 pixels that print at 3.42 in, every
font at its set size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
|
QWidget
|
The plot, laid out at its printed size in logical pixels. |
required |
path
|
str or path - like
|
Where the .png goes. |
required |
dpi
|
float
|
Dots per inch; one pixel per logical pixel when omitted. |
None
|
theme
|
optional
|
Whose plot background to fill with. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The path written. |
Source code in src/visualdynamics/plot/__init__.py
plot_mac
¶
plot_mac(shapes: ShapeSet, other: ShapeSet | None = None, *, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] | None = None, bars: bool = False, screenshot: str | None = None) -> Any
The MAC grid the GUI draws: shapes against itself, or the
cross-MAC against other.
The picture defaults to 700 tall by the grid's own shape, clamped the
way the app clamps it, so a 139-against-8 cross-MAC renders as the
same tall panel it is on screen rather than being stretched into a
square. Pass size to say otherwise.
bars=True is the plot bar's 3-D reading: the matrix as bars,
height and color both the value. A scene renders through its own
plotter, so it takes screenshot= rather than path=, like every
other 3-D view.
Source code in src/visualdynamics/plot/__init__.py
plot_mac_matrix
¶
plot_mac_matrix(frequencies: ArrayLike, matrix: ArrayLike, *, column_frequencies: ArrayLike | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] | None = None, bars: bool = False, screenshot: str | None = None) -> Any
Draw a MAC matrix somebody else computed — plot_mac for two
sets that share DOF names, Project.plot_mac for the projected
comparison across geometries. One drawing, whoever did the sum.
frequencies label the rows; column_frequencies the columns
when they are another set's.
Source code in src/visualdynamics/plot/__init__.py
plot_cmif
¶
plot_cmif(frf: Frf, shapes: ShapeSet | None = None, *, modes: Iterable[int] | None = None, unit_system: UnitSystem | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] = (1000, 700)) -> Any
The CMIF the fitting screen draws: the measured indicator, and
with shapes the modal model's synthesis dashed over it.
Source code in src/visualdynamics/plot/__init__.py
plot_coherence_map
¶
plot_coherence_map(coherence: _CoherenceBase, *, unit_system: UnitSystem | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] = (1000, 700)) -> Any
The coherence map: frequency across, channel down, pinned 0..1.
Source code in src/visualdynamics/plot/__init__.py
build_photos
¶
build_photos(layout: Any, photos: Photos, picks: Sequence[int] | None = None, start_row: int = 0) -> int
Photos stacked down a layout, each at its own aspect ratio with its name as the title.
Drawing starts at start_row and the layout is not cleared, so
several sets can stack into one layout — which is what selecting
two Photos objects in the app does. Returns how many were drawn.
Source code in src/visualdynamics/plot/__init__.py
plot_photos
¶
plot_photos(photos: Photos, picks: Iterable[int] | None = None, *, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] = (900, 700)) -> Any
The photos, as the app shows them.
Source code in src/visualdynamics/plot/__init__.py
plot_series
¶
plot_series(items: Sequence[tuple[str | None, Any, Sequence[int] | None]], unit_system: UnitSystem | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] = (1000, 700), component: str = 'magnitude', **kwargs: Any) -> Any
Several data arrays on one figure — what selecting more than one object in the tree draws.
visualdynamics.plot.plot_series([frf, synthesized], path='both.png')
Each item is a data array, or (name, data), or
(name, data, records) to draw only some of its records. Curves
group onto an axis per quantity, so an FRF and a time history stack
rather than sharing one, and names prefix the legend.
Source code in src/visualdynamics/plot/__init__.py
build_ratio
¶
build_ratio(layout: Any, signal: Any, floor: Any, records: Sequence[int] | None = None, theme: Any = None) -> int
The signal-to-noise of the louder density over the quieter, in decibels, one curve per shared channel — the reading of two selected PSDs (Brandon, 2026-08-25). Returns how many channels drew.
The signal's power is the louder density less the quieter, over
the quieter (snr.signal_to_noise, 2026-10-03), so a line where
the two are equal is not 0 dB but no signal at all, and is left
undrawn. Linear in dB on purpose, not a log axis of the linear
ratio: the number being read is the decibel. A dashed line at
0 dB marks where the signal's power equals the noise's.
records restricts to the named rows of the louder side, the
grid's own picks.
Source code in src/visualdynamics/plot/__init__.py
plot_ratio
¶
plot_ratio(signal: Any, floor: Any, *, records: Sequence[int] | None = None, unit_system: UnitSystem | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] = (1000, 700)) -> Any
The signal-to-noise of a driven density over its ambient one, line by line, in decibels — the headless call for the toolbar's Signal to noise reading of two selected PSDs.
visualdynamics.plot.plot_ratio(driven_psds, noise_psds,
path='snr.png')
The signal's power is the driven less the ambient, over the
ambient (visualdynamics.core.snr); a line with no signal above
the floor is not drawn.
Source code in src/visualdynamics/plot/__init__.py
plot_comparison
¶
plot_comparison(measured: Any, specification: Any, *, pair: tuple[str, str] | None = None, unit_system: UnitSystem | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] = (1000, 700)) -> Any
One control channel against its specification, shaded.
visualdynamics.plot.plot_comparison(psds, spec, path='control.png')
The comparison the app draws when a specification and the PSDs it bounds are selected together: the measurement stepped flat across each bin, the requirement as the power law its breakpoints mean, and the ground outside the abort limits shaded — red above the upper, blue below the lower.
One channel at a time, because six of them and their two dozen limit
lines on one axis is a thicket. pair names which, as the DOF pair
the dropdown lists (('101Z+', '101Z+')); the first the two have in
common by default. Band it first — psds.to_octave(6) — to compare
on proportional bands instead.
Source code in src/visualdynamics/plot/__init__.py
plot_kurtosis
¶
plot_kurtosis(history: Any, *, records: Sequence[int] | None = None, low: float | None = None, high: float | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] | None = None) -> Any
How Gaussian each channel of a record is, a bar apiece.
visualdynamics.plot.plot_kurtosis(history, path='kurtosis.png')
Pearson kurtosis, where 3 is Gaussian: above the band the record carries peaks the spectrum does not predict, below it the record is clipped or was never random. Every channel whatever it measures — kurtosis is dimensionless — and the thresholds default to one either side of nominal.
Source code in src/visualdynamics/plot/__init__.py
plot_snr
¶
plot_snr(signal: Any, floor: Any, *, records: Sequence[int] | None = None, low: float | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] | None = None) -> Any
How far each channel's signal stands above its noise, a bar apiece: RMS signal-to-noise in dB.
visualdynamics.plot.plot_snr(driven_psds, noise_psds,
path='snr_bars.png')
The headless call for the toolbar's RMS signal to noise reading of
two selected PSDs. Each channel's power is the area under its
density over the band the two share, and the reading is
10 log10((P_driven - P_ambient) / P_ambient)
(visualdynamics.core.snr). low is the floor a channel is
judged against, core.snr.THRESHOLD_DB by default; a channel
with no signal above its noise has no bar and is named as at the
noise floor, and one whose ambient recorded nothing is left out.
Source code in src/visualdynamics/plot/__init__.py
plot_scalogram
¶
plot_scalogram(history: Any, channel: int = 0, *, low: float | None = None, high: float | None = None, per_octave: int | None = None, omega0: float | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] | None = None) -> Any
Where one channel's frequencies are, moment by moment.
from visualdynamics.plot import plot_scalogram
plot_scalogram(history, path='scalogram.png')
The flat form of the app's wavelet reading: time across, frequency
up a logarithmic axis, magnitude as color in the record's own
units. The cone of influence is shaded, because inside it the
picture is an artifact of where the record was cut and looks
exactly like data. Time is held to core.wavelet.COLUMNS columns
by peak-hold — each column its slice's largest magnitude, the
reading core.wavelet.scalogram_peaks gives the app's own view —
so a long record draws in bounded memory; a script that wants the
transform itself calls core.wavelet.scalogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
history
|
TimeHistory
|
The record to read. |
required |
channel
|
int
|
Which channel. One at a time: a scalogram is dense enough that two side by side read as noise rather than as two answers. |
0
|
low
|
float
|
The frequency range, in Hz. Defaults span from where a handful
of the longest wavelets still fit inside the record up to just
under Nyquist — a range the record can actually carry
( |
None
|
high
|
float
|
The frequency range, in Hz. Defaults span from where a handful
of the longest wavelets still fit inside the record up to just
under Nyquist — a range the record can actually carry
( |
None
|
per_octave
|
int
|
Lines per octave. Defaults to |
None
|
omega0
|
float
|
Cycles under the wavelet: the time-against-frequency trade.
Defaults to |
None
|
theme
|
Any
|
As every other plot here. |
None
|
path
|
Any
|
As every other plot here. |
None
|
show
|
Any
|
As every other plot here. |
None
|
title
|
Any
|
As every other plot here. |
None
|
size
|
Any
|
As every other plot here. |
None
|
Returns:
| Type | Description |
|---|---|
The pane, or the path written.
|
|
Source code in src/visualdynamics/plot/__init__.py
2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 | |
plot_sine_tracking
¶
plot_sine_tracking(history: Any, specification: Any, settings: Any, *, tone: str | None = None, channel: str | None = None, onset: float | None = None, lines: int | None = None, unit_system: UnitSystem | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] = (1000, 700)) -> Any
One tone of a recording read through several tracking bands and detectors, the levels overlaid against frequency over the specification.
from visualdynamics.core.sine_tracking import SineTracking
visualdynamics.plot.plot_sine_tracking(
history, spec,
[SineTracking(detector='peak'),
SineTracking(proportional=0.5),
SineTracking(proportional=0.1)],
path='tracking.png')
The readings are core.sine_tracking.track_sine's, one per
setting, on one channel: channel names its DOF, the
specification's first control channel by default. Each reading
is drawn in its own color and with its own marker shape, named by
SineTracking.describe; the specification's target for the tone
stands behind them in gray.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
history
|
TimeHistory
|
The recording. |
required |
specification
|
SineSweepSpecification
|
The sweep the drive followed. |
required |
settings
|
SineTracking or sequence of SineTracking
|
The readings to overlay. |
required |
tone
|
str
|
Which tone; the specification's first by default. |
None
|
channel
|
str
|
The DOF drawn; the first control channel by default. |
None
|
onset
|
float
|
Seconds into the recording where the tone's sweep begins; found by matched filter when omitted. |
None
|
lines
|
int
|
Readings along the sweep, |
None
|
unit_system
|
UnitSystem | None
|
As for every standalone plot. |
None
|
theme
|
UnitSystem | None
|
As for every standalone plot. |
None
|
path
|
UnitSystem | None
|
As for every standalone plot. |
None
|
show
|
UnitSystem | None
|
As for every standalone plot. |
None
|
title
|
UnitSystem | None
|
As for every standalone plot. |
None
|
size
|
UnitSystem | None
|
As for every standalone plot. |
None
|
Returns:
| Type | Description |
|---|---|
object
|
The pane, or the path written. |
Source code in src/visualdynamics/plot/__init__.py
2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 | |
plot_tracking_filter
¶
plot_tracking_filter(history: Any, specification: Any, setting: Any, *, tone: str | None = None, channel: str | None = None, onset: float | None = None, cursor: float | None = None, cursor_hz: float | None = None, span: tuple[float, float] | None = None, harmonics: Sequence[int] | None = None, low: float | None = None, high: float | None = None, omega0: float | None = None, unit_system: UnitSystem | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] = (1100, 760)) -> Any
One tone's tracking band drawn on the record it reads: the record and what the band passes, the record's time-frequency picture with the band's corridor following the sweep, and the band's shape at a cursor.
from visualdynamics.core.sine_tracking import SineTracking
visualdynamics.plot.plot_tracking_filter(
history, spec, SineTracking(proportional=0.5),
cursor_hz=100.0, path='band.png')
The passed waveform is core.sine_tracking.track_waveform's, the
band track_sine reads its levels through; the picture is the
wavelet scalogram in dB below its largest, with the cone of
influence veiled; the corridor's edges are the drive plus and
minus half the bandwidth, so a proportional band runs parallel to
the tone up the log axis and a fixed one pinches toward the top.
Beside the picture, the band's magnitude at the cursor on the same
frequency axis, the drive marked inside it and each harmonic
outside; behind the cursor on the record, the band's weight on the
record before it, as long as the band takes to settle. Shown in a
window, the cursor drags. One setting per call; plot_sine_tracking
overlays the levels several settings read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
history
|
TimeHistory
|
The recording. |
required |
specification
|
SineSweepSpecification
|
The sweep the drive followed. |
required |
setting
|
SineTracking
|
The band, which must have one (proportional or fixed). |
required |
tone
|
str
|
Which tone; the specification's first by default. |
None
|
channel
|
str
|
The DOF drawn; the first control channel by default. |
None
|
onset
|
float
|
Seconds into the recording where the tone's sweep begins; found by matched filter when omitted. |
None
|
cursor
|
float
|
Where the shape is read, seconds on the record's clock; the middle of the tone's span by default. |
None
|
cursor_hz
|
float
|
Or the instant the drive first reaches this frequency, Hz. Not both. |
None
|
span
|
(float, float)
|
The stretch of record the time axes show; the whole record by default. |
None
|
harmonics
|
sequence of int
|
The multiples of the drive marked, |
None
|
low
|
float
|
The picture's frequency range, Hz: an octave under the sweep up to half again past the highest harmonic marked by default. |
None
|
high
|
float
|
The picture's frequency range, Hz: an octave under the sweep up to half again past the highest harmonic marked by default. |
None
|
omega0
|
float
|
Cycles under the picture's wavelet,
|
None
|
unit_system
|
UnitSystem | None
|
As for every standalone plot. |
None
|
theme
|
UnitSystem | None
|
As for every standalone plot. |
None
|
path
|
UnitSystem | None
|
As for every standalone plot. |
None
|
show
|
UnitSystem | None
|
As for every standalone plot. |
None
|
title
|
UnitSystem | None
|
As for every standalone plot. |
None
|
size
|
UnitSystem | None
|
As for every standalone plot. |
None
|
Returns:
| Type | Description |
|---|---|
object
|
The pane, or the path written. |
Source code in src/visualdynamics/plot/__init__.py
2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 | |
plot_bars
¶
plot_bars(measured: Any, specification: Any, mode: str = 'error', *, low: float | None = None, high: float | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] | None = None, summary: str = 'over') -> Any
The comparison as a bar per control channel.
visualdynamics.plot.plot_bars(psds, spec, 'error', path='error.png')
mode picks the reading, which is the choice the app's toolbar
offers: 'error' is the level — how far each channel's RMS sits
from what was asked for, in dB, over the band they share — and
'lines' is the shape — how much of each channel's band fell
outside an abort limit. A channel can sit at exactly the right level
and still be out of tolerance across half its band, which is why
both exist. 'srs' is the shock reading: each channel's SRS
against its target, as a signed RMS deviation in dB.
low and high are the thresholds, defaulting to +/-3 dB and 10%.
The chart grows with the channel count rather than squeezing them
in, so size defaults to whatever fits the channels there are.
Below it, a key to the colors. summary places the count: 'over'
the bars, in the plot's 'title' (what a narrow printed figure
wants), or 'none'.
Source code in src/visualdynamics/plot/__init__.py
2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 | |
plot_replication
¶
plot_replication(measured: Any, specification: Any, mode: str = 'waveform', *, event: int | None = None, channel: str | None = None, low: float | None = None, high: float | None = None, theme: Any = None, path: str | PathLike | None = None, show: bool = True, title: str | None = None, size: tuple[int, int] | None = None) -> Any
How closely a transient replicated the waveform it was asked for.
visualdynamics.plot.plot_replication(record, target, 'srs', path='srs.png')
mode picks the reading, the same four the app's bar offers:
'overlay' draws one repeat over the target it was aiming at, and
'waveform', 'srs' and 'level' are the three numbers — the
difference between the waveforms as a share of the target, the
worst deviation of the shock response spectra, and the scale alone.
event is which repeat, counting from zero; left out, the bars
report every repeat and the overlay draws the first. No repeat is
singled out as the worst one — that is a judgment about what the
article is for, not a measurement, and the numbers are all returned
for the caller to make it with.
channel is which control DOF the overlay draws, defaulting to the
first. One at a time and not all of them: six measured curves over
six targets share one set of colors, and nothing on the plot then
says which curve is the target.
Source code in src/visualdynamics/plot/__init__.py
3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 | |