i-Spector SDK v2

The SDK of the I-Spector (Nuclear Instruments / CAEN intelligent SiPM detector: an MCA or PSD instrument with a high-voltage module), implemented natively in every language — Python, C, C++, Go, .NET (C#), Java, Node.js / TypeScript, MATLAB — over Ethernet (HTTP/JSON) and USB (HID, no driver, every language except MATLAB). One contract (spec/sdk-api.yaml), one firmware emulator for the tests, one conformance scenario run by every language.

Quick start (Python; see the docs

for every language)

import ispector
from ispector import RunTarget

with ispector.connect("http://192.168.50.2") as dev:      # or "usb://"
    dev.hv.set_voltage(41.5)
    dev.hv.enable()
    dev.mca.set_config(trigger_threshold=120, int_gain=40)
    dev.mca.set_target(RunTarget.TIME, 10_000)             # 10 s
    dev.spectrum.reset()
    dev.spectrum.start()
    dev.spectrum.wait_done(timeout=60)
    print(dev.spectrum.get().total, "counts")

No instrument on the bench? pip install ispector-emulator && ispector-emulator --port 0 --variant mca --seed 1 stands in for one — see emulator/README.md.

Install

LanguageInstall
Pythonpip install ispector ([usb] for USB)
C / C++NI Packages, or build from sdk/c / sdk/cpp with CMake
Gocheckout + go mod edit -replace (see sdk/go/README.md; module path not public yet)
.NETdotnet add package Ispector.Sdk (NuGet publication prepared, not yet live)
Javaeu.nuclearinstruments:ispector (Maven Central prepared, not yet live)
Node.jsnpm install @nuclearinstruments/ispector (npm prepared, not yet live)
MATLABispector.mltbx Add-On (Ethernet only, no USB)

Every language is also distributed as a source/binary artifact on NI Packages (slug i-spector-sdk-v2), built and released by the GitLab pipeline on tags.

Documentation

The full documentation — installation per language, connecting, compatibility with older firmware, errors, a feature-by-feature user guide with real code in every language, the generated API reference, the firmware emulator, the conformance suite, and how to contribute — is at nuclearinstruments.gitlab.io/i-spector-sdk-v2, built from docs/ with MkDocs Material.

License

MIT. See LICENSE.

Repository layout

PathWhat
spec/the contract: sdk-api.yaml (operations, types, endpoints, compatibility), compat.md (firmware families and capabilities), errors.md
sdk/python/the reference implementation, pip package ispector
sdk/c/, sdk/cpp/native C99 / C++17 implementations, CMake
sdk/go/native Go implementation, standard library only
sdk/dotnet/native C# implementation (netstandard2.0 + net8.0), NuGet package Ispector.Sdk
sdk/java/native Java implementation, Maven artifacts ispector + ispector-usb
sdk/node/native TypeScript implementation, npm package @nuclearinstruments/ispector
sdk/matlab/native MATLAB implementation (Ethernet only), .mltbx toolbox
emulator/the Python firmware emulator (ispector-emulator), its tests and model docs
ci-test/the conformance runner (Python), the per-language conformance programs' expected results
docs/this documentation site (MkDocs Material)
tools/remote-run.sh (build/test on the Linux box), set_version.py, check_spec.py, gen_api_docs.py
.gitlab-ci/, .ni/the pipeline (tag-triggered) and the NI Packages release files
.claude/memory/the project's running knowledge base: design decisions, parity debt, environment traps

Each sdk/<language>/README.md is the detailed reference for that implementation (the full operation table, USB and discovery notes, compatibility, building and testing); CLAUDE.md at the repository root is the contributor rule set this README summarises.