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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bilab-0.1.1.tar.gz.
File metadata
- Download URL: bilab-0.1.1.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
247f1a312c298666e0a39aeb05dfd2978c585f1bb2ab2e0e0c290dad30365d78
|
|
| MD5 |
90f61f7bc441ad52131c46c633e84422
|
|
| BLAKE2b-256 |
4928e75fef863a131a6bf1573f7896e0155255c3963b7ed9519ffed27d3311ae
|
File details
Details for the file bilab-0.1.1-py3-none-any.whl.
File metadata
- Download URL: bilab-0.1.1-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e4f52a1c5bb343a17e6eca1f565aac2c9a2d0fef45f5a05d00dcbbccae501b4
|
|
| MD5 |
b90949cbbf77c255bc913db46c42516f
|
|
| BLAKE2b-256 |
3590efdc4b44c53ce3ebdaf07bed72215b49bf11b28cd75921e1491c90649a07
|