pyfebiopt.optimize.storage
Minimal storage helpers for FEBio optimization runs.
Classes
Resolve a working directory for FEBio simulations. |
|
Manage working directories, persistent artifacts, and series exports. |
Module Contents
- class pyfebiopt.optimize.storage.StorageManager
Resolve a working directory for FEBio simulations.
Users can either provide a parent directory on disk or ask for a temporary directory under
/tmp. When/tmpis selected, the project folder is named after the current working directory.- parent: pathlib.Path | None = None
- use_tmp: bool = False
- create: bool = True
- resolve() pathlib.Path
Return the directory where all simulation files should be generated.
- cleanup_path(path: pathlib.Path) None
Remove a file or directory tree under the storage root.
- cleanup_all(keep: collections.abc.Iterable[pathlib.Path] | None = None) None
Remove all children under the storage root except entries in
keep.
- class pyfebiopt.optimize.storage.StorageWorkspace(storage_opts: pyfebiopt.optimize.options.StorageOptions, cleanup_opts: pyfebiopt.optimize.options.CleanupOptions)
Manage working directories, persistent artifacts, and series exports.
Configure storage locations based on user options.
- storage
- storage_mode
- cleanup_mode
- cleanup_previous
- workdir = None
- log_file
- describe() list[str]
Describe storage configuration in human-readable bullet points.
- Returns:
List of formatted bullet strings.
- next_iter_dir() pathlib.Path
Allocate and create a new iteration folder.
- Returns:
Path to the created iteration directory.
- prune_old_iterations(last_iter_dir: pathlib.Path | None) None
Delete previous iteration folders depending on cleanup policy.
- final_cleanup() None
Apply cleanup policy after the optimization finishes.
- write_series(series: collections.abc.Mapping[str, collections.abc.Mapping[str, collections.abc.Sequence[float]]]) None
Persist time/series data to
results/*.txtfiles under the work root.
- export_final_base_files(final_iter_dir: pathlib.Path | None) None
Copy final
*_basesimulation files tooptimized_simulations.The exported filenames drop the
_basemarker so users see only the final optimizer result, not the implementation detail used during runs.