sharding
sharding
¶
Storage-sharding policy for Zarr image arrays.
is_uint8_image_spec
¶
Check whether an array specification describes uint8 images.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
dict
|
Zarr array specification containing shape and dtype entries. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether the specification has a four-dimensional uint8 image layout. |
Source code in src/versatil/data/preprocessing/sharding.py
validate_image_frames_per_shard
¶
Validate the requested number of image frames per shard.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_frames_per_shard
|
int | None
|
Number of frames stored in each shard, or None to disable sharding. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If image_frames_per_shard is not an integer. |
ValueError
|
If image_frames_per_shard is not positive. |
Source code in src/versatil/data/preprocessing/sharding.py
get_image_shard_shape
¶
Resolve an image shard shape from its independently readable chunks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_chunks
|
tuple[int, ...]
|
Image chunk shape with time as its first dimension. |
required |
image_frames_per_shard
|
int | None
|
Number of frames stored in each shard, or None to store every chunk separately. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, ...] | None
|
Shard shape, or None when sharding is disabled. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If image_frames_per_shard is not an integer. |
ValueError
|
If image_frames_per_shard is not a positive multiple of the image chunk length. |