Inference

coral.inference.generate_and_validate(model, dataloader, device, hires_adata)
coral.inference.reindex_adata_qz(adata: anndata.AnnData, adata_qz: anndata.AnnData) anndata.AnnData

Reindex adata_qz to match the order of adata based on spatial coordinates.

Parameters: - adata: AnnData object containing the reference spatial coordinates. - adata_qz: AnnData object to be reindexed based on spatial coordinates.

Returns: - adata_qz_reindexed: Reindexed AnnData object.

coral.inference.average_attention_weights_for_unique_edges(edges_all, attn_weights_all)

Average attention weights for unique edges.

Parameters: - edges_all: numpy array of shape (2, num_edges) representing all edge indices. - attn_weights_all: numpy array of shape (num_edges, num_heads) representing attention weights.

Returns: - unique_edges: numpy array of shape (2, num_unique_edges) with unique edge indices. - averaged_weights: numpy array of shape (num_unique_edges,) with averaged attention weights.