scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
400 stars 70 forks source link

obsm (spatial, spatial_fov) size seems unreasonably large. #846

Open JonatanSahar opened 1 week ago

JonatanSahar commented 1 week ago

Description

After loading a single FOV (CosMx data), which was saved to h5ad with a sparse X, I noticed the memory required was 13GB(!). Investigating with pymplr.asizeof() revealed that:

f1 size in MB: 13403.45 f1.X size in MB: 1.58 f1.obs size in MB: 91.63 f1.obsm size in MB: 13403.45, flat: 0.00 f1.varm size in MB: 13403.45, flat: 0.00 f1.obsm: AxisArrays with keys: spatial, spatial_fov f1.obsm['spatial'].shape: (2039, 2) f1.obsm['spatial_fov'].shape: (2039, 2) f1.obsm.spatial size in MB: 0.03 f1.obsm.spatial_fov size in MB: 0.03

The difference between the size and the flat size suggests that the 13GB are the size of something obsm is referencing to but I couldn't figure out what that is as I can't look inside the AxisArrays object other than the two keys I inpected.

Is this normal? Would appreciate any help in the matter, thanks! ...

Minimal reproducible example

...

Traceback

```pytb ... ```

Version

...

giovp commented 1 day ago

mmh @JonatanSahar unfortunately I don't really know, I would transfer this issue to anndata as they might have seen this before