No project description provided
Project description
LINDI - Linked Data Interface
:warning: Please note, LINDI is currently under development and should not yet be used in practice.
LINDI is a Python library that facilitates handling NWB (Neurodata Without Borders) files in an efficient, flexible manner, especially when dealing with large datasets on remote servers. The goal is to enable composition of NWB files by integrating data from multiple sources without the need to copy or move large datasets.
LINDI features include:
- A specification for representing arbitrary HDF5 files as Zarr stores. This handles scalar datasets, references, soft links, and compound data types for datasets.
- A Zarr wrapper for remote or local HDF5 files (LindiH5ZarrStore). This involves pointers to remote files for remote data chunks.
- A function for generating a reference file system .zarr.json file from a Zarr store. This is inspired by kerchunk.
- An h5py-like interface for accessing these Zarr stores that can be used with pynwb.
This project was inspired by kerchunk and hdmf-zarr and depends on zarr, h5py, remfile and numcodecs.
Installation
For now, install from source. Clone this repo and then
cd lindi
pip install -e .
Example usage
# examples/example1.py
import json
import pynwb
import lindi
# Define the URL for a remote NWB file
h5_url = "https://api.dandiarchive.org/api/assets/11f512ba-5bcf-4230-a8cb-dc8d36db38cb/download/"
# Create a read-only Zarr store as a wrapper for the h5 file
store = lindi.LindiH5ZarrStore.from_file(h5_url)
# Generate a reference file system
rfs = store.to_reference_file_system()
# Save it to a file for later use
with open("example.zarr.json", "w") as f:
json.dump(rfs, f, indent=2)
# Create an h5py-like client from the reference file system
client = lindi.LindiH5pyFile.from_reference_file_system(rfs)
# Open using pynwb
with pynwb.NWBHDF5IO(file=client, mode="r") as io:
nwbfile = io.read()
print(nwbfile)
Or if you already have a .zarr.json file prepared (loading is much faster)
# examples/example2.py
import pynwb
import lindi
# Define the URL for a remote .zarr.json file
url = 'https://kerchunk.neurosift.org/dandi/dandisets/000939/assets/11f512ba-5bcf-4230-a8cb-dc8d36db38cb/zarr.json'
# Load the h5py-like client from the reference file system
client = lindi.LindiH5pyFile.from_reference_file_system(url)
# Open using pynwb
with pynwb.NWBHDF5IO(file=client, mode="r") as io:
nwbfile = io.read()
print(nwbfile)
Mixing and matching data from multiple sources
Once we have NWB files represented by relatively small reference file systems (e.g., .zarr.json files), we can begin to mix and match data from multiple sources. More on this to come.
For developers
Special Zarr annotations used by LINDI
License
See LICENSE.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file lindi-0.1.1.tar.gz
.
File metadata
- Download URL: lindi-0.1.1.tar.gz
- Upload date:
- Size: 25.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.18 Linux/6.5.6-76060506-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 154df68784672fba217415335a4ff7d680c5fd4568b12d38869c3afc8926956f |
|
MD5 | 3bc82d9b9c851163c7eb8b8c05d34871 |
|
BLAKE2b-256 | 4f9b3732bb9b5783ea4988dac9bdb47b3fc2b88ee3601564740f537a68f97999 |
Provenance
File details
Details for the file lindi-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: lindi-0.1.1-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.9.18 Linux/6.5.6-76060506-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d94db3e803999f5de19855ac50b799d2a793e06d34b4cd03d711a91bd5a3399 |
|
MD5 | 870091b8adb906ac0f3684e985bcf415 |
|
BLAKE2b-256 | 341186c564e2a9ee5826d64a45ac2b8f289111f7f138ba68705561f0bc47b8ef |