Batch execution and runtime#
Utilities for looping over many studies on disk and exporting consistent manifests.
discover_study_dirs(root, selected=None)returns study folder paths (optionally filtered by name) with helpful error messages when nothing is found.run_batch_studies(studies_root, study_loader, output_root, ...)iterates through discovered study folders, converts each to aStudyviastudy_loader, runs analysis (default: study planner + executor), then callssave_study_results.
- mrax.core.batch.discover_study_dirs(studies_root: str | Path, selected: Sequence[str] | None = None) list[Path]#
Return study directories to process, optionally filtering by name.
- mrax.core.batch.run_batch_studies(studies_root: str | Path, study_loader: Callable[[Path], Study | tuple[Study, dict[str, Any] | None]], output_root: str | Path, selected: Sequence[str] | None = None, analysis_fn: Callable[[...], list[dict[str, Any]]] | None = None, analysis_kwargs: dict[str, Any] | None = None, save_kwargs: dict[str, Any] | None = None, device: str | Device = 'cpu') list[dict[str, Any]]#
Load studies from a folder, run analysis/fitting, and persist results.
The batch runner processes studies as independent jobs. Provide a
study_loaderthat converts a study folder into aStudy(plus optional metadata), and an optionalanalysis_fnto override the default Study planner/executor flow. Results are saved underoutput_root/<study_name>usingsave_study_results().Returns a list of dictionaries summarizing each run with
study_name,manifest_path,results,metadata, andstudy_dirkeys.
Runtime helpers#
- mrax.core.runtime.release_memory(*, gc_collect: bool = True, clear_jax_cache: bool = True) None#
Release Python/JAX caches to reduce peak memory in long workflows.