- dynamo.vf.divergence(adata, cell_idx=None, sampling=None, sample_ncells=1000, basis='pca', vector_field_class=None, method='analytical', store_in_adata=True, **kwargs)
Calculate divergence for each cell with the reconstructed vector field function. Either AnnData object is updated with the ‘divergence’ key in the .obs or the divergence is returned as a numpy array.
AnnData) – AnnData object that contains the reconstructed vector field function in the uns attribute.
int) – The number of cells to be sampled. If sampling is None, this parameter is ignored.
str) – The embedding data in which the vector field was reconstructed.
vector_field_class – If not None, the divergene will be computed using this class instead of the vector field stored in adata.
str) – The method that will be used for calculating divergence, either analytical or numeric. analytical method will use the analytical form of the reconstructed vector field for calculating divergence while numeric method will use numdifftools for calculation. analytical method is much more efficient.
bool) – Whether to store the divergence result in adata.
kwargs – Any additional keys that will be passed to vector_field_class.compute_divergence function.
- Return type:
the divergence is returned as an np.ndarray if store_in_adata is False.