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 = npc_ephys.get_ephys_timing_on_sync(sync_path, recording_path)[0]
>>> timing_data.device.name, timing_data.status, round(timing_data.sampling_rate, 2), round(timing_data.start_time, 3)
('Neuropix-PXI-100.ProbeA-AP', 'pass', 30000.07, 20.08)

# 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(...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.53

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.53
File Size Uploaded Provenance Actions
npc_ephys-0.1.53.tar.gz 53.0 kB Without provenance Details for npc_ephys-0.1.53.tar.gz

Built distribution (wheel)

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

Total release size: 100.8 kB

Release files / npc_ephys-0.1.53.tar.gz

Download URL npc_ephys-0.1.53.tar.gz
Size 53.0 kB
Tags Source
SHA-256 checksum
How to use checksums
16ea8f7f57402b7ea78d647e5ce12a942566cc1c39858b705c25b3fc8f5077be
BLAKE2b-256 checksum
How to use checksums
6f2078bfd76826c59231333d5ffa2bc96c7aed7301b1b1fb8284047de8b06246
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL npc_ephys-0.1.53-py3-none-any.whl
Size 47.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91b8fde73faaddbaa5e876b120a8ddba584894840cb404b843eaac5c3a0fe3ed
BLAKE2b-256 checksum
How to use checksums
62ac46d931385cd0eaefc3149e1f707543d3d46b5c089249fc6dec6a8c0da16b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for npc-ephys 0.1.53

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.53 This release

2 release files No provenance

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