slv.inversion.cache.fips_cache#

slv.inversion.cache.fips_cache(filename, key=None)[source]#

Content-addressed cache decorator for the pipeline’s component functions.

Parameters:
  • filename – Stage name / cache stem (e.g. "obs", "prior_error").

  • key – Optional key(config, *args, **kwargs), called with the function’s arguments before the cache is looked up: what the component depends on beyond the config (JSON-able), hashed into its key. The forward operator and the MDM use it for the footprints they are built from (_footprint_key in slv.inversion.pipelines).

Notes

The decorated function takes the InversionConfig as its first argument; its result is pickled. Files are stored under {cache_dir}/.fips/{version_tag}/{component}/{hash}.pkl where version_tag pins the running fips/pystilt source revision (git describe of the editable checkout, else installed metadata; see _version_tag) and hash is derived only from the config fields that actually affect that component (see DEFAULT_COMPONENT_DEPS), plus the release versions of the packages it is built with (lair / uataq, see DEFAULT_COMPONENT_PACKAGES; a new lair release rebuilds the obs and prior, not the Jacobian) and the component’s revision (see DEFAULT_COMPONENT_REVISIONS; bumped when slv changes what the component holds). Committing/bumping a package therefore lands in a fresh tree rather than silently reusing a stale component (a pickle written by another fips does not load). This means:

  • Changing prior_base_std reuses obs.pkl and forward_operator.pkl untouched, and only regenerates prior_error.pkl.

  • Configs that share the same upstream parameters share the same files — no manual cache wiping is needed.

config.cache controls caching:

  • False / None — no caching (default)

  • True — cache in the current working directory

  • str / Path — cache in that directory

config.cache_overwrite controls forced recomputation:

  • [] — never overwrite (default)

  • "all" — overwrite every component

  • [component, …] — overwrite specific components (all hashes for that component are deleted and the component is recomputed fresh)