Skip to main content

AIND ephys assets

CI PyPI - Version semantic-release: angular License ruff uv Copier

AIND ephys asset layout knowledge and helpers — stream discovery, path resolution, and name parsing for capsules that consume AIND raw + sorted electrophysiology assets. Pure filesystem / S3 structure reasoning; does not wrap SpikeInterface, does not build mipmaps.

Installation

pip install aind-ephys-assets          # local paths only
pip install 'aind-ephys-assets[s3]'    # adds s3fs for s3:// paths
pip install 'aind-ephys-assets[si]'    # adds SpikeInterface for load_motion / correct_recording

Or from a clone:

pip install .            # or `pip install '.[s3]'`
uv sync                  # dev

Usage

from aind_ephys_assets import (
    discover_raw_streams,
    discover_analyzers,
    resolve_raw_root,
    resolve_sort_root,
    find_raw_zarr,
)

# Enumerate raw AP/LFP streams (local or s3://).  Auto-descends into
# ecephys/ecephys_compressed/ when the caller passes the asset root.
streams = discover_raw_streams("/data/raw_asset")
for s in streams:
    print(s.name, s.sampling_frequency, s.n_channels)

# Enumerate sorted analyzers and map each to its raw counterpart.
analyzers = discover_analyzers(
    "/data/sorted_asset",
    raw_root="s3://my-bucket/raw_asset/ecephys/ecephys_compressed",
)
for a in analyzers:
    print(a.name, "→ raw:", a.raw_path)

# S3 with anonymous auth (e.g. AIND Open Data):
streams = discover_raw_streams(
    "s3://aind-open-data/ecephys_...",
    storage_options={"anon": True},
)

# Stand-alone helpers
from aind_ephys_assets import (
    extract_device_name,
    match_analyzer_to_raw,
    sanitize_stream_name,
    read_si_zarr_header,
    open_raw_traces,
)

assert match_analyzer_to_raw("foo_recording1.zarr") == "foo.zarr"
assert extract_device_name("..._Neuropix-PXI-100.50213-1_recording1") == "50213-1"

header = read_si_zarr_header("/path/to/stream.zarr")
traces, sf = open_raw_traces("/path/to/stream.zarr")

Drift estimates

A sorted asset saves Kilosort 4's applied estimate (spikesorted/motion/<recording>/, opposite sign to SpikeInterface) and preprocessing's unapplied dredge_fast (preprocessed/motion/<recording>/motion/). Both come back in SpikeInterface's sign; there is no fallback from one to the other.

from aind_ephys_assets import read_motion, load_motion, correct_recording

m = read_motion(sort_root, analyzer_name)              # numpy only
motion, info = load_motion(sort_root, analyzer_name, recording)   # [si]: Motion on the recording's clock
corrected = correct_recording(recording, motion)        # [si]: float32, kriging, all channels kept

SpikeInterface pins zarr<3 below Python 3.14, so its tests run outside the default zarr 3 environment: uv run --extra si --no-group zarr3 pytest.

Development

Please test your changes using the full linting and testing suite:

./scripts/run_linters_and_checks.sh -c

Or run individual commands:

uv run --frozen ruff format          # Code formatting
uv run --frozen ruff check           # Linting
uv run --frozen mypy                 # Type checking
uv run --frozen interrogate -v src   # Documentation coverage
uv run --frozen codespell --check-filenames  # Spell checking
uv run --frozen pytest --cov aind_ephys_assets # Tests with coverage

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for aind-ephys-assets 0.5.0

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

Source distribution (sdist)

Source distribution for aind-ephys-assets 0.5.0
File Size Uploaded Provenance Actions
aind_ephys_assets-0.5.0.tar.gz 201.0 kB Without provenance Details for aind_ephys_assets-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aind-ephys-assets 0.5.0
File Interpreter ABI Platform Actions
aind_ephys_assets-0.5.0-py3-none-any.whl Python 3 none any Details for aind_ephys_assets-0.5.0-py3-none-any.whl

Total release size: 219.3 kB

Release files / aind_ephys_assets-0.5.0.tar.gz

Download URL aind_ephys_assets-0.5.0.tar.gz
Size 201.0 kB
Tags Source
SHA-256 checksum
How to use checksums
05386ce5c6fab5c1c6bb1ddcf46ef95600abfd4a12e65992de9abac430a4b753
BLAKE2b-256 checksum
How to use checksums
f03e58f82429b3aad61581c6af129ae2fe2ed2e94a79c2d5f8fa7b7bc50addfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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 / aind_ephys_assets-0.5.0-py3-none-any.whl

Download URL aind_ephys_assets-0.5.0-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9f7c5930e922c45b27126e741bb96d64052b30f8d46963bf71fb7ef416e1e71a
BLAKE2b-256 checksum
How to use checksums
c21079b4505609a2207456c615ec8a009dfd955ae8d0c042833e3d1715ebed9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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 aind-ephys-assets 0.5.0

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