Skip to content

Add probe utility functions for export and location queries#7

Merged
stevevanhooser merged 3 commits into
mainfrom
claude/add-probe-functions-kSZ6A
Mar 10, 2026
Merged

Add probe utility functions for export and location queries#7
stevevanhooser merged 3 commits into
mainfrom
claude/add-probe-functions-kSZ6A

Conversation

@stevevanhooser
Copy link
Copy Markdown
Contributor

Summary

This PR adds a new ndi.fun.probe module with utility functions for exporting probe data to binary files and querying probe location documents. These functions provide Python equivalents to existing MATLAB functionality.

Key Changes

  • New module ndi.fun.probe: Created with three main functions:

    • export_binary(): Exports probe data to binary files with metadata, supporting configurable precision and scaling
    • export_all_binary(): Batch exports all n-trode probes in a session to a kilosort-compatible directory structure
    • location(): Traverses element dependency trees to find associated probe objects and their location documents
  • Implementation details:

    • export_binary() processes data in 100-second chunks to manage memory efficiently
    • Supports multiple data types via NumPy dtype strings (default int16)
    • Writes channel-interleaved binary data with accompanying metadata files
    • export_all_binary() creates organized subdirectories for each probe with safe naming (spaces replaced with underscores)
    • location() handles both element objects and string identifiers, with proper dependency resolution
  • Module integration: Updated ndi.fun.__init__.py to expose the new probe submodule and updated docstring to reflect new functionality

Notable Implementation Details

  • Data is transposed before writing to ensure channel-interleaved format
  • Metadata files (.metadata extension) are created alongside binary files with epoch information and scaling parameters
  • Default multiplier in export_all_binary() is 1/0.195 for Intan data compatibility
  • Robust handling of epoch table formats and time-to-sample conversions

https://claude.ai/code/session_01U7Zn3csCPw6VJyMNfF59dz

claude added 3 commits March 10, 2026 11:41
…location

Port three functions from NDI-matlab's +ndi/+fun/+probe/ package:
- export_binary: exports a single probe's timeseries data to an int16 binary file
- export_all_binary: batch exports all n-trode probes to kilosort-compatible binaries
- location: finds probe_location documents by traversing the underlying_element tree

The ndi.fun.probe subpackage is registered in ndi.fun.__init__ so that
ndi.fun.probe.* is importable.

https://claude.ai/code/session_01U7Zn3csCPw6VJyMNfF59dz
@stevevanhooser stevevanhooser merged commit 4d3c61b into main Mar 10, 2026
4 checks passed
@stevevanhooser stevevanhooser deleted the claude/add-probe-functions-kSZ6A branch March 10, 2026 11:52
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