visualdynamics.report¶
report
¶
Render a Report to one self-contained HTML file.
The whole point is the reader: they open the file in the browser they already have — no install, no network, no third-party code inside the deliverable. Everything interactive is a few hundred lines of our own JavaScript: an orthographic trackball scene that animates mode shapes with the same phase math as the desktop animator, and a zoomable log-magnitude plot with visualdynamics's own axis labels. Data rides along as one JSON payload, already converted to the display unit system, so the file shows exactly what the screen showed.
Functions:
| Name | Description |
|---|---|
render_html |
The report as one HTML document string. |
resolve_references |
{{Object Name.field}} in report text becomes the live value. |
scalogram_channel_options |
The DOF names a scalogram block may draw — for the editor's |
export_html |
One figure, interactive, as a single self-contained HTML file. |
Classes¶
Functions:¶
render_html
¶
render_html(report: Report, objects: Mapping[str, Any], unit_system: UnitSystem | None = None, edit: bool = False, channel_js: str | None = None, object_groups: Sequence[Mapping[str, Any]] | None = None, selected: int | None = None, labels: list[tuple[str, str]] | None = None, fill: bool = False, theme: str | None = None) -> str
The report as one HTML document string.
links is the project's object groups: symbolic bindings like
'@basis:Frf' resolve against them, so a report depends on the
project's structure, never on what anyone named their objects.
Reading mode skips blocks whose references cannot resolve —
an unbound template block is a slot to fill, not an error to show a
reader. Edit mode keeps them as cards to rebind, tags every block
with its index, frames the block at selected, and wires one
message to the app over Qt's web channel — which block was
clicked. Every act lives on the application's bar and pane
(2026-09-08); the page carries no insert bars, block toolbars or
editors. Only the app ever loads edit mode; the exported file
carries none of it.
labels, when given, is filled with (label, caption) for every
numbered figure and table in order — what the editor's Reference
menu offers, from the same numbering the page shows.
fill makes the page one figure filling its frame, without title,
marking or toggle (export_html); theme, 'light' or 'dark', fixes
the page's theme where it would otherwise follow the reader.
Source code in src/visualdynamics/report/__init__.py
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 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 | |
resolve_references
¶
resolve_references(text: str, objects: Mapping[str, Any], us: UnitSystem, object_groups: Sequence[Mapping[str, Any]] | None = None) -> str
{{Object Name.field}} in report text becomes the live value.
The whole point is templates: a summary that says how the data was sampled fills itself in whatever project the template lands in. The name may be a symbolic selector — {{@basis:TimeHistory. sample_rate}} — resolved against the object groups, so the text depends on no one's naming either. A reference that cannot resolve — no such object, or a field the object cannot answer — stays visible as written, the same way an unbound block stays a slot instead of an error.
Source code in src/visualdynamics/report/__init__.py
scalogram_channel_options
¶
The DOF names a scalogram block may draw — for the editor's drop-down (Brandon, 2026-08-29: the figure shows one channel, so the reader chooses which).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
dict
|
The scalogram plot block. |
required |
objects
|
mapping
|
The report's objects, name to object. |
required |
object_groups
|
sequence
|
The project's object groups, for symbolic source bindings. |
()
|
Returns:
| Type | Description |
|---|---|
list of str
|
The response DOFs the block's |
Source code in src/visualdynamics/report/__init__.py
export_html
¶
export_html(path: str | PathLike, data: Any = None, *, specification: Any = None, channel: str | None = None, mode: str = 'curves', geometry: Any = None, shapes: Any = None, dofs: tuple[str, Any] | None = None, name: str | None = None, caption: str = '', theme: str | None = None, unit_system: UnitSystem | None = None, fill: bool = True) -> str
One figure, interactive, as a single self-contained HTML file.
visualdynamics.export_html('spec.html', psd, specification=spec,
channel='101Z+', theme='light')
visualdynamics.export_html('modes.html', geometry=g, shapes=modes)
The figure the report draws — zoom, pan and the readout on a plot,
turning and animating on a scene — with nothing else: no title and
no marking, and with fill the figure takes whatever frame holds
it, an iframe or a box on a slide, redrawing when the frame changes
size (Brandon, 2026-09-27, for an interactive slide deck from the
scripts that draw a paper's printed figures). Everything the page
needs is in the file, so it opens offline.
A plot of data — against specification and its zones when one
is given, one channel of it when named, in mode ('curves',
'stage', 'cmif', 'mac' or 'map'); or, given a geometry, a scene of
it, its shapes animating or the dofs one object measures as a
quantity, ('acceleration', frf), drawn as labeled arrows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or path - like
|
Where the .html goes. |
required |
data
|
DataArray or ShapeSet
|
What a plot draws. |
None
|
specification
|
Specification
|
What |
None
|
channel
|
str
|
The one control channel of a comparison to draw. |
None
|
mode
|
str
|
The plot's reading. |
'curves'
|
geometry
|
Geometry
|
Makes the figure a scene. |
None
|
shapes
|
ShapeSet
|
What the scene animates. |
None
|
dofs
|
(str, object)
|
A quantity and an object: its DOFs of that quantity, as arrows. |
None
|
name
|
str
|
What the legend calls |
None
|
caption
|
str
|
A line under the figure. |
''
|
theme
|
('light', 'dark')
|
Fixes the figure's theme; unset, it follows the reader's. |
'light'
|
unit_system
|
UnitSystem
|
The units it is drawn in. |
None
|
fill
|
bool
|
Fill the frame; False lays it out as the report page does. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
The path written. |
Source code in src/visualdynamics/report/__init__.py
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 3050 3051 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 | |