Impedance: tiling-set scanning + Cz reference channel - #16
Merged
Conversation
… the scan falls back to slow channel-by-channel measurement. The net code is only known here (from the first data packet above), so it must be (re)applied even though setup ran earlier.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related improvements to impedance measurement:
Tiling-set scanning engages for recognized nets.
readPacketFormat2()now callssetNetSize()(derived from the detected net code) before starting the scan, soImpedanceMeasurementloads the tiling layout and measures a whole tiling set per collection instead of falling back to channel-by-channel. A full 256-channel scan drops from ~5 minutes to ~1 minute (~6 collections). Nets without a tiling layout still fall back to single-channel scanning. The net code is only known from the first data packet, so it must be (re)applied here even though setup ran earlier.The impedance stream now includes the reference (Cz) electrode. The impedance LSL outlet carries one extra trailing channel labeled
Cz, whose value comes from the amplifier's dedicated reference monitor (refMonitor/measureReference()) rather than a regular EEG channel. The impedance stream therefore has one more channel than a standard-net EEG stream.Changes
LSLStreamer::createImpedanceOutlet— outlet is nowchannelCount + 1channels; appends theCzchannel with its montage location and updates the source-ID channel count.ImpedanceMeasurement—currentImpedances_sizedchannelCount + 1; the reference impedance is stored/published in the trailing slot. Both the per-tiling-set path (reference reported aschannel == -1) and the end-of-cyclemeasureReference()write into that slot.EGIAmpClient::readPacketFormat2— applysetNetSize()from the detected net code before scanning.mock/MockAmplifier— simulaterefMonitorin impedance mode someasureReference()sees a realistic reference signal (voltage-divider behavior mirroring the per-channel path).README.md,Impedance.md) updated for the trailingCzchannel and tiling-based scan timing;scripts/requirements.txtadds optional Jupyter deps for the delay-inspection notebook.Testing
The mock was extended to drive
refMonitorin impedance mode, so the Cz reference path can be exercised against the mock without hardware. Hardware validation on a live NA400/NA410 net is still recommended before merge.🤖 Generated with Claude Code