pyfebiopt.optimize.storage ========================== .. py:module:: pyfebiopt.optimize.storage .. autoapi-nested-parse:: Minimal storage helpers for FEBio optimization runs. Classes ------- .. autoapisummary:: pyfebiopt.optimize.storage.StorageManager pyfebiopt.optimize.storage.StorageWorkspace Module Contents --------------- .. py:class:: 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 ``/tmp`` is selected, the project folder is named after the current working directory. .. py:attribute:: parent :type: pathlib.Path | None :value: None .. py:attribute:: use_tmp :type: bool :value: False .. py:attribute:: create :type: bool :value: True .. py:method:: resolve() -> pathlib.Path Return the directory where all simulation files should be generated. .. py:method:: cleanup_path(path: pathlib.Path) -> None Remove a file or directory tree under the storage root. .. py:method:: cleanup_all(keep: collections.abc.Iterable[pathlib.Path] | None = None) -> None Remove all children under the storage root except entries in ``keep``. .. py:class:: 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. .. py:attribute:: storage .. py:attribute:: storage_mode .. py:attribute:: cleanup_mode .. py:attribute:: cleanup_previous .. py:attribute:: workdir :value: None .. py:attribute:: log_file .. py:method:: describe() -> list[str] Describe storage configuration in human-readable bullet points. :returns: List of formatted bullet strings. .. py:method:: next_iter_dir() -> pathlib.Path Allocate and create a new iteration folder. :returns: Path to the created iteration directory. .. py:method:: prune_old_iterations(last_iter_dir: pathlib.Path | None) -> None Delete previous iteration folders depending on cleanup policy. .. py:method:: final_cleanup() -> None Apply cleanup policy after the optimization finishes. .. py:method:: write_series(series: collections.abc.Mapping[str, collections.abc.Mapping[str, collections.abc.Sequence[float]]]) -> None Persist time/series data to ``results/*.txt`` files under the work root. .. py:method:: export_final_base_files(final_iter_dir: pathlib.Path | None) -> None Copy final ``*_base`` simulation files to ``optimized_simulations``. The exported filenames drop the ``_base`` marker so users see only the final optimizer result, not the implementation detail used during runs.