State.initialize_filesystem#

State.initialize_filesystem(working_dir: Optional[Path] = None, *, configs_dir: Path | tuple[Path, ...] = ('configs',), data_dir: Path | tuple[Path, ...] = ('data',), output_dir: str | Path = 'output', profile_dir: Optional[Path] = None, cache_dir: Optional[Path] = None, settings_file_name: str = 'settings.yaml', pipeline_file_name: str = 'pipeline', **silently_ignored_kwargs) State#

Initialize the state’s filesystem.

ActivitySim has a number of features to extract settings, model configs, data, and other inputs automatically from various files, and to write outputs to the file system in various locations. These directories are defined very early in a model run, and other settings are loaded based on them, so for convenience the filesystem settings are collected together in a single pydantic validated object separate from all other settings.

All arguments to this function beyond working_dir are keyword-only. Keyword arguments other than those listed are silently ignored.

Parameters:
working_dirpath-like, optional

The top-level working directory for the model. When other directories are given as relative paths, those relative paths are evaluated relative to this directory.

configs_dirpath-like or tuple of path-like, default “configs”

Directories containing model configurations and settings. ActivitySim model runs can be configured with settings file inheritance to avoid duplicating settings across model configurations, e.g. to allow for single-process and multiprocess configurations that share most of their inputs and settings.

data_dirpath-like or tuple of path-like, default “data”

The directories where input data files can be found.

output_dirpath-like, default “output”

Most ActivitySim output will be written to this directory (or subdirectories within it).

profile_dirpath-like, optional

If runtime instrumentation is turned on, pyinstrument profiling output will be written in this directory. If not given, a unique time-stamped subdirectory will be created in the output directory.

cache_dirpath-like, optional

Various intermediate files may be stored in the cache directory. This should be a writable and readable location, and cached files may persist and be re-used by various different model runs. It should always be safe to simply delete everything in the cache directory, as everything saved here should be recreated automatically from other inputs if it is missing (although it may take some time to do so).

settings_file_namestr, default “settings.yaml”

Top level settings are defined in this file, which should be found in one or more configs_dir locations.

pipeline_file_namestr, default “pipeline”

The base filename for checkpointed intermediate outputs.

Returns:
selfState