Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions schema/zarr_vectors.linkml.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,18 @@ enums:
(``LevelMetadata.preserves_object_ids=True``). Dropped objects
appear as empty manifest slots; ``parent_level`` carries
semantic weight on those levels.
shared_vertex_groups:
shared_fragments:
description: >
At least one level stores per-chunk vertex groups that may be
referenced by multiple objects' manifests (shared metavertices
in the per-object pyramid regime).
At least one level stores per-chunk fragments that may be
referenced by multiple objects' manifests (the v0.6 successor
to ``shared_vertex_groups``; the sharing primitive is now a
fragment rather than a contiguous-byte vertex group).
fragment_index:
description: >
The store uses the v0.6 fragment-index encoding for
``vertex_fragments`` and ``link_fragments`` (a single uint8
blob per chunk with a tagged-bitmap header + range table +
explicit CSR; see :mod:`zarr_vectors.encoding.fragments`).
multiscale_links:
description: >
Store uses the 0.4 multiscale links layout
Expand All @@ -129,6 +136,16 @@ enums:
stamps the corresponding tag.
permissible_values:
vertices:
vertex_fragments:
description: >
Per-chunk fragment-index group for ``vertices/<chunk>`` (v0.6+).
Replaces the v0.5 ``vertex_group_offsets``.
link_fragments:
description: >
Per-chunk fragment-index group for ``links/0/<chunk>`` (v0.6+,
delta == 0 only). Splits the v0.5 inline self-describing
header into a sibling group so link bytes can be addressed
uniformly with vertex bytes.
links:
attribute:
object_index:
Expand Down Expand Up @@ -220,7 +237,7 @@ classes:
- chunk_attribute_values
- preserves_object_ids
- inherited_num_objects
- shared_vertex_groups
- shared_fragments

# ----- per-array .zattrs shapes (zv_array discriminator) --------------

Expand Down Expand Up @@ -501,11 +518,12 @@ slots:
``preserves_object_ids`` is true; absent on standalone levels.
range: integer
minimum_value: 0
shared_vertex_groups:
shared_fragments:
description: >
True when per-chunk vertex groups may be referenced by multiple
True when per-chunk fragments may be referenced by multiple
objects' manifests (shared metavertices in the per-object pyramid
regime). Readers MAY use this to short-circuit dedup work.
regime). v0.6 successor to ``shared_vertex_groups``. Readers
MAY use this to short-circuit dedup work.
range: boolean

# -- per-array .zattrs ------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def test_create_store(self, tmp_store_path: Path) -> None:
# The warm shell already contains the empty ragged-vertex pair.
res0 = root["0"]
assert "vertices" in res0
assert "vertex_group_offsets" in res0
assert "vertex_fragments" in res0

def test_create_store_minimal(self, tmp_store_path: Path) -> None:
"""create_store(path) with no kwargs produces a warm 3D shell
Expand All @@ -571,7 +571,7 @@ def test_create_store_minimal(self, tmp_store_path: Path) -> None:
assert "parametric" not in root
res0 = root["0"]
assert "vertices" in res0
assert "vertex_group_offsets" in res0
assert "vertex_fragments" in res0

def test_create_store_ndim_2d(self, tmp_store_path: Path) -> None:
"""ndim kwarg resolves to a 2D store with default 2D bounds."""
Expand Down Expand Up @@ -716,7 +716,7 @@ def test_basic_info(self, tmp_store_path: Path) -> None:
write_parametric_types(root, [PARAMETRIC_PLANE])

info = store_info(root)
assert info["zv_version"].startswith("0.5")
assert info["zv_version"].startswith("0.6")
assert info["geometry_types"] == ["point_cloud", "skeleton"]
assert info["chunk_shape"] == [100.0, 100.0, 100.0]
assert len(info["levels"]) == 1
Expand Down
82 changes: 0 additions & 82 deletions tests/test_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@
import numpy as np

from zarr_vectors.encoding.ragged import (
decode_object_index,
decode_ragged_blob,
decode_ragged_ints,
decode_vertex_groups,
decode_vertex_offsets,
encode_object_index,
encode_ragged_blob,
encode_ragged_ints,
encode_vertex_groups,
encode_vertex_offsets,
)
from zarr_vectors.encoding.compression import (
get_codec_pipeline,
Expand Down Expand Up @@ -149,84 +145,6 @@ def test_empty(self) -> None:
# Object index round-trips
# ---------------------------------------------------------------------------

class TestObjectIndexEncoding:

def test_basic_3d(self) -> None:
manifests = [
[((0, 0, 0), 0), ((0, 0, 1), 2)], # object 0: 2 vertex groups
[((1, 1, 1), 0)], # object 1: 1 vertex group
[((0, 0, 0), 1), ((0, 1, 0), 0), ((1, 0, 0), 3)], # object 2: 3 vg
]
raw, offsets = encode_object_index(manifests, sid_ndim=3)
decoded = decode_object_index(raw, offsets, sid_ndim=3)
assert len(decoded) == 3
assert decoded[0] == manifests[0]
assert decoded[1] == manifests[1]
assert decoded[2] == manifests[2]

def test_2d(self) -> None:
manifests = [
[((0, 1), 0), ((1, 1), 3)],
]
raw, offsets = encode_object_index(manifests, sid_ndim=2)
decoded = decode_object_index(raw, offsets, sid_ndim=2)
assert decoded[0] == manifests[0]

def test_4d_xyzt(self) -> None:
manifests = [
[((0, 0, 0, 0), 0), ((0, 0, 0, 1), 0)],
]
raw, offsets = encode_object_index(manifests, sid_ndim=4)
decoded = decode_object_index(raw, offsets, sid_ndim=4)
assert decoded[0] == manifests[0]

def test_empty_manifest(self) -> None:
manifests = [
[((0, 0, 0), 0)],
[], # empty object
[((1, 1, 1), 0)],
]
raw, offsets = encode_object_index(manifests, sid_ndim=3)
decoded = decode_object_index(raw, offsets, sid_ndim=3)
assert decoded[0] == manifests[0]
assert decoded[1] == []
assert decoded[2] == manifests[2]

def test_no_objects(self) -> None:
raw, offsets = encode_object_index([], sid_ndim=3)
decoded = decode_object_index(raw, offsets, sid_ndim=3)
assert decoded == []

def test_wrong_sid_ndim_raises(self) -> None:
manifests = [
[((0, 0), 0)], # 2D coords
]
try:
encode_object_index(manifests, sid_ndim=3)
assert False, "Should have raised ArrayError"
except ArrayError:
pass


# ---------------------------------------------------------------------------
# Vertex offsets round-trips (K×1 plain int64)
# ---------------------------------------------------------------------------

class TestVertexOffsets:

def test_basic(self) -> None:
v_off = np.array([0, 36, 108], dtype=np.int64)
raw = encode_vertex_offsets(v_off)
dec_v = decode_vertex_offsets(raw)
np.testing.assert_array_equal(dec_v, v_off)

def test_empty(self) -> None:
raw = encode_vertex_offsets(np.array([], dtype=np.int64))
assert raw == b""
dec = decode_vertex_offsets(raw)
assert len(dec) == 0


# ---------------------------------------------------------------------------
# Self-describing ragged blob (inline offset header) round-trips
# ---------------------------------------------------------------------------
Expand Down
Loading
Loading