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.51

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.51
File Size Uploaded Provenance Actions
npc_ephys-0.1.51.tar.gz 51.5 kB Without provenance Details for npc_ephys-0.1.51.tar.gz

Built distribution (wheel)

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

Total release size: 98.2 kB

Release files / npc_ephys-0.1.51.tar.gz

Download URL npc_ephys-0.1.51.tar.gz
Size 51.5 kB
Tags Source
SHA-256 checksum
How to use checksums
33b585fca0ae3c5f3b0477455cc4c2bc1183867019675e13f252cc4dcf626643
BLAKE2b-256 checksum
How to use checksums
407826e6e9577ac4d1c131d10a20539d63cc1b63d1c806a56b2947d064b32c61
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.51-py3-none-any.whl

Download URL npc_ephys-0.1.51-py3-none-any.whl
Size 46.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7fbadd6d2d466eff2bc81f135cbda2276d52cbbe223a5ea7d45c8b2b3645d75
BLAKE2b-256 checksum
How to use checksums
906b317074092f1410102cf0719772b968a9b6ee7940ebe7ea4f0f6e0eb661be
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.51

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.51 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