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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file npc-ephys-0.1.3.tar.gz
.
File metadata
- Download URL: npc-ephys-0.1.3.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.12.3 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fccec1f1e3d5b20a9ccd4bbd2de86f441796d2569bfaf6945ed902479224b892 |
|
MD5 | b458ac1b978a04d6903bea0e910f2d14 |
|
BLAKE2b-256 | e7d8f9a1110d778580eaa8a2c5b95bf2f510e5369dfd35b4a522e7c6b10a1cb0 |
File details
Details for the file npc_ephys-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: npc_ephys-0.1.3-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.12.3 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86ef4c4bc6507c278b1b5d14b916ebe8f7f5dd7aea07833ae3f7bc625ac8e3ee |
|
MD5 | 047a5d2fa33e2db458d014788f6d6e49 |
|
BLAKE2b-256 | 8232c2ec1b78998295a6e7ce85da189877fdc684a16eb68ec02412dd7d67079c |