dynamo.vf.VectorField2D

class dynamo.vf.VectorField2D(func, func_vx=None, func_vy=None, X_data=None)[source]

The VectorField2D class is a class that represents a 2D vector field, which is a type of mathematical object that assigns a 2D vector to each point in a 2D space. This vector field can be defined using a function that returns the vector at each point, or by separate functions for the x and y components of the vector.

The class also has several methods for finding fixed points (points where the vector is zero) in the vector field, as well as for querying the fixed points that have been found. The find_fixed_points_by_sampling method uses sampling to find fixed points within a specified range in the x and y dimensions. It does this by generating a set of random or Latin Hypercube Sampled (LHS) points within the specified range, and then using the find_fixed_points function to find the fixed points that are closest to these points. The find_fixed_points function uses an iterative method to find fixed points, starting from an initial guess and using the Jacobian matrix at each point to update the guess until the fixed point is found to within a certain tolerance.

The get_Xss_confidence method estimates the confidence of the fixed points by computing the mean distance of each fixed point to its nearest neighbors in the data used to define the vector field. It returns an array of confidence values for each fixed point, with higher values indicating higher confidence.

Parameters:
  • func (Callable) – a function that takes an (n, 2) array of coordinates and returns an (n, 2) array of vectors

  • func_vx (Optional[Callable]) – a function that takes an (n, 2) array of coordinates and returns an (n,) array of x components of the vectors, Defaults to None.

  • func_vy (Optional[Callable]) – a function that takes an (n, 2) array of coordinates and returns an (n,) array of y components of the vectors, Defaults to None.

  • X_data (Optional[ndarray]) – Defaults to None.

__init__(func, func_vx=None, func_vy=None, X_data=None)[source]
Parameters:
  • func (Callable) – a function that takes an (n, 2) array of coordinates and returns an (n, 2) array of vectors

  • func_vx (Optional[Callable]) – a function that takes an (n, 2) array of coordinates and returns an (n,) array of x components of the vectors, Defaults to None.

  • func_vy (Optional[Callable]) – a function that takes an (n, 2) array of coordinates and returns an (n,) array of y components of the vectors, Defaults to None.

  • X_data (Optional[ndarray]) – Defaults to None.

Methods

__init__(func[, func_vx, func_vy, X_data])

type func:

Callable

compute_nullclines(x_range, y_range[, ...])

Compute nullclines.

find_fixed_points_by_sampling(n, x_range, ...)

Find fixed points by sampling the vector field within a specified range of coordinates.

find_nearest_fixed_point(x, x_range, y_range)

Find the fixed point closest to a given initial guess within a given range.

get_Xss_confidence([k])

Get the confidence of each fixed point stored in the Xss attribute.

get_fixed_points([get_types])

Get the fixed points stored in the Xss attribute, along with their types (stable, saddle, or unstable) if get_types is True.

get_num_fixed_points()

Get the number of fixed points stored in the Xss attribute.

output_to_dict(dict_vf)