Selectors and index spaces
This page defines selection semantics across Python and C.
Quick summary:
Nonemeans “ALL”,[]means “empty”.Label selection is order-preserving.
Indices can mean different index spaces; know which one you are using.
Mental model: labels are “names”, indices are “numbers”, and you must not mix numbering schemes.
Python Easy
The easy surface is labels-only.
import sqzc3d as sq
v = sq.read("trial.c3d", points=None) # ALL points
v = sq.read("trial.c3d", points=["LANK"]) # label selection
v = sq.read("trial.c3d", points=[]) # empty selection
Selector semantics:
Nonemeans default (ALL).[]means empty selection.strorsequence[str]means label selection.
Python Core
The core surface supports indices or labels:
chunk.points(None) # ALL
chunk.points([]) # empty
chunk.points([0, 1, 2]) # indices (chunk-local point indices)
chunk.points(["LANK"]) # labels (chunk-local label table)
Notes:
For non-contiguous selections,
copy=Trueis required.
Label normalization
label_norm can normalize labels (trim / case-fold / whitespace) before matching.
If normalization makes a label ambiguous (multiple source labels normalize to the same key), sqzc3d fails fast
instead of picking an arbitrary match.
In that case, use exact labels (label_norm=EXACT), or drop to indices (Core API) to disambiguate.
C API
The main struct is sqzc3d_build_opt_t.
The C materialize API selects points/analogs during chunk construction.
Point selection:
point_sel_mode = sqzc3d_POINT_SEL_ALLpoint_sel_mode = sqzc3d_POINT_SEL_INDICESandpoint_selare source-total point indicespoint_sel_mode = sqzc3d_POINT_SEL_LABELSandpoint_labelsare matched against source labels
Empty selection:
*_sel_count == 0is a valid empty selection (not an error).
Index spaces
There are two point index spaces:
Source-total: indices into the original C3D
POINT:LABELStable.Chunk-local: indices into the materialized chunk, range
[0..chunk->n_points).
In the C API:
sqzc3d_build_opt_t.point_seluses the source-total space.sqzc3d_chunk_t.type_group_indicesare chunk-local.All point indices exposed from a chunk (views/type-groups) are chunk-local.