State API#
|
The encapsulated state of an ActivitySim model. |
Constructors#
|
Initialize the encapsulated state of an ActivitySim model. |
|
Convenience constructor for mostly default States. |
|
Initialize state with a temporary directory. |
|
Create an example model. |
Model Setup#
Initialize this state. |
|
|
Import one or more extension modules for use with this model. |
|
Initialize the state's filesystem. |
|
Initialize with all default settings, rather than reading from a file. |
Read and parse settings file(s) from config dirs. |
|
The overall settings for the ActivitySim model system. |
|
Manage finding and loading files for ActivitySim's command line interface. |
|
Network level of service and skims settings |
Basic Context Management#
The most basic function of the State
object is to serve as a defined
namespace for storing model-relevant variables. This includes the top-level
model settings, data tables, skims, and any other Python variables
that represent the current state of a particular modeling system (or when
multiprocessing, sub-system). Below are the basic methods to get and set values
in this context in their “raw” form, with minimal additional processing.
|
Automated access to values stored in this state's context. |
|
Set a new value for a key in the context. |
|
Remove a key from the context. |
|
Raw access to values stored in this state's context. |
|
Alias for |
|
Alias for |
Data Access and Manipulation#
In addition to “raw” access to context variable, several methods are provided
to simplify different kinds access to the “tables” that represent the
simulation inputs and outputs of ActivitySim. We say “tables” here in the
abstract sense – historically these tables have been stored internally by
ORCA as pandas.DataFrame
s, but the exact internal storage format is abstracted
away here in favor of providing access to the data in several specific formats.
Methods
|
Get a workflow table or dataset as a xarray.Dataset. |
|
Get a workflow table as a pandas.DataFrame. |
|
Get a workflow table item as a xarray.DataArray. |
|
Get the index name for a workflow table. |
|
Get a workflow table as a pyarrow.Table. |
|
Add a data table to this context, and potentially mark it for checkpointing. |
|
Check if a name corresponds to a table in this state's context. |
Return a list of the names of all currently registered dataframe tables |
|
|
Return pandas dataframe corresponding to table_name |
Accessor
This accessor provides easy access to state tables and datasets. |
Run#
Executing model components is handled by methods in the run
accessor.
Accessor
|
run the specified list of models, optionally loading checkpoint and resuming after specified checkpoint. |
Attributes
Individual component heading level to use when running in a notebook. |
Methods
|
Run the specified model and add checkpoint for model_name |
|
Checkpoints#
The State
object provides access to checkpointing functions
within the checkpoint
accessor.
Accessor
State accessor for checkpointing operations. |
Attributes
Metadata about the last saved checkpoint. |
|
Metadata about various saved checkpoint(s). |
|
The store where checkpoints are written. |
Methods
Whether this checkpoint store is open. |
|
|
Open the checkpoint store. |
Close the checkpoint storage. |
|
|
Create a new checkpoint with specified name. |
Return a list of the names of all checkpointed tables |
|
|
Load dataframes and restore random number channel state from pipeline hdf5 file. |
Get pandas dataframe of info about all checkpoints stored in pipeline |
|
|
Restore state from checkpoints. |
|
Restore state from an alternative pipeline store. |
|
Check that the tables in this State match those in an archived pipeline. |
Remove intermediate checkpoints from pipeline. |
|
|
Return pandas dataframe corresponding to table_name |
Tracing#
Attributes
Methods
Register traceable table |
|
un-register traceable table |
|
|
Print write_csv |
|
Slice dataframe by traced household or person id dataframe and write to CSV |
Trace model design eval results for interaction_simulate |
|
|
get target ids and column or index to identify target trace rows in df |
|
|
|
|
|
|
|
Delete files in output directory of specified type. |
Delete CSV files in output_dir |
Logging#
Methods
|
Configure logger |
Reporting#
Accessor
Tools for reporting and visualization |
Methods
Extending#
Methods to extend ActivitySim’s functionality are available under the extend
accessor.
Accessor
Methods to extend the capabilities of ActivitySim. |
Methods
|
Declare a new table. |