dymad.sako.base¶
Functions
|
Encode one trainer batch via typed-runtime payloads. |
|
Apply SAKO to the identified eigenpairs to compute the corresponding residuals |
Classes
|
Interface for spectral analysis of KBF and DKBF models. |
|
The base class for Spectral Analysis based on Koopman operator theory. |
- class dymad.sako.base.SAInterface(model_class, checkpoint_path, device=None)¶
Bases:
DataInterfaceInterface for spectral analysis of KBF and DKBF models.
- get_weights()¶
Get the linear weights of the dynamics model.
- Return type:
tuple[ndarray,...]
- property snapshot: SpectralSnapshot¶
Typed spectral snapshot extracted from checkpoint-backed model state.
- class dymad.sako.base.SpectralAnalysis(model_class, checkpoint_path, forder='full', dt=1.0, reps=1e-10, remove_one=True, etol=1e-13, exec_context=None)¶
Bases:
objectThe base class for Spectral Analysis based on Koopman operator theory.
The formulation is based on the following convention: Psi_0 A = Psi_1 where A is the finite-dimensional approximation of Koopman operator, Psi’s are data matrices with each row containing one time step.
- Parameters:
dt (
float) – Time step size.
- estimate_measure(fobs, order, eps, thetas=101)¶
Estimate the measure of the observable along the unit circle.
- estimate_ps(grid=None, return_vec=False, mode='cont', method='standard')¶
Estimate pseudospectrum over a grid.
In disc mode, the grid is assumed to be on discrete-time complex plane; the estimator should perform discrete-time resolvent analysis, using time step size of data In cont mode, the grid is assumed to be on continuous-time complex plane; the estimator should perform continuous-time resolvent analysis
- Parameters:
grid – Mode disc: points on discrete-time plane (Re, Im) Mode cont: points on continuous-time plane (zeta, omega)
return_vec – If return I/O modes
mode – ‘cont’ or ‘disc’
- eval_eigfun(X, idx, rng=None)¶
Evaluate the eigenfunctions at given locations, possibly in embedded space
- eval_eigfun_par(par, idx, func, rng=None)¶
Evaluate the eigenfunctions at given parametrization
- eval_eigfunc_jac(ref=None, rng=None, **kwargs)¶
- Return type:
ndarray
- eval_eigmode_jac(ref=None, rng=None, **kwargs)¶
- Return type:
ndarray
- filter_spectrum(order='full', remove_one=True)¶
Apply SAKO to the identified eigenpairs to compute the corresponding residuals
- plot_eigfun_2d(rngs, Ns, idx, mode='angle', space='full', ncols=2, figsize=(6, 10), fig=None)¶
Plot the 2D eigenfunctions as contours.
- plot_eigjac_contour(ref=None, rng=None, eig='func', lam='ct', comp='ri', idx='all', shape=(), contour_args=None, **kwargs)¶
Plot contour maps for Jacobian eigfunction/eigmode components.
- plot_eigs(fig=None, plot_full='bo', plot_filt='r^', mode='disc')¶
Plot the eigenvalues in the complex plane.
- plot_pred(x0s, ts, ref=None, ifobs=False, idx='all', ncols=1, figsize=(6, 8), title=None, fig=None)¶
Plot the predicted trajectories in data space or latent space.
- plot_vec_line(idx, which='func', modes=None, ncols=1, figsize=(6, 10))¶
Plot slices of eigenfunctions/eigenmodes as vectors.
- predict(x0, tseries, return_obs=False)¶
Make time-domain prediction.
- Parameters:
x0 – Initial states
tseries – Time series at which to evaluate the solutions.
return_obs – If return observables over time as well
- resolvent_analysis(z, return_vec, mode, method)¶
Perform resolvent analysis of the DMD operator.
- Parameters:
method – ‘standard’ - The projected approach where I/O modes are all in DMD mode space, which is true for a low-rank DMD operator.
- set_conj_map(J)¶
Compute the conjugacy map assuming an equilibrium point at x=0 with Jacobian J. Consider eigendecomposition: J = W * L * V^H locally a principal eigenfunction is approximately phi_i(x) = v_i^H x
- dymad.sako.base.encode_runtime_batch(model, batch)¶
Encode one trainer batch via typed-runtime payloads.
- Return type:
ndarray
- dymad.sako.base.filter_spectrum(sako, eigs, order='full', remove_one=True)¶
Apply SAKO to the identified eigenpairs to compute the corresponding residuals