Validation catches shape, dtype, and semantic errors at construction time — before a long recording loop turns them into a mysterious mid-run traceback.
Validation levels
- Structural — types, shapes, dtypes. Always on.
- Semantic — selectors match at least one module, seeds are actually applied. On by default.
- Strict — reject anything the adapters do not fully understand. Opt-in via
NS_STRICT=1.
When it runs
Validators run at Recorder.__init__, at save(), and atload(). Reload-time validation is what protects you from cross-version drift.
Custom validators
validators.py··python
import neuronscope as ns
@ns.validator("recorder.probes")
def probes_are_unique(probes):
names = [p.name for p in probes]
if len(names) != len(set(names)):
raise ns.ValidationError("E2201: duplicate probe names")