scSLAT.metrics.rotation_angle

scSLAT.metrics.rotation_angle(X, Y, pi, ground_truth=0, output_angle=True, output_matrix=False)[source]

Finds and applies optimal rotation between spatial coordinates of two layers (may also do a reflection).

Parameters:
  • X – np array of spatial coordinates (ex: sliceA.obs[‘spatial’])

  • Y – np array of spatial coordinates (ex: sliceB.obs[‘spatial’])

  • pi – mapping between the two layers output in PASTE format (N x M matching matrix)

  • ground_truth (float) – If known, the ground truth rotation angle to use for calculating error.

  • output_angle (bool) – Boolean of whether to return rotation angle.

  • output_matrix (bool) – Boolean of whether to return the rotation as a matrix or an angle.

Return type:

tuple

Returns:

  • Aligned spatial coordinates of X, Y, rotation angle, translation of X, translation of Y.

  • Reference

  • ———-

  • Modify from https (//github.com/raphael-group/paste/blob/a9b10b24ba33e94a89dd89e8ee5e4900e18b1886/src/paste/visualization.py#L157)