deepspatial.core.DeepSpatial.setup_data

deepspatial.core.DeepSpatial.setup_data#

DeepSpatial.setup_data(adata_list: list[AnnData], spatial_key: str = 'spatial', z_key: str = 'z_coord', label_key: str = 'cell_class', batch_size: int = 128, num_workers: int = 4, n_samples_base: int = 50000, alpha_spatial: float = 0.5, uot_reg: float = 0.8, uot_tau: float = 0.05, mode: str = 'fit')[source]#

Prepares the data pipeline and calculates physical normalization statistics.

Parameters:
  • adata_list – List of AnnData objects (slices).

  • spatial_key – Key in .obsm for XY coordinates.

  • z_key – Key in .obs for the physical Z coordinate.

  • label_key – Key in .obs for cell type annotations.

  • batch_size – Number of samples per training batch.

  • num_workers – Multi-process data loading workers.

  • n_samples_base – Base number of cell pairs to sample per slice pair.

  • alpha_spatial – UOT spatial distance weight.

  • uot_reg – Entropy regularization for UOT.

  • uot_tau – Marginal relaxation for UOT.

  • mode – Dataset mode (‘fit’ for training, ‘predict’ for inference).