aequilibrae.distribution.GravityCalibration#
- class aequilibrae.distribution.GravityCalibration(project=None, **kwargs)[source]#
Calibrate a traditional gravity model
Available deterrence function forms are: ‘EXPO’, ‘POWER’ or ‘GAMMA’.
>>> from aequilibrae.distribution import GravityCalibration >>> project = create_example(project_path) # We load the demand matrix >>> demand = project.matrices.get_matrix("demand_omx") >>> demand.computational_view() # We load the skim matrix >>> skim = project.matrices.get_matrix("skims") >>> skim.computational_view(["time_final"]) >>> args = {"matrix": demand, ... "impedance": skim, ... "row_field": "productions", ... "function": 'expo', ... "nan_as_zero": True} >>> gravity = GravityCalibration(**args) # Solve and save outputs >>> gravity.calibrate() >>> gravity.model.save(os.path.join(project_path, 'dist_expo_model.mod'))
- __init__(project=None, **kwargs)[source]#
Instantiates the Gravity calibration problem
- Arguments:
matrix (
AequilibraeMatrix
): Seed/base trip matriximpedance (
AequilibraeMatrix
): Impedance matrix to be usedfunction (
str
): Function name to be calibrated. “EXPO” or “POWER”project (
Project
, Optional): The Project to connect to. By default, uses the currently active projectparameters (
str
, Optional): Convergence parameters. Defaults to those in the parameter filenan_as_zero (
bool
, Optional): If Nan values should be treated as zero. Defaults toTrue
- Results:
model (
SyntheticGravityModel
): Calibrated modelreport (
list
): Iteration and convergence reporterror (
str
): Error description
Methods
__init__
([project])Instantiates the Gravity calibration problem
Calibrate the model