zoomy_core.model.models.legacy.basis_cache module#
Hash-based cache for basis function matrices.
Replaces the old flat-file cache in Basismatrices with a manifest-based system: - Each (basis_type, level, weight) combination gets a unique hash - All matrices stored in a single .npz file per hash - Central manifest.json tracks all entries with metadata - Stale detection via basis definition fingerprint
- class zoomy_core.model.models.legacy.basis_cache.BasisMatrixCache(cache_root='.cache/basismatrices')#
Bases:
objectHash-based cache for basis matrices.
- Usage:
cache = BasisMatrixCache() matrices = cache.get_or_compute(basis, level) # matrices is a dict: {“M”: np.array, “A”: np.array, …}
- get_or_compute(basis, level, compute_fn)#
Load cached matrices or compute and cache them.
- Parameters:
basis (Basisfunction) – The basis function object.
level (int) – Polynomial level.
compute_fn (callable) – Function that computes matrices. Called as compute_fn(level) and should set self.M, self.A, etc. on the Basismatrices object. Returns a dict of {name: np.ndarray}.
- Returns:
dict
- Return type:
{name: np.ndarray} for each matrix
- list_entries()#
- clear()#