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

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

Built distribution (wheel)

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

Total release size: 101.0 kB

Release files / npc_ephys-0.1.54.tar.gz

Download URL npc_ephys-0.1.54.tar.gz
Size 53.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a31e7c13a69b589e1988e35ae42f513b4612349ca7db839d19240ac4fa91c388
BLAKE2b-256 checksum
How to use checksums
8a37571a1df5843ffa2a85bc11a566f801b07f9b2926eaf7e9b37099329541f4
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.54-py3-none-any.whl

Download URL npc_ephys-0.1.54-py3-none-any.whl
Size 47.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
479d576b8c5fc6d4fc41ca68c425ab0d3fdd7989417d016a189ef96070effed3
BLAKE2b-256 checksum
How to use checksums
55dab3a5e7aefaee90074fc84ff009f7dae019d2d79a57b43840d146cb1f9efb
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.54

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