Skip to content

vector_field

VectorField

delta_lat = graph.edges.weights instance-attribute

distances = graph.edges.distances instance-attribute

edges = graph.edges.indices instance-attribute

normalized = False instance-attribute

points = graph.points instance-attribute

__init__(graph)

Creates VectorField object.

Parameters:

Name Type Description Default
graph Graph object

The graph for which to calculate the vector field.

required

calculate_weighted_vf(delta_lat)

Calculates the vector field in each node by taking a weighted average over all incoming and outgoing vectors for a node.

Parameters:

Name Type Description Default
delta_lat N dimensional array

The delta_lat on each vector. N has to be equal to the amount of vectors in the graph.

required

Returns:

Type Description
ndarray

VectorField in each node of the graph.

normalize(vectors) staticmethod

Normalizes M-dimensional vectors.

Parameters:

Name Type Description Default
vectors [N, M] dimensional array

The vectors to normalize.

required

Returns:

Type Description
ndarray

np.ndarray: The normalized vectors ([N, M] dimensional array).

normalized_avg()

Calculates the vector field in each node by taking the average over all normalized incoming and outgoing vectors of a node.

Returns:

Type Description
ndarray

np.ndarray: Vector field in each node of the graph.

set_normalized(normalized=True)

If set to True, the vector field is normalized.

weighted_avg_inverse_speed()

Calculates the vector field in each node by taking a weighted average over all incoming and outgoing vectors for a node. The weight on the vectors is the lat difference between the start and end point divided by the distance between start and end point (= inverse speed). This is the most stable vector field.

Returns:

Type Description
ndarray

np.ndarray: Vector field in each node of the graph.

weighted_avg_speed()

Calculates the vector field in each node by taking a weighted average over all incoming and outgoing vectors for a node. The weight on the vectors is the distance between start and end point divided by the lat difference between the start and end point (= speed).

Returns:

Type Description
ndarray

np.ndarray: Vector field in each node of the graph.