caf.van.lgv_model#

Module for running the LGV model.

Module Attributes

TRIP_DISTRIBUTION_SHEETS

Name of sheet in trip distributions file for each segment.

PA_MATRICES

List of matrices which are in PA format and will be converted to OD.

NTEM_PURPOSES

NTEM purpose to hb/nhb correspondence.

PERSONAL_TIME_PERIODS

Time periods to aggregate NHB together.

TRIP_DISTRIBUTION_COLS

Names and dtypes of the columns expected in the trip distributions input.

FUNCTION_LABELS

Labels for the cost functions in the gravity model.

PA_DIFFERENCE_TOL

Tolerance for difference in productions and attractions.

DUMMY_CAT

Label to use when no category is given for the zones/tlds for the gravity model.

Functions

annual_pa_to_od(matrix, col_total, row_total)

Convert annual PA matrix to OD by adding on the transpose after factoring to totals.

balance_trip_ends(trip_ends, regions, ...)

Balance variable column to control column within the regions.

calculate_trip_ends(input_paths, ...)

Calculates the LGV trip ends for all segments.

calculate_vehicle_kms(matrix, distances[, ...])

Summarise number of trips and vehicle kilometres by internal/external.

extract_cost_func_params(cost_funct_params, ...)

Extracts the cost function parameters from a tuple.

factor_1d(matrix, total, axis)

Factor the given axis of matrix to match total.

factor_totals(col_total, row_total)

Factor column/row total arrays so they have the same total.

lgv_arg_parser()

Creates ArgumentParser for the LGV model.

lgv_parameters(path)

Read the LGV Parameters sheet from the Excel workbook.

main(input_paths)

Runs the LGV model.

matrix_time_periods(matrices, factors_path, ...)

Converts all matrices to time periods based on factors in factors_path.

produce_annual_matrices(input_paths, ...)

Produces annual LGV matrices for all segments.

produce_personal_matrix(folder, purposes, ...)

Produces LGV personal matrix by factoring NorMITs car other demand.

read_time_factors(path)

Read time period factors from Excel Worksheet.

run_gravity_model(input_paths, trip_ends, ...)

Run the gravity model calibration for each segment.

Classes

CommuteTripEnds(input_paths, model_zones)

Functionality for generating the LGV commuting segment trip productions and attractions.

DataPaths(name, path, zc_path)

Dataclass for storing path to data source and zone correspondence.

DeliveryTripEnds(warehouse_paths, ...)

Functionality for generating the LGV delivery segment trip ends.

GMInputs(trip_length_distribution_path, ...)

Defines the input paths and parameters for the gravity model.

LGVInputPaths(*, zoning, model_zones, ...[, ...])

Dataclass storing paths to all the input files for the LGV model.

LGVMatrices(service, delivery_parcel_stem, ...)

Dataclass to store the trip matrices for all segments.

LGVTripEnds(service, delivery_parcel_stem, ...)

Dataclass to store the trip end data for all segments.

Rezone()

Class for rezoning a matrix when given a lookup with splitting factors.

ServiceTripEnds(household_paths, ...)

Functionality for generating the LGV service segment trip ends.

VanGravityModelResults(distribution, zones, info)

Results from a run of the gravity model.

Attributes Documentation

caf.van.lgv_model.TRIP_DISTRIBUTION_SHEETS = {'commuting_drivers': 'Commuting', 'commuting_skilled_trades': 'Commuting', 'delivery_grocery': 'Delivery Bush', 'delivery_parcel_bush': 'Delivery Bush', 'delivery_parcel_stem': 'Delivery', 'service': 'Service'}#

Name of sheet in trip distributions file for each segment.

caf.van.lgv_model.PA_MATRICES = ['service', 'delivery_parcel_stem', 'commuting_drivers', 'commuting_skilled_trades']#

List of matrices which are in PA format and will be converted to OD.

caf.van.lgv_model.NTEM_PURPOSES = {'hb': [1, 2, 3, 4, 5, 6, 7, 8], 'nhb': [12, 13, 14, 15, 16, 18]}#

NTEM purpose to hb/nhb correspondence.

caf.van.lgv_model.PERSONAL_TIME_PERIODS = [1, 2, 3, 4]#

Time periods to aggregate NHB together.

caf.van.lgv_model.TRIP_DISTRIBUTION_COLS = {'average': <class 'float'>, 'end': <class 'float'>, 'observed proportions': <class 'float'>, 'start': <class 'float'>}#

Names and dtypes of the columns expected in the trip distributions input.

caf.van.lgv_model.FUNCTION_LABELS = {'log_normal': 'Log Normal: $\\sigma={:.1e}$, $\\mu={:.1e}$', 'tanner': 'Tanner: $\\alpha={:.1e}$, $\\beta={:.1e}$'}#

Labels for the cost functions in the gravity model.

caf.van.lgv_model.PA_DIFFERENCE_TOL = 0.001#

Tolerance for difference in productions and attractions.

caf.van.lgv_model.DUMMY_CAT = 1#

Label to use when no category is given for the zones/tlds for the gravity model.