Projectors and modal decompositions¶
The projector interface provides a common fit / encode / decode workflow for modal
reduction. The package includes POD and spectral POD, together with standalone decomposition
functions in pod_utils.
romda.models.data_driven.autoencoders.Projector
¶
Bases: ABC
Abstract base for all dimensionality-reduction building blocks, linear
(POD, SPOD) or nonlinear (autoencoders).
Every projector shares the same sklearn-style interface: fit learns the
representation from data, encode maps state space to the latent space,
and decode maps back. reconstruct and score are provided as
concrete methods built on top of encode/decode.
Attributes:
| Name | Type | Description |
|---|---|---|
N_latent |
int
|
Size of the latent (bottleneck) space. For |
fitted |
bool
|
Whether |
Q_mean |
ndarray
|
Temporal mean removed from the data during preprocessing, shape
\((N_x, 1)\). Raises |
fit(X)
abstractmethod
¶
Learn the projection from data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Snapshot data, shape \((N_x, N_t)\). |
required |
Returns:
| Type | Description |
|---|---|
Projector
|
The fitted instance ( |
Source code in src/models/data_driven/autoencoders/__init__.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
encode(X)
abstractmethod
¶
Map snapshot data to the latent representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Snapshot data, shape \((N_x, N_t)\). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Latent coefficients \(\mathbf{Z}\), shape \((N_\mathrm{latent}, N_t)\). |
Source code in src/models/data_driven/autoencoders/__init__.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
decode(Z)
abstractmethod
¶
Map latent coefficients back to state space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Z
|
ndarray
|
Latent coefficients, shape \((N_\mathrm{latent}, N_t)\). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Reconstructed state \(\hat{\mathbf{X}}\), shape \((N_x, N_t)\). |
Source code in src/models/data_driven/autoencoders/__init__.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
reconstruct(X)
¶
Full round-trip: encode then decode.
Source code in src/models/data_driven/autoencoders/__init__.py
131 132 133 | |
score(X)
¶
Mean squared reconstruction error in the flat, zero-mean space,
where \(\mathbf{Q} = \mathrm{preprocess}(X)\) and
\(\hat{\mathbf{Q}} = \mathrm{decode}(\mathrm{encode}(X)) - \bar{\mathbf{Q}}\)
(with \(\bar{\mathbf{Q}}\) the stored Q_mean).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Snapshot data, shape \((N_x, N_t)\). |
required |
Returns:
| Type | Description |
|---|---|
float
|
Mean squared reconstruction error. |
Source code in src/models/data_driven/autoencoders/__init__.py
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 | |
grid_index_to_flat_rows(grid_idx)
¶
Map raw-grid indices to rows of the masked flat representation (Psi / Q_mean rows).
Both the raw grid and the flat representation use variable-block ordering: raw index = var * Nx * Ny + g (g = flattened (x, y) position), flat row = var * N_fluid + fluid_pos (position of g among the fluid points).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid_idx
|
array-like of int
|
Raw-grid indices (e.g., sensor locations). Must correspond to fluid points. |
required |
Returns:
| Type | Description |
|---|---|
np.ndarray of int
|
Row indices into Psi / Q_mean corresponding to the requested grid points. |
Source code in src/models/data_driven/autoencoders/__init__.py
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 | |
preprocess_snapshot(X, subtract_mean=True)
¶
Build the zero-mean data matrix from raw snapshot fields, automatically detecting and removing NaN-masked solid-body points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Raw snapshot data, either a single field \((N_t, N_x, N_y)\) or a stack of fields \((N_u, N_t, N_x, N_y)\). |
required |
subtract_mean
|
bool
|
If True (default), subtract the temporal mean row-wise. |
True
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Zero-mean data matrix \(\mathbf{Q}\), shape \((N_\mathrm{fluid} \cdot n_\mathrm{fields}, N_t)\), ready for decomposition. |
Source code in src/models/data_driven/autoencoders/__init__.py
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 | |
romda.models.data_driven.autoencoders.POD(n_modes=20, method='randomized', n_iter=4, random_state=None, grid_shape=None, domain=None, **kwargs)
¶
Bases: Projector
Snapshot POD.
Inherits the shared interface from Projector (fit/encode/decode/
reconstruct/score/N_latent) and adds linear-specific attributes,
geometry helpers, and plotting utilities.
Two solvers are available via method:
'exact'— full eigendecomposition of the temporal correlation matrix \(\mathbf{C} = \mathbf{Q}^\mathrm{T}\mathbf{Q} / N_t\) (Sirovich 1987, snapshot method: seesnapshot_pod). Exact but \(\mathcal{O}(N_t^3)\).'randomized'(default) — randomized SVD of \(\mathbf{Q}\) (Halko, Martinsson & Tropp 2011: seesnapshot_pod_randomized). Returns only the leadingn_modesmodes; fast and memory-efficient.
Either way, writing \(\mathbf{Q} = \mathbf{X} - \bar{\mathbf{Q}}\) for the zero-mean
data matrix, fit(X) stores the orthonormal spatial modes \(\boldsymbol{\Psi}\)
and singular values \(\boldsymbol{\Sigma}\) of \(\mathbf{Q}\), together with the
temporal coefficients \(\boldsymbol{\Phi} = \boldsymbol{\Psi}^\mathrm{T}\mathbf{Q}\),
so that
with equality when all \(N_t\) modes are retained (n_modes >= N_t, method='exact').
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_modes
|
int
|
Number of modes retained (the latent-space size). Default 20. |
20
|
method
|
str
|
|
'randomized'
|
n_iter
|
int
|
Power-iteration steps for the randomized solver. Default 4. |
4
|
random_state
|
int
|
Seed for reproducibility of the randomized solver. |
None
|
grid_shape
|
tuple
|
Grid shape |
None
|
domain
|
list
|
Physical domain |
None
|
**kwargs
|
Pre-set any instance attribute (e.g. pre-computed |
{}
|
Attributes:
| Name | Type | Description |
|---|---|---|
Sigma |
ndarray
|
Singular values (descending), shape \((N_\mathrm{latent},)\). |
Psi |
ndarray
|
Spatial modes with orthonormal columns, shape \((N_x, N_\mathrm{latent})\). |
Phi |
ndarray
|
Temporal coefficients, shape \((N_\mathrm{latent}, N_t)\). |
Q_mean |
ndarray
|
Temporal mean \(\bar{\mathbf{Q}}\), shape \((N_x, 1)\). |
References
Sirovich (1987). Turbulence and the dynamics of coherent structures. Quart. Appl. Math., XLV(3), 561-590.
Halko, Martinsson & Tropp (2011). Finding structure with randomness. SIAM Review, 53(2), 217-288.
Source code in src/models/data_driven/autoencoders/pod.py
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 | |
N_modes
property
writable
¶
Backward-compatible alias for N_latent.
domain_mesh
property
¶
Meshgrid for the spatial domain.
Returns:
| Name | Type | Description |
|---|---|---|
X1 |
ndarray
|
First coordinate array, shape |
X2 |
ndarray
|
Second coordinate array, shape |
fit(X)
¶
Fit the POD to data X.
Accepts a flat matrix \((N_x, N_t)\) or a raw grid array \((N_u, N_t, N_x, N_y)\) / \((N_t, N_x, N_y)\). For raw grid input the NaN solid-body mask is detected and stored automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Snapshot data, flat or raw grid (see above). |
required |
Returns:
| Type | Description |
|---|---|
POD
|
The fitted instance ( |
Source code in src/models/data_driven/autoencoders/pod.py
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 | |
encode(X)
¶
Project X onto the spatial modes,
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Snapshot data, shape \((N_x, N_t)\). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Latent (POD) coefficients \(\mathbf{Z}\), shape \((N_\mathrm{latent}, N_t)\). |
Source code in src/models/data_driven/autoencoders/pod.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
decode(Z, idx=None)
¶
Reconstruct the state in the original space from latent coefficients,
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Z
|
ndarray
|
Latent coefficients, shape \((N_\mathrm{latent}, N_t)\). |
required |
idx
|
ndarray
|
Indices selecting a subset of rows of |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Reconstructed state, shape \((N_x, N_t)\), or |
Source code in src/models/data_driven/autoencoders/pod.py
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 | |
reconstruct(X=None, n_modes=None, Phi=None)
¶
Full round-trip: encode, decode, then map back to the physical grid (when a grid mask is available).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X
|
ndarray
|
Raw input, grid or flat. If None, the stored |
None
|
n_modes
|
int
|
Retain only the first |
None
|
Phi
|
ndarray
|
Pre-computed latent coefficients, shape \((N_\mathrm{latent}, N_t)\);
skips the |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Reconstructed state, on the physical grid if |
Source code in src/models/data_driven/autoencoders/pod.py
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 | |
energy_fraction()
¶
Relative and cumulative energy per mode, from the eigenvalues \(\lambda_j = \Sigma_j^2\) of the temporal correlation matrix \(\mathbf{C}\):
Returns:
| Name | Type | Description |
|---|---|---|
rel |
ndarray
|
Relative energy per mode, shape \((N_\mathrm{latent},)\). |
cum |
ndarray
|
Cumulative energy fraction captured by the first \(j\) modes, shape \((N_\mathrm{latent},)\). |
Source code in src/models/data_driven/autoencoders/pod.py
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
truncate(n_modes)
¶
Truncate to the first n_modes modes in-place.
Source code in src/models/data_driven/autoencoders/pod.py
343 344 345 346 347 348 349 350 351 352 | |
original_data_to_domain_of_interest(original_data)
¶
Crop original-grid data to the fitted domain of interest.
Source code in src/models/data_driven/autoencoders/pod.py
373 374 375 376 377 378 379 380 381 382 383 384 385 | |
compute_MSE(ROM_data, original_data, time_evolution=False)
staticmethod
¶
Mean Squared Error between ROM reconstruction and original data.
Source code in src/models/data_driven/autoencoders/pod.py
390 391 392 393 394 395 396 397 398 | |
compute_RMS(ROM_data, original_data)
staticmethod
¶
Root Mean Square error (field).
Source code in src/models/data_driven/autoencoders/pod.py
400 401 402 403 404 | |
flatten(*args)
staticmethod
¶
Flatten multi-dimensional arrays to 2-D (space × time).
Source code in src/models/data_driven/autoencoders/pod.py
406 407 408 409 410 | |
romda.models.data_driven.autoencoders.SPOD(Nf=0, filter_kind='gaussian', n_modes=20, grid_shape=None, domain=None, **kwargs)
¶
Bases: POD
Spectral POD via the filtered correlation matrix (Sieber, Paschereit & Oberleithner, 2016).
Inherits the full POD interface (fit/encode/decode/reconstruct);
only _decompose is overridden, delegating to spod_sieber. The snapshot
correlation matrix \(\mathbf{C} = \mathbf{Q}^\mathrm{T}\mathbf{Q}/N_t\) is
replaced by a low-pass filtered version before the eigensolve,
where \(\mathbf{G}\) is a banded symmetric Toeplitz filter matrix built from a
normalised 1-D kernel of half-width Nf (filter_kind selects
'gaussian', 'box' or 'hann'). The eigendecomposition of
\(\tilde{\mathbf{C}}\) then follows exactly as in snapshot_pod, giving
orthonormal spatial modes \(\boldsymbol{\Psi}\), temporal coefficients
\(\boldsymbol{\Phi} = \boldsymbol{\Psi}^\mathrm{T}\mathbf{Q}\) and singular
values \(\boldsymbol{\Sigma}\). Setting Nf=0 skips the filtering step and
exactly recovers snapshot POD; per Sieber et al. (2016), as Nf grows
towards \(N_t/2\) the SPOD modes are reported to approach Fourier (DFT) modes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Nf
|
int
|
Filter half-width (0 recovers POD; \(N_t/2\) approaches the DFT limit). |
0
|
filter_kind
|
str
|
|
'gaussian'
|
n_modes
|
int
|
Number of modes to retain. Default 20. |
20
|
grid_shape
|
tuple
|
Grid shape |
None
|
domain
|
list
|
Physical domain |
None
|
**kwargs
|
Forwarded to |
{}
|
Attributes:
| Name | Type | Description |
|---|---|---|
C_tilde |
ndarray
|
Filtered correlation matrix \(\tilde{\mathbf{C}}\), shape \((N_t, N_t)\)
(stored after |
References
Sieber, Paschereit & Oberleithner (2016). Spectral proper orthogonal decomposition. J. Fluid Mech., 792, 798–828.
Source code in src/models/data_driven/autoencoders/pod.py
469 470 471 472 473 474 475 476 477 478 479 480 481 482 | |
romda.models.data_driven.autoencoders.pod_utils.snapshot_pod(Q)
¶
Snapshot POD — exact solver.
Solves the eigenvalue problem of the temporal correlation matrix,
and reconstructs the (large) spatial modes from the eigenvectors \(\mathbf{A}\) of the (small, \(N_t \times N_t\)) matrix \(\mathbf{C}\) — the "method of snapshots" of Sirovich (1987):
\(\boldsymbol{\Psi}\) has orthonormal columns and, for the modes with \(\lambda_j > 0\), \(\mathbf{Q} = \boldsymbol{\Psi}\boldsymbol{\Phi}\) exactly. Modes with \(\lambda_j \le 0\) (numerical noise) are set to zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Q
|
ndarray
|
Zero-mean data matrix, shape \((N_x, N_t)\). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Sigma |
ndarray
|
Singular values (descending), shape \((N_t,)\). |
Psi |
ndarray
|
Spatial modes with orthonormal columns, shape \((N_x, N_t)\). |
Phi |
ndarray
|
Temporal coefficients, shape \((N_t, N_t)\). |
C |
ndarray
|
Temporal correlation matrix, shape \((N_t, N_t)\). |
References
Sirovich (1987). Turbulence and the dynamics of coherent structures. Quart. Appl. Math., XLV(3), 561–590.
Source code in src/models/data_driven/autoencoders/pod_utils.py
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 | |
romda.models.data_driven.autoencoders.pod_utils.snapshot_pod_randomized(Q, n_modes=20, n_iter=4, random_state=None)
¶
Randomized snapshot POD.
Computes a truncated randomized SVD of \(\mathbf{Q}\) (via
sklearn.utils.extmath.randomized_svd, falling back to a full
numpy.linalg.svd if scikit-learn is unavailable),
and returns
The \(\boldsymbol{\Sigma} = \mathbf{S}/\sqrt{N_t}\) scaling matches the
eigenvalue-based normalisation of snapshot_pod, since
\(\mathbf{Q}^\mathrm{T}\mathbf{Q}/N_t = \mathbf{V}(\mathbf{S}^2/N_t)\mathbf{V}^\mathrm{T}\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Q
|
ndarray
|
Zero-mean data matrix, shape \((N_x, N_t)\). |
required |
n_modes
|
int
|
Leading modes to compute. Default 20. |
20
|
n_iter
|
int
|
Power-iteration steps. Default 4. |
4
|
random_state
|
int
|
Seed for reproducibility. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Sigma |
ndarray
|
Singular values (descending), shape \((N_\mathrm{modes},)\). |
Psi |
ndarray
|
Spatial modes (approximately orthonormal), shape \((N_x, N_\mathrm{modes})\). |
Phi |
ndarray
|
Temporal coefficients, shape \((N_\mathrm{modes}, N_t)\). |
References
Halko, Martinsson & Tropp (2011). Finding structure with randomness. SIAM Review, 53(2), 217–288.
Source code in src/models/data_driven/autoencoders/pod_utils.py
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 | |
romda.models.data_driven.autoencoders.pod_utils.spod_sieber(Q, Nf, kind='gaussian')
¶
Sieber spectral POD — filtered correlation matrix.
Low-pass filters the temporal correlation matrix
\(\mathbf{C} = \mathbf{Q}^\mathrm{T}\mathbf{Q}/N_t\) with the banded
symmetric Toeplitz matrix \(\mathbf{G}\) (see _toeplitz_filter_matrix,
built from a normalised kernel of half-width Nf, see
_filter_kernel),
then solves the same "method of snapshots" eigenvalue problem as
snapshot_pod, with \(\tilde{\mathbf{C}}\) in place of \(\mathbf{C}\):
Nf=0 skips the filtering step (\(\tilde{\mathbf{C}} = \mathbf{C}\)) and
recovers standard snapshot POD exactly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Q
|
ndarray
|
Zero-mean data matrix, shape \((N_x, N_t)\). |
required |
Nf
|
int
|
Filter half-width (0 recovers POD; \(N_t/2\) approaches the DFT). |
required |
kind
|
str
|
|
'gaussian'
|
Returns:
| Name | Type | Description |
|---|---|---|
Sigma |
ndarray
|
Singular values (descending), shape \((N_t,)\). |
Psi |
ndarray
|
Spatial modes with orthonormal columns, shape \((N_x, N_t)\). |
Phi |
ndarray
|
Temporal SPOD coefficients, shape \((N_t, N_t)\). |
C_tilde |
ndarray
|
Filtered correlation matrix, shape \((N_t, N_t)\). |
References
Sieber, Paschereit & Oberleithner (2016). Spectral proper orthogonal decomposition. J. Fluid Mech., 792, 798–828.
Source code in src/models/data_driven/autoencoders/pod_utils.py
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 | |
romda.models.data_driven.autoencoders.pod_utils.spod_towne(Q, dt=1.0, n_fft=None, n_ovlp=None, window='hamming', weight=None, conf_level=0.95)
¶
Spectral POD via Welch-averaged cross-spectral density (Towne et al., 2018).
Splits \(\mathbf{Q}\) into n_blks overlapping blocks of length n_fft
(Welch's method, step n_fft - n_ovlp), windows and Fourier-transforms
each block, then — at every frequency — solves a "method of snapshots"
eigenvalue problem across blocks (analogous to snapshot_pod, but with
blocks in place of time snapshots) to avoid ever forming the full
\(N_x \times N_x\) cross-spectral density (CSD) matrix.
For block \(b = 0, \dots, n_\mathrm{blk}-1\) starting at snapshot \(b\,(n_\mathrm{fft}-n_\mathrm{ovlp})\), the windowed block DFT at frequency \(f_k\) is
with \(w\) the window. Stacking the blocks,
\(\hat{\mathbf{Q}}_k = [\hat{\mathbf{q}}^{(1)}_k, \dots,
\hat{\mathbf{q}}^{(n_\mathrm{blk})}_k] \in \mathbb{C}^{N_x \times n_\mathrm{blk}}\),
the (weighted) cross-block Gram matrix and its eigendecomposition give the
SPOD modes and modal energies at frequency \(f_k\):
with \(\mathbf{W} = \mathrm{diag}(\mathrm{weight})\) the spatial weight matrix (\(\mathbb{I}\) by default). The modal energy spectrum is \(L_k = \boldsymbol{\lambda}_k\), doubled (\(L_k = 2\boldsymbol{\lambda}_k\)) at interior frequency bins of a real, one-sided spectrum to account for the folded negative-frequency energy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Q
|
ndarray
|
Zero-mean data matrix, shape \((N_x, N_t)\). |
required |
dt
|
float
|
Time step. |
1.0
|
n_fft
|
int
|
Block/FFT length. Default \(2^{\lfloor \log_2 (N_t / 10) \rfloor}\). |
None
|
n_ovlp
|
int
|
Block overlap. Default |
None
|
window
|
str or ndarray
|
Window name (passed to |
'hamming'
|
weight
|
ndarray
|
Spatial integration weights \(\mathrm{diag}(\mathbf{W})\), shape \((N_x,)\). Uniform weights (no integration) by default. |
None
|
conf_level
|
float
|
Target confidence level for the chi-squared-based interval |
0.95
|
Returns:
| Name | Type | Description |
|---|---|---|
L |
ndarray
|
Modal energy spectrum, shape |
Psi |
ndarray
|
Complex SPOD spatial modes, shape |
f |
ndarray
|
Frequency vector, shape |
Lc |
ndarray
|
Nominal confidence bounds |
info |
dict
|
Effective |
Notes
Lc is computed from scipy.special.gammaincinv(1 - conf_level, n_blks)
and scipy.special.gammaincinv(conf_level, n_blks), intended as a
chi-squared confidence interval in the spirit of Welch's method. However,
scipy.special.gammaincinv(a, y) requires its second argument \(y\)
(a probability) in \([0, 1]\), whereas here it is called with \(y =\)
n_blks (an integer \(\ge 2\)); numerically this returns nan for the
n_blks values produced by this function. Treat Lc as unverified
until this is checked against the intended formula.
References
Towne, Schmidt & Colonius (2018). Spectral proper orthogonal decomposition and its relationship to dynamic mode decomposition and resolvent analysis. J. Fluid Mech., 847, 821–867.
Source code in src/models/data_driven/autoencoders/pod_utils.py
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 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 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
romda.models.data_driven.autoencoders.pod_utils.spod_towne_reconstruct(Psi, A_blk, n_fft, n_ovlp, N_t)
¶
Reconstruct snapshots from Towne SPOD modes [stub — not yet implemented].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Psi
|
ndarray
|
SPOD spatial modes, as returned by |
required |
A_blk
|
ndarray
|
Block expansion coefficients. |
required |
n_fft
|
int
|
Block/FFT length used by |
required |
n_ovlp
|
int
|
Block overlap used by |
required |
N_t
|
int
|
Number of snapshots in the reconstructed series. |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
Always — inverse SPOD is not yet implemented. |
References
Nekkanti & Schmidt (2021). Frequency-time analysis, low-rank reconstruction and denoising of turbulent flows using SPOD. J. Fluid Mech., 926, A26.
Source code in src/models/data_driven/autoencoders/pod_utils.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | |
romda.models.data_driven.autoencoders.pod_utils.print_spod_towne_summary(info)
¶
Pretty-print the block/frequency parameters of a spod_towne run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
info
|
dict
|
The |
required |
Source code in src/models/data_driven/autoencoders/pod_utils.py
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | |
romda.models.data_driven.autoencoders.pod_utils.energy_fraction(Sigma)
¶
Relative energy fraction and cumulative energy per mode.
From the eigenvalues \(\lambda_j = \Sigma_j^2\) of the (possibly filtered) temporal correlation matrix,
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Sigma
|
ndarray
|
Singular values, as returned by |
required |
Returns:
| Name | Type | Description |
|---|---|---|
rel |
ndarray
|
Relative energy per mode (sums to 1). |
cum |
ndarray
|
Cumulative relative energy. |
Source code in src/models/data_driven/autoencoders/pod_utils.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |