Command Line Interface#

ActivitySim includes a Command Line Interface for creating examples and running the model. See activitysim -h for more information.

Note

The example_manifest.yaml contains example commands to create and run several versions of the examples.

Create#

Create an ActivitySim example setup. See activitysim create -h for more information. More complete examples, including the full scale prototype MTC regional demand model are available for creation by typing activitysim create -l. To create these examples, ActivitySim downloads the large input files from the ActivitySim resources repository.

API#

activitysim.cli.create.add_create_args(parser)#

Create command args

activitysim.cli.create.create(args)#

Create a new ActivitySim configuration from an existing template.

Use the -l flag to view a list of example configurations, then copy to your own working directory. These new project files can be run with the ‘run’ command.

activitysim.cli.create.get_example(example_name, destination, benchmarking=False, optimize=True, link=True)#

Copy project data to user-specified directory.

Examples and their data are described in a manifest YAML file. Each example contains at least a name and include field which is a list of files/folders to include in the copied example.

Parameters
example_name: str, name of the example to copy.

Options can be found via list_examples()

destination: name of target directory to copy files to.

If the target directory already exists, project files will be copied into a subdirectory with the same name as the example

benchmarking: bool
optimize: bool
link: bool or path-like

Files downloaded via http pointers will be cached in this location. If a path is not given but just a truthy value, then a cache directory is created using in a location selected by the appdirs library (or, if not installed, linking is skipped.)

Run#

Run ActivitySim. See activitysim run -h for more information.

Settings File Inheritance#

ActivitySim model runs can be configured with settings file inheritance to avoid duplicating settings across model configurations. The command below runs ActivitySim with two configs folders - configs and configs_mp. This setup allows for overriding setings in the configs folder with additional settings in the configs_mp folder so that expression files and settings in the single process (e.g. configs folder) can be re-used for the multiprocessed setup (e.g. configs_mp folder). Settings files, as opposed to configs folders, can also be inherited by specifying -s multiple times. See activitysim run -h for more information.

# in configs_mp\settings.yaml
inherit_settings: True

#then on the command line
activitysim run -c configs_mp -c configs -d data -o output

API#

activitysim.cli.run.add_run_args(parser, multiprocess=True)#

Run command args

activitysim.cli.run.run(args)#

Run the models. Specify a project folder using the ‘–working_dir’ option, or point to the config, data, and output folders directly with ‘–config’, ‘–data’, and ‘–output’. Both ‘–config’ and ‘–data’ can be specified multiple times. Directories listed first take precedence.

returns:

int: sys.exit exit code