Skip to main content

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
SpikeInterfaceData(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])

make_units_table_from_spike_interface() automatically reads either the legacy folder layout or the newer SpikeInterface SortingAnalyzer Zarr layout. make_units_table_from_spike_interface_ks25() remains available as a backwards-compatible alias.

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

Metadata

Release files for npc-ephys 0.1.49

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for npc-ephys 0.1.49
File Size Uploaded
npc_ephys-0.1.49.tar.gz 39.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for npc-ephys 0.1.49
File Interpreter ABI Platform
npc_ephys-0.1.49-py3-none-any.whl Python 3 none any Details

Total release size: 76.5 kB

Release files / npc_ephys-0.1.49.tar.gz

Download URL npc_ephys-0.1.49.tar.gz
Size 39.9 kB
Tags Source
SHA-256 checksum
How to use checksums
52ec773d0bd9e74ae405e3dfd17adbc87191868b4a741948f59dedf9459ebb15
BLAKE2b-256 checksum
How to use checksums
9b0ac8cba92b82844f9e6b1c43d844b7b6f0e84825a8ac0798ca1ecec8ea4e37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.29.1 CPython/3.11.16 Linux/6.17.0-1022-azure

Release files / npc_ephys-0.1.49-py3-none-any.whl

Download URL npc_ephys-0.1.49-py3-none-any.whl
Size 36.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59b39a94389bdde0549b11e07cfccff792f3abb577d17f821c55b57f35e194e1
BLAKE2b-256 checksum
How to use checksums
4834717f752eaba1b1a9b3a8580781b0852e1f6c4fcb06a6579eda1b1a6600b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.29.1 CPython/3.11.16 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

This release

0.1.49 This release

2 release files

0.1.48

2 release files

0.1.47

2 release files

0.1.46

2 release files

0.1.45

2 release files

0.1.44

2 release files

0.1.43

2 release files

0.1.42

2 release files

0.1.41

2 release files

0.1.40

2 release files

0.1.37

2 release files

0.1.35

2 release files

0.1.34

2 release files

0.1.33

2 release files

0.1.32

2 release files

0.1.31

2 release files

0.1.30

2 release files

0.1.29

2 release files

0.1.28

2 release files

0.1.27

2 release files

0.1.26

2 release files

0.1.25

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page