visualdynamics.viz.sinespec¶
sinespec
¶
The sine specification on a 3-D stage: frequency, time, amplitude.
A sine sweep specification has three dimensions: each tone is a path through time and frequency with an amplitude along it, and its warning and abort limits follow the same path above and below. Drawn as amplitude against frequency the timing is lost (which tones overlap, which cross, which are done before the others begin), so the specification's own view is this stage: frequency across, time receding, amplitude up, one polyline per curve.
It is the same stage the waterfall is drawn on (STAGE,
place_camera), so the two 3-D views look alike. Amplitudes are drawn
in the display unit system. A specification with undeclared units is
drawn with its raw values, and the axis title then gives no unit.
Functions:
| Name | Description |
|---|---|
limit_zones |
The zones a requirement's limits shade on a stage, as the 2-D |
sine_stage_arrays |
The curves of the stage for one |
add_sine_specification |
Draw the specification alone, for one |
add_sine_stage |
Draw the sine stage into a plotter. |
sine_specification_scene |
Build a PyVista plotter showing the specification's stage for one |
plot_sine_specification |
Show one |
plot_sine_stage |
The sine stage with measured levels on it, the app's 3-D sine |
Classes¶
Functions:¶
limit_zones
¶
The zones a requirement's limits shade on a stage, as the 2-D
comparison shades them: yellow between warning and abort, and past
abort by direction, red above up to the stage's ceiling and blue
below down to its floor (zero), the same over and under colors as
every other mark. A warning with no abort limit beside it runs to
the ceiling or the floor.
level(name) gives a limit's heights on the stage, or None when it
was not written, and length is how many points each has. Returns
(inner, outer, color key) for each zone. The banded and the sine
stages both use it.
Source code in src/visualdynamics/viz/sinespec.py
sine_stage_arrays
¶
sine_stage_arrays(specification: Any, channel: int = 0, unit_system: UnitSystem | None = None, lines: int = LINES, tones: Any = None) -> dict[str, Any]
The curves of the stage for one channel, as plain arrays.
Returns a dict: tones, one entry per tone (only those named in
tones when it is given), each with its name, t
(environment seconds), f (Hz) and curves, a dict of
amplitude curves in display units with 'target' always and each
written limit beside it; zlabel, the amplitude axis title; and
channel, the channel's DOF. Each tone's path is sampled at about
lines points. Pure numpy, so a test can check the numbers without
a scene.
Source code in src/visualdynamics/viz/sinespec.py
add_sine_specification
¶
add_sine_specification(plotter: Any, specification: Any, channel: int = 0, unit_system: UnitSystem | None = None, theme: Any = None, lines: int = LINES, tones: Any = None) -> dict[str, Any]
Draw the specification alone, for one channel: add_sine_stage
with no levels. Returns its dict.
Source code in src/visualdynamics/viz/sinespec.py
add_sine_stage
¶
add_sine_stage(plotter: Any, specification: Any = None, levels: Any = None, dof: str | None = None, unit_system: UnitSystem | None = None, theme: Any = None, lines: int = LINES, tones: Any = None, dofs: Sequence[str] | None = None) -> dict[str, Any]
Draw the sine stage into a plotter.
The stage draws either a specification's tones, measured levels, or
both. The tones are drawn as target curves, one color per tone, with
the warning and abort limits as thin lines and also as the
translucent zones the 2-D comparison shades (limit_zones). The
levels are each tone's extracted path in the tone's color, placed in
time by its own per-line clock, with a rectangle over each line that
went outside one of its tone's abort limits. When both are drawn, the targets are in
the specification gray the 2-D comparison uses, because the
measurement is what is being looked at. A level's clock is aligned
to the specification's (its onset to the tone's start time) when its
tone is in the specification, and is left in recording seconds
otherwise. tones limits the drawing to the named tones, and each
tone is sampled at about lines points.
dofs draws several control DOFs at once, one entry per (tone,
DOF): the rows picked in the tree, with the tone chosen on the bar.
dof is the one-DOF form that the report and the specification-only
view use. An entry is named by its tone when one DOF is drawn and by
tone and DOF when several are, and a level path takes the color of
the entry it belongs to.
Returns the dict of sine_stage_arrays (its tones for every
DOF drawn) with levels, the level paths drawn, and points,
the vertex count, added.
Source code in src/visualdynamics/viz/sinespec.py
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 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
sine_specification_scene
¶
sine_specification_scene(specification: Any, channel: int = 0, unit_system: UnitSystem | None = None, plotter: Any = None, off_screen: bool = False, theme: Any = None) -> Any
Build a PyVista plotter showing the specification's stage for one
channel, or add it to plotter.
Called the same way as waterfall_scene: returns the plotter, to
.show(), or to .screenshot() when it is off screen.
Source code in src/visualdynamics/viz/sinespec.py
plot_sine_specification
¶
plot_sine_specification(specification: Any, channel: int = 0, *, screenshot: str | None = None, unit_system: UnitSystem | None = None, theme: Any = None, show: bool = True) -> Any
Show one channel of the specification's stage interactively, or
render it to screenshot: the script version of the plot bar's 3-D
specification view. Returns the image array when rendering to a
file, and otherwise the plotter (finish_scene).
Source code in src/visualdynamics/viz/sinespec.py
plot_sine_stage
¶
plot_sine_stage(specification: Any = None, levels: Any = None, *, dofs: Sequence[str] | None = None, tones: Any = None, unit_system: UnitSystem | None = None, theme: Any = None, screenshot: str | None = None, show: bool = True) -> Any
The sine stage with measured levels on it, the app's 3-D sine
comparison: a specification's tones and the levels extracted
against it (a SineLevelSet or a list of SineLevel), either or
both, shown interactively or rendered to screenshot
(add_sine_stage). plot_sine_specification draws the
specification alone. Returns the image array when rendering to a
file, and otherwise the plotter.
from visualdynamics.viz.sinespec import plot_sine_stage
plot_sine_stage(spec, project['Sine Levels'], tones=['Up'],
dofs=['101Z+'], screenshot='sine.png')
dofs and tones limit it, as picking rows in the tree and the
tone on the bar do; everything is drawn when they are left out.