Ruview/v2/crates/ruv-neural/ruv-neural-sensor
rUv f49c722764
chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427)
The Rust port lived two directories deep (rust-port/wifi-densepose-rs/)
without any sibling under rust-port/ that warranted the extra level.
Move the whole workspace up to v2/ to match v1/ (Python) at the same
depth and shorten every cd / build command across the repo.

git mv preserves history for all tracked files. 60 files updated for
path references (CI workflows, ADRs, docs, scripts, READMEs, internal
.claude-flow state). Two manual fixes for relative-cd paths in
CLAUDE.md and ADR-043 that became wrong after the depth change
(cd ../.. → cd ..).

Validated:
- cargo check --workspace --no-default-features → clean (after target/
  nuke; the gitignored target/ was carried by the OS rename and had
  hard-coded old paths in build scripts)
- cargo test --workspace --no-default-features → 1,539 passed, 0 failed,
  8 ignored (same totals as pre-rename)
- ESP32-S3 on COM7 → still streaming live CSI (cb #40300, RSSI -64 dBm)

After-merge follow-up: contributors should `rm -rf v2/target` once and
let cargo regenerate from the new path.
2026-04-25 21:28:13 -04:00
..
src chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00
Cargo.toml chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00
README.md chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00

ruv-neural-sensor

Sensor data acquisition for NV diamond, OPM, EEG, and simulated sources.

Overview

ruv-neural-sensor provides uniform sensor interfaces for multiple neural magnetometry and electrophysiology sensor types. Each sensor backend implements the SensorSource trait from ruv-neural-core, producing MultiChannelTimeSeries data. The crate also includes calibration utilities and real-time signal quality monitoring.

Features

  • Simulated sensor (simulator feature, default): Synthetic multi-channel data generation with configurable alpha rhythm injection, noise floor control, and event injection (spikes, artifacts)
  • NV diamond (nv_diamond feature): Nitrogen-vacancy diamond magnetometer interface with configurable sensitivity and channel layout
  • OPM (opm feature): Optically pumped magnetometer array with configurable geometry
  • EEG (eeg feature): Electroencephalography sensor interface
  • Calibration: Gain/offset correction, noise floor estimation, and cross-calibration between reference and target channels
  • Quality monitoring: Real-time SNR estimation, artifact probability scoring, and saturation detection with configurable alert thresholds

Usage

use ruv_neural_sensor::simulator::{SimulatedSensorArray, SensorEvent};
use ruv_neural_sensor::{SensorSource, SensorType};

// Create a simulated 16-channel array at 1000 Hz
let mut sim = SimulatedSensorArray::new(16, 1000.0);
sim.inject_alpha(100.0); // 100 fT alpha rhythm

// Read 500 samples via the SensorSource trait
let data = sim.read_chunk(500).unwrap();
assert_eq!(data.num_channels, 16);
assert_eq!(data.num_samples, 500);

// Inject a spike event
sim.inject_event(SensorEvent::Spike {
    channel: 0,
    amplitude_ft: 500.0,
    sample_offset: 100,
});

// Calibrate channels
use ruv_neural_sensor::calibration::{CalibrationData, calibrate_channel};
let cal = CalibrationData {
    gains: vec![2.0],
    offsets: vec![10.0],
    noise_floors: vec![1.0],
};
let corrected = calibrate_channel(100.0, 0, &cal); // (100 - 10) * 2 = 180

// Monitor signal quality
use ruv_neural_sensor::quality::QualityMonitor;
let mut monitor = QualityMonitor::new(2);
let qualities = monitor.check_quality(&[&data.data[0], &data.data[1]]);

API Reference

Module Key Types / Functions
simulator SimulatedSensorArray, SensorEvent
nv_diamond NvDiamondArray, NvDiamondConfig
opm OpmArray, OpmConfig
eeg EegArray, EegConfig
calibration CalibrationData, calibrate_channel, cross_calibrate
quality QualityMonitor, SignalQuality

Feature Flags

Feature Default Description
simulator Yes Synthetic test data generator
nv_diamond No NV diamond magnetometer backend
opm No Optically pumped magnetometer backend
eeg No EEG sensor backend

Integration

Depends on ruv-neural-core for the SensorSource trait and MultiChannelTimeSeries type. Produced data feeds into ruv-neural-signal for preprocessing and filtering.

License

MIT OR Apache-2.0