Skip to main content

Tools for accessing and processing raw ephys data, compatible with data in the cloud.

Project description

npc_ephys

Tools for accessing and processing raw ephys data, compatible with data in the cloud.

PyPI Python version

Coverage CI/CD GitHub issues

Usage

conda create -n npc_ephys python>=3.9
conda activate npc_ephys
pip install npc_ephys

Windows

wavpack-numcodecs is used to read compressed ephys data from S3 (stored in Zarr format). On Windows, that requires C++ build tools to be installed: if pip install npc_ephys fails you'll likely need to download it from here.

Python

>>> import npc_ephys

# get device timing on sync clock using barcodes:
>>> recording_path = 's3://aind-ephys-data/ecephys_670248_2023-08-03_12-04-15/ecephys_clipped/Record Node 102/experiment1/recording1'
>>> sync_path = 's3://aind-ephys-data/ecephys_670248_2023-08-03_12-04-15/behavior/20230803T120415.h5'
>>> timing_data = next(npc_ephys.get_ephys_timing_on_sync(sync_path, recording_path))
>>> timing_data.device.name, timing_data.sampling_rate, timing_data.start_time
('Neuropix-PXI-100.ProbeA-AP', 30000.070518634246, 20.080209634424037)

# get a dataclass that reads SpikeInterface sorted data from the cloud
# - from a path:
>>> si = npc_ephys.get_spikeinterface_data('s3://codeocean-s3datasetsbucket-1u41qdg42ur9/4797cab2-9ea2-4747-8d15-5ba064837c1c')

# - or from a subject ID + date + session-index-on-date (separators are optional):
>>> si = npc_ephys.get_spikeinterface_data('670248_2023-08-03_0')

>>> si
SpikeInterfaceKS25Data(session='670248_2023-08-03_0', root=S3Path('s3://codeocean-s3datasetsbucket-1u41qdg42ur9/4797cab2-9ea2-4747-8d15-5ba064837c1c'))

# various bits of data are available for use:
>>> si.version
'0.97.1'
>>> ''.join(si.probes)
'ABCEF'
>>> si.quality_metrics_df('probeA').columns
Index(['num_spikes', 'firing_rate', 'presence_ratio', 'snr',
        'isi_violations_ratio', 'isi_violations_count', 'rp_contamination',
        'rp_violations', 'sliding_rp_violation', 'amplitude_cutoff',
        'drift_ptp', 'drift_std', 'drift_mad', 'isolation_distance', 'l_ratio',
        'd_prime'],
        dtype='object')
>>> si.spike_indexes('probeA')
array([      491,       738,       835, ..., 143124925, 143125165, 143125201])
>>> si.unit_indexes('probeA')
array([ 56,  61, 161, ..., 151,  72,  59])

Development

See instructions in https://github.com/AllenInstitute/npc_ephys/CONTRIBUTING.md and the original template: https://github.com/AllenInstitute/copier-pdm-npc/blob/main/README.md

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

npc_ephys-0.1.31.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

npc_ephys-0.1.31-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file npc_ephys-0.1.31.tar.gz.

File metadata

  • Download URL: npc_ephys-0.1.31.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.19.2 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for npc_ephys-0.1.31.tar.gz
Algorithm Hash digest
SHA256 541d72df9e75e1477b12091ae2e6585390a4c05fedefb82d0d6a230a6e4b3c3e
MD5 455b72df17ae304e33b86b01e21d4a24
BLAKE2b-256 f683ac7096f48ac4afc732a7649d314302213abc357b93b3e331d9b82611339b

See more details on using hashes here.

File details

Details for the file npc_ephys-0.1.31-py3-none-any.whl.

File metadata

  • Download URL: npc_ephys-0.1.31-py3-none-any.whl
  • Upload date:
  • Size: 33.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.19.2 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for npc_ephys-0.1.31-py3-none-any.whl
Algorithm Hash digest
SHA256 31876b56451374126514edcbbd025a221a094d6c282a104f0fc4b11993a250f0
MD5 26a71627a078bfa57e7fead82ea8387a
BLAKE2b-256 43a28fc2ae88ce16bc3501542b643688e36c3aa64925a899421b769a38b9edd0

See more details on using hashes here.

Supported by

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