zoomy_core.misc.misc module#
Shared utilities: SymPy-friendly arrays, dynamic structs, and runtime paths.
- class zoomy_core.misc.misc.ZArray(iterable, *args, **kwargs)#
Bases:
MutableDenseNDimArrayEnhanced SymPy Array that supports matrix multiplication (@) and vector algebra (+, -) with lists and Zstructs.
- tomatrix()#
Return a SymPy
Matrix(rank-2 arrays only).
- flatten()#
Flattens the N-dimensional array into a 1D ZArray. Uses the internal _array list which is inherently flat in SymPy NDimArrays.
- subs(*args, **kwargs)#
Substitutes expressions within the ZArray. Supports SymPy’s standard subs API: .subs(old, new), .subs({old: new}), or .subs([(old, new)])
- property flat#
Flat.
- zoomy_core.misc.misc.get_main_directory()#
Get main directory.
- class zoomy_core.misc.misc.Zstruct(**kwargs)#
Bases:
SimpleNamespaceDynamic structure that behaves like a Namespace but supports iteration and index access (based on insertion order).
- length()#
- get_list(recursive=True)#
Nested list view of values (used when flattening symbolic trees).
- Parameters:
recursive (bool) –
- as_dict(recursive=True)#
Serialize to plain dicts (recursive for nested
Zstruct).- Parameters:
recursive (bool) –
- items(recursive=False)#
Items.
- Parameters:
recursive (bool) –
- keys()#
Keys.
- values()#
Values.
- contains(key)#
Contains.
- update(zstruct, recursive=True)#
Update.
- Parameters:
recursive (bool) –
- classmethod from_dict(d)#
Build a
Zstructtree from nested dicts.
- class zoomy_core.misc.misc.Settings(**kwargs)#
Bases:
ZstructRun configuration (output paths, snapshots, etc.) for drivers and solvers.
- classmethod default()#
Reasonable defaults for local runs and tests.
- classmethod from_json(filepath)#
Load settings from a JSON file on disk.
- write_json(filepath=None)#
Persist settings next to the simulation output unless
filepathis given.