Skip to main content

A data API for the Brain Interfacing Laboratory

Project description

BIL Data Python API

This repository contains the public-facing Python API for accessing and analyzing neural data from the Brain Interfacing Laboratory. The public deposition is at the Stanford Digital Repository (SDR).

Installation

pip install bilab

Data Availability

The bil package is an API for interacting with publicly deposited data. In that directory, each recording session has its own identifier under the data directory. For instance, "U201130_01" is the first session by subject U on 2020-11-30.

Not all data types are available for all sessions.

Public datasets are deposited incrementally. The API contains methods for signals that will raise a FileNotFoundError if those signals have not been published.

Quickstart

See demo/md/quickstart.md.

from bil.api import get

# Initialize a study using a session ID
# Data will be fetched over HTTPS from the Stanford Digital Repository
study = get("U201130_01", download_dir="my_data")

# Access trial metadata
print(f"Number of trials: {len(study)}")
df = study.df

# Get a span of data for the first trial
# This is an accessor for a continuous segment of time
span = study.spans[0]

# Retrieve LFP data from that period of time from the Utah array in motor cortex
# This well get deposited in my_data/U201130_01
lfp = span.lfp(region="m1")  # (96, T) ndarray

Development

For development, clone the repository and install the additional dev dependencies:

pip install -e ".[dev]"

Alternatively, uv can be used to pull the latest uv.lock into a virtual environment:

uv sync --all-extras

Finally, configure pre-commit hooks:

pre-commit install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bilab-0.1.2.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bilab-0.1.2-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file bilab-0.1.2.tar.gz.

File metadata

  • Download URL: bilab-0.1.2.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":null}

File hashes

Hashes for bilab-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8842996fb97a05bc7c6d400c3586768ac67d0ec83779aa0c9caa423c487daeab
MD5 f78696c0524505f6092d97b6e3744743
BLAKE2b-256 9ff51588e6b91043f27385fc16567dc43e454d31278454f7d49b7ba0b2c1a05c

See more details on using hashes here.

File details

Details for the file bilab-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: bilab-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","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":null}

File hashes

Hashes for bilab-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d14bbb4e4bc35a1a041733deada6b7edf30580305fcfb980dc035b1d4821266
MD5 88e76594392c8b84c1378df8ce94de97
BLAKE2b-256 0fa2e8f0e8048a32fbbc9e0969e24d336ea075945d725be53817ffad061feddf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page