Skip to content

Add probe geometry extraction for SpikeGLX Neuropixels data#93

Merged
stevevanhooser merged 4 commits intomainfrom
claude/add-probe-geometry-function-Tv6qJ
Apr 5, 2026
Merged

Add probe geometry extraction for SpikeGLX Neuropixels data#93
stevevanhooser merged 4 commits intomainfrom
claude/add-probe-geometry-function-Tv6qJ

Conversation

@stevevanhooser
Copy link
Copy Markdown
Contributor

Summary

Adds a new function to extract probe geometry information from SpikeGLX .meta files and convert it to the NDI probe_geometry document format. This enables proper spatial representation of electrode positions for Neuropixels recordings.

Key Changes

  • New function probeGeometry(): Main entry point that reads a SpikeGLX .meta file and returns a structure with electrode positions and probe metadata matching the NDI probe_geometry specification
  • Dual geometry parsing strategy:
    • Prefers snsGeomMap field for newer SpikeGLX versions (>= 20230202) which directly provides electrode coordinates
    • Falls back to computing geometry from imroTbl and probe type for older files
  • Support for multiple probe types:
    • Neuropixels 1.0 (staggered 2-column, 20 µm pitch)
    • Neuropixels 2.0 single shank (2-column, 15 µm pitch)
    • Neuropixels 2.0 four shank (2-column, 15 µm pitch with 250 µm shank spacing)
    • Neuropixels Ultra (6 µm contacts)
  • Helper functions:
    • find_meta_field(): Locates fields in meta struct accounting for name transformations
    • parse_snsGeomMap(): Parses the newer geometry format
    • compute_geometry_from_imro(): Reconstructs electrode positions from imroTbl entries
    • probe_type_info(): Maps probe types to model names and contact sizes

Implementation Details

  • Output structure includes electrode positions (left-right, depth), shank IDs, contact dimensions, and probe metadata
  • Coordinates are in micrometers with depth as the primary spatial dimension
  • Front-back positions are set to zero (2D geometry)
  • Robust error handling for malformed or missing geometry data
  • Supports both 0-based (SpikeGLX) and 1-based (NDI) indexing conversions

https://claude.ai/code/session_01AiMXe9VfSzfRaNih6f7a76

…eta files

Parses electrode positions from ~snsGeomMap (preferred, newer SpikeGLX) or
computes them from ~imroTbl + probe type (fallback for older files). Returns
a struct matching the NDI probe_geometry document fields.

Supports NP 1.0 (type 0), NP 2.0 single shank (types 21/2003/2004),
NP 2.0 four shank (types 24/2013/2014), and NP Ultra (types 1100/1110).

https://claude.ai/code/session_01AiMXe9VfSzfRaNih6f7a76
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Test Results

108 tests  +16   108 ✅ +16   4s ⏱️ ±0s
 13 suites + 1     0 💤 ± 0 
  1 files   ± 0     0 ❌ ± 0 

Results for commit 79ab947. ± Comparison against base commit 284fdc1.

♻️ This comment has been updated with latest results.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

❌ Patch coverage is 0% with 109 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.54%. Comparing base (284fdc1) to head (b64d1c7).

Files with missing lines Patch % Lines
+ndr/+format/+neuropixelsGLX/probeGeometry.m 0.00% 109 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #93      +/-   ##
==========================================
- Coverage   29.24%   28.54%   -0.70%     
==========================================
  Files          91       92       +1     
  Lines        4469     4578     +109     
==========================================
  Hits         1307     1307              
- Misses       3162     3271     +109     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

claude and others added 3 commits April 5, 2026 18:43
Tests cover all code paths:
- snsGeomMap parsing (preferred path, newer SpikeGLX)
- imroTbl computation for NP 1.0 (type 0, staggered layout)
- imroTbl computation for NP 2.0 single shank (type 21)
- imroTbl computation for NP 2.0 four shank (type 24)
- Output struct field presence and sizes
- Error cases (missing geometry info, unsupported probe type)
- Bank selection for NP 1.0
- Sync channel exclusion

https://claude.ai/code/session_01AiMXe9VfSzfRaNih6f7a76
nargin counts testCase as the first argument, so the default check
for bank_values should be nargin < 3, not nargin < 4.

https://claude.ai/code/session_01AiMXe9VfSzfRaNih6f7a76
@stevevanhooser stevevanhooser merged commit b91defd into main Apr 5, 2026
@stevevanhooser stevevanhooser deleted the claude/add-probe-geometry-function-Tv6qJ branch April 5, 2026 18:51
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