(N_tiles, D) outputs array produced by bioptimus.inference.writers) to a single slide-level vector.
Two convenience entry points build on the same mean-pool:
slide_embedding— averages tile embeddings into one slide embedding.pseudobulk— averages predicted spatial gene expression into a single bulk RNA-seq-like profile, paired with the output gene names.
SlideInference.predict/.embed (or the Inference facade), so no model or server is needed to aggregate.
Pseudobulk
eq=False keeps identity equality: a value-based __eq__ would compare the numpy expression field with == and raise on truthiness.
Attributes:
expression- The pseudobulk expression vector of shape(G,)asfloat32.gene_names- Ordered gene identifiers for each entry ofexpression, orNonewhen the output has no gene names.
slide_reduce
The
(N_tiles, D) per-tile outputs.The pooling strategy over the tile axis. One of
"mean", "max", "sum", or "median". Defaults to "mean".(D,) as float32.
Raises:
BioptimusValueError- Ifpoolis not a supported strategy, oroutputsis not a 2-D(N_tiles, D)array or has no tiles.
slide_mean
slide_reduce(outputs, pool="mean"), kept for convenience and backward compatibility.
The
(N_tiles, D) per-tile outputs.(D,) as float32.
Raises:
BioptimusValueError- Ifoutputsis not a 2-D(N_tiles, D)array or has no tiles.
slide_embedding
outputs array) or in the combined PREDICTION_WITH_EMBEDDING mode (the embedding is the separate embeddings array, alongside the outputs prediction). The embeddings array is preferred when present.
Path to a tile-output file written in embedding or combined mode.
The on-disk format. Inferred from the extension when omitted.
The pooling strategy over tiles (
"mean", "max", "sum", or "median"). Defaults to "mean".When
True, saves the vector next to the input as <name>.slide.npy. Defaults to False.(D,) as float32.
pseudobulk
Path to a tile-output file written in
predict mode.The on-disk format. Inferred from the extension when omitted.
The pooling strategy over tiles (
"mean", "max", "sum", or "median"). Defaults to "mean".When
True, saves the vector next to the input as <name>.slide.npy. Defaults to False.Pseudobulk pairing the (G,) expression vector with the
output gene names (None if the file has none).
