save2matlab - cchandre/HamLorenz GitHub Wiki
save2matlab
(function)
Purpose
Saves the results of a simulation to a .mat
file compatible with MATLAB.
Parameters
sol
: Solution object returned by an ODE solver (e.g.,solve_ivp
), containing time and state arrays.filename
: Name of the output file (default:'data'
). The function saves tofilename.mat
.
Saved Data
The following variables are saved in the .mat
file:
t
: Time array (sol.t
).X
: State variables (firstN
rows ofsol.y
, transposed).Xs
: Desymmetrized state variables, transposed.Casimirs
: Casimir invariants (self.casimir_coeffs
).date
: Current date.author
: Hardcoded as'[email protected]'
.
Features
- Uses
scipy.io.savemat
to write the data. - Prints a confirmation message with the file name.
Notes
- Assumes
self.N
defines the dimension of the physical state. self.desymmetrize
is used to obtain symmetric-reduced data.