State#
- class activitysim.core.workflow.State(context=None)#
The encapsulated state of an ActivitySim model.
Methods
__init__
([context])Initialize the encapsulated state of an ActivitySim model.
access
(key[, initializer])Raw access to values stored in this state's context.
add_injectable
(key, value)Alias for
State.set()
.add_table
(name, content[, salient])Add a data table to this context, and potentially mark it for checkpointing.
close_on_exit
(file, name)Close any known open files
copy
()Create a copy of this State.
default_settings
([force])Initialize with all default settings, rather than reading from a file.
drop
(key)Remove a key from the context.
drop_table
(table_name)extend_table
(table_name, df[, axis])add new table or extend (add rows) to an existing table
extract
(func)get
(key[, default])Automated access to values stored in this state's context.
get_dataarray
(tablename, item[, as_copy])Get a workflow table item as a xarray.DataArray.
get_dataframe
(tablename[, columns, as_copy])Get a workflow table as a pandas.DataFrame.
get_dataframe_index_name
(tablename)Get the index name for a workflow table.
get_dataset
(table_name[, column_names, as_copy])Get a workflow table or dataset as a xarray.Dataset.
Read global constants from settings file
get_injectable
(key[, default])Alias for
State.get()
.get_log_file_path
(file_name[, prefix])Get the log file path for this process.
get_output_file_path
(file_name[, prefix])get_pyarrow
(tablename[, columns])Get a workflow table as a pyarrow.Table.
Return the singleton random number object
get_step_arg
(arg_name[, default])get_table
(table_name[, checkpoint_name])Return pandas dataframe corresponding to table_name
import_extensions
([ext, append])Import one or more extension modules for use with this model.
Initialize this state.
initialize_filesystem
([working_dir, ...])Initialize the state's filesystem.
is_table
(name)Check if a name corresponds to a table in this state's context.
Read and parse settings file(s) from config dirs.
make_default
([working_dir, settings])Convenience constructor for mostly default States.
make_temp
([source, checkpoint_name])Initialize state with a temporary directory.
pipeline_table_key
(table_name, checkpoint_name)Return a list of the names of all currently registered dataframe tables
rng
()set
(key, value)Set a new value for a key in the context.
set_step_args
([args])should_save_checkpoint
([checkpoint_name])trace_memory_info
(event[, trace_ticks])Attributes
State accessor for checkpointing operations.
This accessor provides chunking tools.
Name of the currently running model.
This accessor provides easy access to state tables and datasets.
Methods to extend the capabilities of ActivitySim.
Manage finding and loading files for ActivitySim's command line interface.
This accessor provides logging tools.
Network level of service and skims settings
Tools for reporting and visualization
This accessor provides the tools to actually run ActivitySim workflow steps.
The overall settings for the ActivitySim model system.
Methods to provide the tracing capabilities of ActivitySim.
Files to close when state is destroyed or re-initialized.