troutpy.pp.create_grid_squares

troutpy.pp.create_grid_squares#

troutpy.pp.create_grid_squares(sdata, layer='transcripts', square_size=50)#

Generate a grid of square polygons covering the transcript space.

Parameters:
  • sdata (SpatialData) – The spatial data object containing transcript coordinates.

  • layer (str) – The key to access transcript coordinates in sdata.

  • square_size (float) – The size of each square grid cell.

Return type:

tuple[ShapesModel, ndarray]

Returns:

ShapesModel

Grid of square polygons covering the transcript bounding box.

numpy.ndarray

Array of shape (N, 2) with the [x, y] centroid coordinates of each square.