dynamo.vf.curvature(adata, basis='pca', vector_field_class=None, formula=2, Qkey='PCs', method='analytical', **kwargs)[source]

Calculate curvature for each cell with the reconstructed vector field function.

  • adata (AnnData) – AnnData object that contains the reconstructed vector field function in the uns attribute.

  • basis (str) – The embedding data in which the vector field was reconstructed.

  • vector_field_class (vectorfield) – If not None, the divergene will be computed using this class instead of the vector field stored in adata.

  • formula (int (default: 2)) – Which formula of curvature will be used, there are two formulas, so formula can be either {1, 2}. By default it is 2 and returns both the curvature vectors and the norm of the curvature. The formula one only gives the norm of the curvature.

  • Qkey (str (default: 'PCs')) – The key of the PCA loading matrix in .uns.

  • method (str (default: 'analytical')) – The method that will be used for calculating curvature field, either ‘analytical’ or ‘numerical’. ‘analytical’ method uses the analytical expressions for calculating curvature while ‘numerical’ method uses numdifftools, a numerical differentiation tool, for computing curvature. ‘analytical’ method is much more efficient.

  • kwargs – Any additional keys that will be passed to vector_field_class.compute_curvature function.


adata – AnnData object that is updated with the curvature key in the .obs.

Return type