Skip to main content

Collection of tools for Neuropixel 1.0 and 2.0 probes data

Project description

ibl-neuropixel

Collection of tools to handle Neuropixel 1.0 and 2.0 data (documentation coming soon...)

Installation

Minimum Python version supported is 3.10 uv pip install ibl-neuropixel

Destriping

Getting started

Compress a binary file losslessly using mtscomp

The mtscomp util implements fast chunked compression for neurophysiology data in a single shard. Package repository is here.

from pathlib import Path
import spikeglx
file_spikeglx = Path('/datadisk/neuropixel/file.imec0.ap.bin')
sr = spikeglx.Reader(file_spikeglx)
sr.compress_file()
# note: you can use sr.compress_file(keep_original=False) to also remove the orginal bin file

Reading raw spikeglx file and manipulating arrays

The mtscomp util implements fast chunked compression for neurophysiology data in a single shard. Package repository is here.

from pathlib import Path
import spikeglx

import ibldsp.voltage

file_spikeglx = Path('/datadisk/Data/neuropixel/human/Pt01.imec0.ap.bin')
sr = spikeglx.Reader(file_spikeglx)

# reads in 300ms of data
raw = sr[10_300_000:10_310_000, :sr.nc - sr.nsync].T
destripe = ibldsp.voltage.destripe(raw, fs=sr.fs, neuropixel_version=1)

# display with matplotlib backend
import ibldsp.plots
ibldsp.plots.voltageshow(raw, fs=sr.fs, title='raw')
ibldsp.plots.voltageshow(destripe, fs=sr.fs, title='destripe')

# display with QT backend
from viewephys.gui import viewephys
eqc = {}
eqc['raw'] = viewephys(raw, fs=sr.fs, title='raw')
eqc['destripe'] = viewephys(destripe, fs=sr.fs, title='destripe')

Destripe a binary file

This relies on a fast fourier transform external library: pip install pyfftw.

Minimal working example to destripe a neuropixel binary file.

from pathlib import Path
from ibldsp.voltage import decompress_destripe_cbin
sr_file = Path('/datadisk/Data/spike_sorting/pykilosort_tests/imec_385_100s.ap.bin')
out_file = Path('/datadisk/scratch/imec_385_100s.ap.bin')

decompress_destripe_cbin(sr_file=sr_file, output_file=out_file, nprocesses=8)

Viewer

The best way to look at the results is to use viewephys, open an ephys viewer on the raw data.

  • tick the destripe box.
  • move to a desired location in the file
  • ctr+P will make the gain and axis the same on both windows

alt text

You can then move within the raw data file.

White Paper

The following describes the methods implemented in this repository. https://doi.org/10.6084/m9.figshare.19705522

Contribution

Please see our contribution guidelines for details on how to contribute to this project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ibl_neuropixel-1.10.0.tar.gz (351.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ibl_neuropixel-1.10.0-py3-none-any.whl (126.0 kB view details)

Uploaded Python 3

File details

Details for the file ibl_neuropixel-1.10.0.tar.gz.

File metadata

  • Download URL: ibl_neuropixel-1.10.0.tar.gz
  • Upload date:
  • Size: 351.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for ibl_neuropixel-1.10.0.tar.gz
Algorithm Hash digest
SHA256 9e2d5015cbeaae01c64c5a14733e5b167e1ad6d8bf3edf642182ae3e5ee287f2
MD5 7b29b28c7b969cbc2bf3a6e140ab6462
BLAKE2b-256 8262cf525d95f261e603cdad7e4ac3eca1c83c3edec7a146e39bc17e1716f62f

See more details on using hashes here.

File details

Details for the file ibl_neuropixel-1.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ibl_neuropixel-1.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1b6577ff4db647df4ae37d8c644f418e6ade9a4575ed79e8a4bf6f16bee23e0
MD5 946d5c7aa6da3a827f0bfb4783ce7d46
BLAKE2b-256 3b866f3ee97d25b89fc3b5c67774165b633d51895c177fc8bb3dfb8f15e8ad19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page