API Reference¶
Complete API documentation auto-generated from code docstrings.
Main Visualization Function¶
vis(adata, position, color, section=None, annotations=None, continuous=None, genes=None, layer=None, height=600, mode='3D', _async_workers=2, _wait_for_all_sends=False)
¶
Create and return a SpatialVista visualization widget.
If _wait_for_all_sends is True, the function will block until all background sends finish. Otherwise it will return the widget immediately while sends may continue in background.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adata
|
AnnData
|
Annotated data object containing spatial information. |
required |
position
|
str
|
Key in adata.obsm containing spatial coordinates. |
required |
color
|
str
|
Key in adata.obs for default categorical coloring. |
required |
section
|
str
|
Annotation key for section slicing (only relevant when mode="3D" and switching to 2D slice view in UI). Ignored when mode="2D". |
None
|
annotations
|
list[str]
|
List of additional categorical annotation keys to export. |
None
|
continuous
|
list[str]
|
List of continuous observation keys to export. |
None
|
genes
|
list[str]
|
List of gene names to export. |
None
|
layer
|
str
|
Layer to use for gene expression values. If None, uses adata.X. |
None
|
height
|
int
|
Height of the widget in pixels. |
600
|
mode
|
str
|
Visualization mode. "3D" for 3D point cloud, "2D" for 2D projection (z=0). |
"3D"
|
_async_workers
|
int
|
Number of background workers for async trait sends. |
2
|
_wait_for_all_sends
|
bool
|
Whether to wait for all background sends to complete before returning. |
False
|
Returns:
| Type | Description |
|---|---|
SpatialVistaWidget
|
The configured widget ready for display. |
Examples:
Logging Functions¶
set_log_level(level='WARNING')
¶
Set the logging level for the spatialvista package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
str
|
The logging level. Valid values are: - "TRACE": Most verbose, shows all messages - "DEBUG": Debug information - "INFO": General information - "SUCCESS": Success messages - "WARNING": Warning messages (default) - "ERROR": Error messages only - "CRITICAL": Critical errors only |
"WARNING"
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If an invalid log level is provided. |
Examples:
get_log_level()
¶
Get the current logging level.
Returns:
| Type | Description |
|---|---|
str
|
The current log level (e.g., "WARNING", "INFO"). |
get_logger()
¶
Get the configured logger instance.
Returns:
| Type | Description |
|---|---|
logger
|
The configured loguru logger instance. |