Skip to content

Add vhneuropixelsGLX_nidq DAQ system; fix digital on-edges one sample early - #349

Merged
stevevanhooser merged 2 commits into
mainfrom
claude/bold-shannon-bucpux
Nov 1, 2026
Merged

stevevanhooser merged 2 commits into
mainfrom
claude/bold-shannon-bucpux

Conversation

@stevevanhooser

@stevevanhooser stevevanhooser commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Mirrors VH-Lab/NDI-matlab#1127. CI pairs this PR with that PR's branch, which has the same name.

  1. New vhlab DAQ system vhneuropixelsGLX_nidq. ndi_common/daq_systems/vhlab/vhneuropixelsGLX_nidq.json is identical to the MATLAB file. It reads the SpikeGLX NI-DAQ stream (*.nidq.bin / *.nidq.meta) with the NDR neuropixelsGLX reader. That lets you name NI-DAQ digital lines in epochprobemap.txt; for example, an optogenetic fiber on XD4 is vhneuropixelsGLX_nidq:dimp5 (SpikeGLX XDn is channel di(n+1)). vhneuropixelsGLX reads the IMEC .ap.bin, whose digital lines are the IMEC sync bits, so those lines weren't reachable before. A blank vhlab session now has ten DAQ systems.

  2. Digital-edge "on" events were one sample early. In ndi_daq_reader_mfdaq._read_derived_events (the non-ingested read for dep, den, dimp, dimn), each on-edge was np.where(...)[0], which is the last sample before the transition. MATLAB's 1 + find(...), this port's off-edges, and its ingested read all use the first sample after it. A line going high at 1.000 s at 1 kHz reported 0.999 s. This adds the missing 1 +.

The MATLAB PR also fixes dimn never returning its off-edges. This port's dimn branches were already correct, so there was nothing to port for that.

Changes

  • src/ndi/ndi_common/daq_systems/vhlab/vhneuropixelsGLX_nidq.json: new.
  • src/ndi/daq/mfdaq.py: the two on-edge lines in _read_derived_events.
  • Bridge entries synced to NDI-matlab dfba35572, the head of the paired branch, each with a decision_log note:
    • mfdaq_reader (+ndi/+daq/+reader/mfdaq.m) was at 5c5784c6a. The only commit since then is the dimn fix, which needed nothing here; the on-edge fix above is what this port changes.
    • setup (+ndi/+setup/) was at fd7ddbf06. The only net change is a comment in vhlab.m.
  • tests/test_daq_derived_digital_events.py: new. Checks dep, den, dimp and dimn against a reader with pulses at 1.0–1.1 s and 3.0–3.1 s. dimp and dimn fail without the fix (0.999 instead of 1.0).
  • tests/test_vhneuropixelsglx_nidq.py: new. The system loads with the NDR neuropixelsGLX reader, the epochdir navigator and the .nidq file patterns.
  • tests/test_vhprairieview.py: the blank-session count goes from 9 to 10.
  • CHANGELOG.md: Added and Fixed entries.

Merge order

Merge VH-Lab/NDI-matlab#1127 first, as a merge commit rather than a squash. The two bridge hashes point at dfba35572, which exists only on the paired NDI-matlab branch until then. Once this PR is on main, its CI falls back to NDI-matlab main. If dfba35572 isn't there, because the MATLAB PR hasn't merged or was squashed, the bridge-hash checks will fail.

Testing

Run locally:

  • black --check and ruff check pass.
  • pytest tests/ passes (5,547 tests). The cloud tests were left out because they need cloud credentials.
  • tests/test_matlab_bridge_hashes.py passes with NDI_BRIDGE_CHECK_STRICT=1 against the paired NDI-matlab branch, as in CI.
  • The symmetry make_artifacts and read_artifacts suites pass, apart from two failures that fail the same way on main here: a blocked dataset download and the optional pyabf package missing.

🤖 Generated with Claude Code

https://claude.ai/code/session_011v7R5uyvdiE4Ex6Q7UkurQ

…after

Mirrors VH-Lab/NDI-matlab#1127.

- ndi_common/daq_systems/vhlab/vhneuropixelsGLX_nidq.json: reads the
  SpikeGLX NI-DAQ stream (*.nidq.bin/.meta) with the NDR neuropixelsGLX
  reader, so NI-DAQ digital lines (XDn = di(n+1)) can be named in
  epochprobemap.txt, e.g. an opto fiber on XD4 as
  vhneuropixelsGLX_nidq:dimp5. A blank vhlab session now has ten DAQ
  systems (test_vhprairieview's count updated).
- ndi_daq_reader_mfdaq._read_derived_events: dep/den/dimp/dimn 'on'
  edges were timed one sample early (np.where without the + 1 that
  MATLAB's 1 + find(...), the 'off' edges and the ingested read use).
  The dimn 'off' bug fixed in MATLAB was already correct here.
- Tests for both; bridge decision_log and CHANGELOG entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5uyvdiE4Ex6Q7UkurQ
CI pairs this branch with NDI-matlab's same-named branch
(VH-Lab/NDI-matlab#1127), where both files have moved: mfdaq.m by the
dimn fix (d37bf16c7; this port's dimn was already right) and
+ndi/+setup/ by a comment in vhlab.m only. Notes in each decision_log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011v7R5uyvdiE4Ex6Q7UkurQ
@stevevanhooser
stevevanhooser merged commit 8df5730 into main Nov 1, 2026
28 of 29 checks passed
@stevevanhooser
stevevanhooser deleted the claude/bold-shannon-bucpux branch November 1, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants