spateo.tdr.morphometrics.morphofield_dg.differential_geometry ============================================================= .. py:module:: spateo.tdr.morphometrics.morphofield_dg.differential_geometry Functions --------- .. autoapisummary:: spateo.tdr.morphometrics.morphofield_dg.differential_geometry._generate_vf_class spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_velocity spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_acceleration spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_curvature spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_curl spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_torsion spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_divergence spateo.tdr.morphometrics.morphofield_dg.differential_geometry.morphofield_jacobian Module Contents --------------- .. py:function:: _generate_vf_class(adata: anndata.AnnData, vf_key: str, method: str = 'gaussian_process', nonrigid_only: bool = False) .. py:function:: morphofield_velocity(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'velocity', nonrigid_only: bool = False, inplace: bool = True) -> Optional[anndata.AnnData] Calculate the velocity for each cell with the reconstructed vector field function. :param adata: AnnData object that contains the reconstructed vector field. :param vf_key: The key in ``.uns`` that corresponds to the reconstructed vector field. :param key_added: The key that will be used for the velocity key in ``.obsm``. :param nonrigid_only: If True, only the nonrigid part of the vector field will be calculated. :param inplace: Whether to copy adata or modify it inplace. :returns: An ``AnnData`` object is updated/copied with the ``key_added`` in the ``.obsm`` attribute which contains velocities. .. py:function:: morphofield_acceleration(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'acceleration', method: str = 'analytical', nonrigid_only: bool = False, inplace: bool = True) -> Optional[anndata.AnnData] Calculate acceleration for each cell with the reconstructed vector field function. :param adata: AnnData object that contains the reconstructed vector field. :param vf_key: The key in ``.uns`` that corresponds to the reconstructed vector field. :param key_added: The key that will be used for the acceleration key in ``.obs`` and ``.obsm``. :param method: The method that will be used for calculating acceleration field, either ``'analytical'`` or ``'numerical'``. ``'analytical'`` method uses the analytical expressions for calculating acceleration while ``'numerical'`` method uses numdifftools, a numerical differentiation tool, for computing acceleration. ``'analytical'`` method is much more efficient. :param nonrigid_only: If True, only the nonrigid part of the vector field will be calculated. :param inplace: Whether to copy adata or modify it inplace. :returns: An ``AnnData`` object is updated/copied with the ``key_added`` in the ``.obs`` and ``.obsm`` attribute. The ``key_added`` in the ``.obs`` which contains acceleration. The ``key_added`` in the ``.obsm`` which contains acceleration vectors. .. py:function:: morphofield_curvature(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'curvature', formula: int = 2, method: str = 'analytical', nonrigid_only: bool = False, inplace: bool = True) -> Optional[anndata.AnnData] Calculate curvature for each cell with the reconstructed vector field function. :param adata: AnnData object that contains the reconstructed vector field. :param vf_key: The key in ``.uns`` that corresponds to the reconstructed vector field. :param key_added: The key that will be used for the curvature key in ``.obs`` and ``.obsm``. :param formula: 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. :param method: 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. :param nonrigid_only: If True, only the nonrigid part of the vector field will be calculated. :param inplace: Whether to copy adata or modify it inplace. :returns: An ``AnnData`` object is updated/copied with the ``key_added`` in the ``.obs`` and ``.obsm`` attribute. The ``key_added`` in the ``.obs`` which contains curvature. The ``key_added`` in the ``.obsm`` which contains curvature vectors. .. py:function:: morphofield_curl(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'curl', method: str = 'analytical', nonrigid_only: bool = False, inplace: bool = True) -> Optional[anndata.AnnData] Calculate curl for each cell with the reconstructed vector field function. :param adata: AnnData object that contains the reconstructed vector field. :param vf_key: The key in ``.uns`` that corresponds to the reconstructed vector field. :param key_added: The key that will be used for the torsion key in ``.obs``. :param method: The method that will be used for calculating torsion field, either ``'analytical'`` or ``'numerical'``. ``'analytical'`` method uses the analytical expressions for calculating torsion while ``'numerical'`` method uses numdifftools, a numerical differentiation tool, for computing torsion. ``'analytical'`` method is much more efficient. :param nonrigid_only: If True, only the nonrigid part of the vector field will be calculated. :param inplace: Whether to copy adata or modify it inplace. :returns: An ``AnnData`` object is updated/copied with the ``key_added`` in the ``.obs`` and ``.obsm`` attribute. The ``key_added`` in the ``.obs`` which contains magnitude of curl. The ``key_added`` in the ``.obsm`` which contains curl vectors. .. py:function:: morphofield_torsion(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'torsion', method: str = 'analytical', nonrigid_only: bool = False, inplace: bool = True) -> Optional[anndata.AnnData] Calculate torsion for each cell with the reconstructed vector field function. :param adata: AnnData object that contains the reconstructed vector field. :param vf_key: The key in ``.uns`` that corresponds to the reconstructed vector field. :param key_added: The key that will be used for the torsion key in ``.obs`` and ``.obsm``. :param method: The method that will be used for calculating torsion field, either ``'analytical'`` or ``'numerical'``. ``'analytical'`` method uses the analytical expressions for calculating torsion while ``'numerical'`` method uses numdifftools, a numerical differentiation tool, for computing torsion. ``'analytical'`` method is much more efficient. :param nonrigid_only: If True, only the nonrigid part of the vector field will be calculated. :param inplace: Whether to copy adata or modify it inplace. :returns: An ``AnnData`` object is updated/copied with the ``key_added`` in the ``.obs`` and ``.uns`` attribute. The ``key_added`` in the ``.obs`` which contains torsion. The ``key_added`` in the ``.uns`` which contains torsion matrix. .. py:function:: morphofield_divergence(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'divergence', method: str = 'analytical', vectorize_size: Optional[int] = 1000, nonrigid_only: bool = False, inplace: bool = True) -> Optional[anndata.AnnData] Calculate divergence for each cell with the reconstructed vector field function. :param adata: AnnData object that contains the reconstructed vector field. :param vf_key: The key in ``.uns`` that corresponds to the reconstructed vector field. :param key_added: The key that will be used for the acceleration key in ``.obs`` and ``.obsm``. :param method: The method that will be used for calculating acceleration field, either ``'analytical'`` or ``'numerical'``. ``'analytical'`` method uses the analytical expressions for calculating acceleration while ``'numerical'`` method uses numdifftools, a numerical differentiation tool, for computing acceleration. ``'analytical'`` method is much more efficient. :param vectorize_size: vectorize_size is used to control the number of samples computed in each vectorized batch. * If vectorize_size = 1, there's no vectorization whatsoever. * If vectorize_size = None, all samples are vectorized. :param nonrigid_only: If True, only the nonrigid part of the vector field will be calculated. :param inplace: Whether to copy adata or modify it inplace. :returns: An ``AnnData`` object is updated/copied with the ``key_added`` in the ``.obs`` attribute. The ``key_added`` in the ``.obs`` which contains divergence. .. py:function:: morphofield_jacobian(adata: anndata.AnnData, vf_key: str = 'VecFld_morpho', key_added: str = 'jacobian', method: str = 'analytical', nonrigid_only: bool = False, inplace: bool = True) -> Optional[anndata.AnnData] Calculate jacobian for each cell with the reconstructed vector field function. :param adata: AnnData object that contains the reconstructed vector field. :param vf_key: The key in ``.uns`` that corresponds to the reconstructed vector field. :param key_added: The key that will be used for the jacobian key in ``.obs`` and ``.obsm``. :param method: The method that will be used for calculating jacobian field, either ``'analytical'`` or ``'numerical'``. ``'analytical'`` method uses the analytical expressions for calculating jacobian while ``'numerical'`` method uses numdifftools, a numerical differentiation tool, for computing jacobian. ``'analytical'`` method is much more efficient. :param nonrigid_only: If True, only the nonrigid part of the vector field will be calculated. :param inplace: Whether to copy adata or modify it inplace. :returns: An ``AnnData`` object is updated/copied with the ``key_added`` in the ``.obs`` and ``.uns`` attribute. The ``key_added`` in the ``.obs`` which contains jacobian. The ``key_added`` in the ``.uns`` which contains jacobian tensor.