Library-size factors (R fastSizeFactors), written to obs["spanorm_size_factors"].
Examples
Note
The code below runs when the site is built, on a small pre-fitted subset of HumanDLPFC (301 genes x 4015 spots; spanorm(sample_p=0.05, df_tps=2), spanorm_svg() and spanorm_pca() already applied) that is fitted once per build and loaded as adata. The outputs are those of the code shown.
import spanormpy as sn# adata: the HumanDLPFC AnnData (raw counts in X, coordinates in obsm["spatial"])sn.fast_size_factors(adata)adata.obs["spanorm_size_factors"].describe()
count 4015.000000
mean 1.000000
std 0.467105
min 0.028311
25% 0.703057
50% 0.993245
75% 1.284613
max 3.039896
Name: spanorm_size_factors, dtype: float64