Aceso API

GravityModel

class aceso.GravityModel(decay_function, decay_params={}, huff_normalization=False, suboptimality_exponent=1.0)[source]

Bases: object

Represents an instance of a gravitational model of spatial interaction.

Different choices of decay function lead to the following models:
  • Standard gravity models
  • Two-Step Floating Catchment Area (2SFCA) models
  • Enhanced 2SFCA (E2SFCA) models
  • Three-Step FCA (3SFCA) models
  • Modified 2SFCA (M2SFCA) models
  • Kernel Density 2SFCA (KD2SFCA) models

Initialize a gravitational model of spatial accessibility.

Parameters:
  • decay_function (callable or str) –

    If str, the name of a decay function in the decay module. Some available names are ‘uniform’, ‘raised_cosine’, and ‘gaussian_decay’.

    If callable, a vectorized numpy function returning demand dropoffs by distance.

  • decay_params (mapping) – Parameter: value mapping for each argument of the specified decay function. These parameters are bound to the decay function to create a one-argument callable.
  • huff_normalization (bool) –

    Flag used to normalize demand through Huff-like interaction probabilities.

    Used in 3SFCA to curtail demand over-estimation.

  • suboptimality_exponent (float) –

    Used in M2SFCA to indicate the extent to account for network suboptimality in access. This parameter allows for the differentiation between two scenarios:

    1. Three demand locations each at a distance of 1.0 mile from the sole provider;
    2. Three demand locations each at a distance of 2.0 miles from the sole provider.

    Values greater than 1.0 for this parameter will result in accessibility scores whose weighted average is less than the overall supply.

calculate_accessibility_scores(distance_matrix, demand_array=None, supply_array=None)[source]

Calculate accessibility scores from a 2D distance matrix.

Parameters:
  • distance_matrix (np.ndarray(float)) – A matrix whose entry in row i, column j is the distance between demand point i and supply point j.
  • demand_array (np.array(float) or None) – A one-dimensional array containing demand multipliers for each demand location. The length of the array must match the number of rows in distance_matrix.
  • supply_array (np.array(float) or None) – A one-dimensional array containing supply multipliers for each supply location. The length of the array must match the number of columns in distance_matrix.
Returns:

An array of access scores at each demand location.

Return type:

array

TwoStepFCA

class aceso.TwoStepFCA(radius)[source]

Bases: aceso.gravity.GravityModel

Represents an instance of the standard Two-Step Floating Catchment Area (2SFCA) model.

Initialize a 2SFCA model with the specified radius.

Parameters:radius (float) – The radius of each floating catchment. Pairs of points further than this distance apart are deemed mutually inaccessible. Points within this radius contribute the full demand amount (with no decay).