Reconstruction¶
Reconstruction and forecasting from DMD results.
reconstruction ¶
Reconstruction and forecasting from DMD results.
Two functions replace the seven in the old dmd_reconstruction module:
reconstruct— rebuild the signal from selected modes/pairs, with optional stabilisation.forecast— likereconstructbut designed for extrapolation, with eigenvalue modification support.
Functions:
| Name | Description |
|---|---|
reconstruct |
Rebuild the signal from a DMDResult using selected modes or pairs. |
forecast |
Extrapolate beyond the training window, optionally modifying eigenvalues for stabilisation or frequency changes. |
reconstruct ¶
reconstruct(result: DMDResult, times: ndarray | None = None, pairs: list[int] | None = None, mode_indices: list[int] | None = None, stable: bool = False) -> np.ndarray
Rebuild the signal from a DMD decomposition.
This single function replaces reconstruct_dmd,
reconstruct_dmd_complex, reconstruct_specific_modes, and
reconstruct_conjugate_pairs from the old API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
DMDResult
|
Output of |
required |
times
|
ndarray
|
Time vector. Defaults to |
None
|
pairs
|
list of int
|
Conjugate-pair numbers (0-indexed) to include. Converted to mode indices internally. Mutually exclusive with mode_indices. |
None
|
mode_indices
|
list of int
|
Raw mode indices to include. Mutually exclusive with pairs. |
None
|
stable
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Reconstructed keypoints, shape |
Notes
With stable=False, uses the full eigenvalue reconstruction:
x̃(t) = Re[ Σⱼ bⱼ φⱼ exp(λⱼ t) ]
With stable=True, strips growth/decay for bounded output:
x̃(t) = Σ_{pairs} 2|b| |φ| cos(|ω|t - θ)
Raises:
| Type | Description |
|---|---|
ValueError
|
If both pairs and mode_indices are supplied. |
Source code in src/birddmd/reconstruction.py
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 | |
forecast ¶
forecast(result: DMDResult, times: ndarray, pairs: list[int] | None = None, mode_indices: list[int] | None = None, stable: bool = True, modify_eigenvalues: dict | None = None) -> np.ndarray
Extrapolate beyond the training window.
Like reconstruct but with additional controls for
eigenvalue modification (e.g. changing frequencies, zeroing
specific modes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
DMDResult
|
Output of |
required |
times
|
ndarray
|
Forecast time vector (may extend beyond training window). |
required |
pairs
|
list of int
|
Conjugate-pair numbers to include. |
None
|
mode_indices
|
list of int
|
Raw mode indices to include. |
None
|
stable
|
bool
|
If |
True
|
modify_eigenvalues
|
dict
|
Eigenvalue modifications. Keys:
|
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Forecast keypoints, shape |
Notes
This replaces run_forecast, run_forecast_with_modified_modes,
and modify_mode_frequencies from the old API.
Source code in src/birddmd/reconstruction.py
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 | |