dynamo.vf.BaseVectorField¶
- class dynamo.vf.BaseVectorField(X=None, V=None, Grid=None, *args, **kwargs)[source]¶
The BaseVectorField class is a base class for storing and manipulating vector fields. A vector field is a function that associates a vector to each point in a certain space.
The BaseVectorField class has a number of methods that allow you to work with vector fields. The __init__ method initializes the object, taking in a number of optional arguments such as X, V, and Grid, which correspond to the coordinates of the points in the vector field, the vector values at those points, and a grid used for evaluating the vector field, respectively.
The construct_graph method takes in a set of coordinates X and returns a tuple consisting of a matrix of pairwise distances between the points in X and an object for performing nearest neighbor searches. The from_adata method takes in an AnnData object and a basis string, and extracts the coordinates and vector values of the vector field stored in the AnnData object.
The get_X, get_V, and get_data methods return the coordinates, vector values, and both the coordinates and vector values of the vector field, respectively. The find_fixed_points method searches for fixed points of the vector field function, which are points where the velocity of the vector field is zero. The get_fixed_points method returns the fixed points and their types (stable or unstable). The plot method generates a plot of the vector field.
Methods table¶
|
assign each cell to the associated fixed points |
|
|
|
Search for fixed points of the vector field function. |
|
|
|
|
|
|
|
|
|
Get fixed points of the vector field function. |
|
Integrate along a path through the vector field field function to predict the state after a certain amount of time t has elapsed. |
Methods¶
- BaseVectorField.assign_fixed_points(domain=None, cores=1, **kwargs)[source]¶
assign each cell to the associated fixed points
- BaseVectorField.construct_graph(X=None, **kwargs)[source]¶
- Return type:
Tuple[ndarray,Union[NNDescent,NearestNeighbors]]
- BaseVectorField.find_fixed_points(n_x0=100, X0=None, domain=None, sampling_method='random', **kwargs)[source]¶
Search for fixed points of the vector field function.
- Parameters:
n_x0 (
int(default:100)) – Number of sampling pointsX0 (
Optional[ndarray] (default:None)) – An array of shape (n_samples, n_dim)domain (
Optional[ndarray] (default:None)) – Domain in which to search for fixed pointssampling_method (
Literal['random','velocity','trn','kmeans'] (default:'random')) – Method for sampling initial points. Can be one of random, velocity, trn, or kmeans.
- Return type:
- BaseVectorField.integrate(init_states, dims=None, scale=1, t_end=None, step_size=None, args=(), integration_direction='forward', interpolation_num=250, average=True, sampling='arc_length', verbose=False, disable=False)[source]¶
Integrate along a path through the vector field field function to predict the state after a certain amount of time t has elapsed.
- Parameters:
init_states (
ndarray) – Initial state provided to scipy’s ivp_solver with shape (num_cells, num_dim)dims (
Union[int,list,ndarray,None] (default:None)) – Dimensions of state to be usedscale (default:
1) – Scale the vector field function by this factor. Defaults to 1.t_end (default:
None) – Integrates up till when t=t_end, Defaults to None.step_size (default:
None) – Defaults to None.args (default:
()) – Additional arguments provided to scipy’s ivp_solver Defaults to ().integration_direction (default:
'forward') – Defaults to “forward”.interpolation_num (default:
250) – Defaults to 250.average (default:
True) – Defaults to True.sampling (default:
'arc_length') – Defaults to “arc_length”.verbose (default:
False) – Defaults to False.disable (default:
False) – Defaults to False.
- Return type:
- Returns:
Tuple storing times and predictions