bento.tl.aspect_ratio

bento.tl.aspect_ratio(sdata, shape_key, recompute=False) None

Compute aspect ratio of minimum rotated rectangle containing each shape.

The aspect ratio is defined as the ratio of the longest to shortest side of the minimum rotated rectangle that contains the shape.

Parameters:
  • sdata (SpatialData) – Input SpatialData object

  • shape_key (str) – Key in sdata.shapes containing shape geometries

  • recompute (bool, default False) – Whether to force recomputation if feature exists

Returns:

Updates sdata.shapes[shape_key] with: - ‘{shape_key}_aspect_ratio’: Ratio of major to minor axis

Return type:

None