A package for creating arbitrary spatialdata for testing purposes.
Project description
dummy-spatialdata
Allows generating dummy spatialdata objects, which can be useful for testing purposes.
Installation
pip install dummy-spatialdata
Example usage
from dummy_spatialdata import generate_dataset
import dummy_anndata
import spatialdata_plot as sdp
import spatialdata as sd
import matplotlib.pyplot as plt
import anndata as ad
# generate dummy anndata
adata = dummy_anndata.generate_dataset(n_obs=12, n_vars=20)
# generate dummy spatialdata
sdata = generate_dataset(
images = [
{"type": "rgb", "n_layers": 4, "shape": {"x": 1000, "y": 1000}, "transformations": {"trans_0": ["affine"]}},
{"type": "grayscale", "n_layers": 1, "shape": {"x": 1000, "y": 1000}, "transformations": {"trans_0": ["affine"]}},
],
labels = [
{"n_labels": 12, "n_layers": 4, "shape": {"x": 1000, "y": 1000}},
{"n_labels": 12, "n_layers": 0, "shape": {"x": 100, "y": 100}},
],
shapes = [
{"n_shapes": 12, "shape": {"x": 1000, "y": 1000}},
{"n_shapes": 20, "shape": {"x": 1000, "y": 1000}},
],
tables = [
{"table": adata, "element": "shape", "element_index": 0}
],
SEED=13
)
sdata
SpatialData object
├── Images
│ ├── 'image_0': DataTree[cyx] (3, 1000, 1000), (3, 500, 500), (3, 250, 250), (3, 125, 125)
│ └── 'image_1': DataTree[cyx] (1, 1000, 1000)
├── Labels
│ ├── 'label_0': DataTree[yx] (1000, 1000), (500, 500), (250, 250), (125, 125)
│ └── 'label_1': DataTree[yx] (100, 100)
├── Shapes
│ ├── 'shape_0': GeoDataFrame shape: (12, 1) (2D shapes)
│ └── 'shape_1': GeoDataFrame shape: (20, 1) (2D shapes)
└── Tables
└── 'table_0': AnnData (12, 20)
with coordinate systems:
▸ 'global', with elements:
image_0 (Images), image_1 (Images), label_0 (Labels), label_1 (Labels), shape_0 (Shapes), shape_1 (Shapes)
▸ 'trans_0', with elements:
image_0 (Images), image_1 (Images)
You can plot the demo data now!
sdata.pl.render_images("image_0", ).pl.render_shapes("shape_0", color="Gene001", table_name = "table_0", table_layer = "float_matrix").pl.show(coordinate_systems = "global")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dummy_spatialdata-0.1.0.tar.gz.
File metadata
- Download URL: dummy_spatialdata-0.1.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa8a6fc13303fa0c2f15a0b973082973a8ed01eb08806475146025684605ce10
|
|
| MD5 |
816bdf0b2ea4ecb9eebd51632c03ed37
|
|
| BLAKE2b-256 |
f0a5ca02b947396ac835012d0bea197facb700eacb0627eeb08ec77a7403d5cf
|
File details
Details for the file dummy_spatialdata-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dummy_spatialdata-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3426578c598b37b06e5c84d2caed1ba758c083a8f66817687e480ea6d3ba4d7d
|
|
| MD5 |
9f11ff8ad5d4c07fab33c7f089e47319
|
|
| BLAKE2b-256 |
3d87e9b0a2997d5f371a5610ad7f1d71d5cb16aab52980161fa77de8e397ca73
|