Write Trip Matrices#

Write open matrix (OMX) trip matrices for assignment. Reads the trips table post preprocessor and run expressions to code additional data fields, with one data fields for each matrix specified. The matrices are scaled by a household level expansion factor, which is the household sample rate by default, which is calculated when households are read in at the beginning of a model run. The main interface to write trip matrices is the write_trip_matrices function. This function is registered as an Inject step in the example Pipeline.

Structure#

  • Core Table: trips

  • Result: omx trip matrices

  • Skims Keys: origin, destination

This model generates only True or False outcomes, and is structured as a binary logit model.

Configuration#

settings activitysim.abm.models.trip_matrices.WriteTripMatricesSettings#

Bases: PydanticReadable

Settings for the write_trip_matrices component.

Fields:
field CONSTANTS: dict[str, Any] = {}#
field HH_EXPANSION_WEIGHT_COL: str = 'sample_rate'#

Column represents the sampling rate of households

field MATRICES: list[MatrixSettings] = []#
field SAVE_TRIPS_TABLE: bool = False#

Save trip tables

field preprocessor: PreprocessorSettings | None = None#

Examples#

Implementation#

activitysim.abm.models.trip_matrices.write_trip_matrices(state: State, network_los: Network_LOS, trips: DataFrame, model_settings: Optional[WriteTripMatricesSettings] = None, model_settings_file_name: str = 'write_trip_matrices.yaml') None#

Write trip matrices step.

Adds boolean columns to local trips table via annotation expressions, then aggregates trip counts and writes OD matrices to OMX. Save annotated trips table to pipeline if desired.

Writes taz trip tables for one and two zone system. Writes taz and tap trip tables for three zone system. Add is_tap:True to the settings file to identify an output matrix as tap level trips as opposed to taz level trips.

For one zone system, uses the land use table for the set of possible tazs. For two zone system, uses the taz skim zone names for the set of possible tazs. For three zone system, uses the taz skim zone names for the set of possible tazs and uses the tap skim zone names for the set of possible taps.