Skip to main content

No project description provided

Project description

LINDI - Linked Data Interface

latest-release tests codecov

: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

pip install lindi

Or install from source

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


Download files

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

Source Distribution

lindi-0.2.0.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

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

lindi-0.2.0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file lindi-0.2.0.tar.gz.

File metadata

  • Download URL: lindi-0.2.0.tar.gz
  • Upload date:
  • Size: 25.1 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

Hashes for lindi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8d745e46438d824ea61314e41b587f331b4cd6c33e88c39ee5748191625f980f
MD5 414f10ec7030de80664fc2f97c609595
BLAKE2b-256 5aab8944663340d45b8b6e8988fb3b72676c4eaabc0915697cb6464002ba6196

See more details on using hashes here.

File details

Details for the file lindi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: lindi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.0 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

Hashes for lindi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f924baca63c59e6b3c4ef8f0ae2110068abe2a9141ad192282caa4a0ed1029e
MD5 c61f9c96f9327f31e908bfe0c23d9b46
BLAKE2b-256 5c3ed31c5b7006ff47ce60ea147b47588481561fe4a032036ee6a4f5e91612a8

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