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('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.50

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.50
File Size Uploaded Provenance Actions
npc_ephys-0.1.50.tar.gz 51.3 kB Without provenance Details for npc_ephys-0.1.50.tar.gz

Built distribution (wheel)

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

Total release size: 97.9 kB

Release files / npc_ephys-0.1.50.tar.gz

Download URL npc_ephys-0.1.50.tar.gz
Size 51.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7a57e1ce81bb33409a41ca56c7887acacd4795e63d2a6c4ef3286885bf3719f8
BLAKE2b-256 checksum
How to use checksums
8ebd2dd5406e185bd08304623f3d0bf172526ddc23d0b03f6d485790315d5e16
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.50-py3-none-any.whl

Download URL npc_ephys-0.1.50-py3-none-any.whl
Size 46.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7269a20b486e95c4aee0b64ef2d331f9fbb24a4e055b11ea312bdb1d46d8baf
BLAKE2b-256 checksum
How to use checksums
2e09be3902a33609cdce51b519a62e374382e2689017f37ff6f44a7e6890c8b0
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.50

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