Skip to main content

The NWB extension for storing Turner lab specific metadata

Project description

ndx-turner-metadata Extension for NWB

The NWB extension for storing Turner lab specific metadata.

Extends pynwb.file.LabMetaData to store the MPTP treatment status of the subject.

Installation

pip install ndx_turner_metadata

Usage

from uuid import uuid4
from datetime import datetime
from dateutil.tz import tzlocal

from pynwb import NWBFile, NWBHDF5IO

from ndx_turner_metadata import TurnerLabMetaData

# Create NWBFile
nwbfile = NWBFile(
        session_description="session_description",
        identifier=str(uuid4()),
        session_start_time=datetime(1970, 1, 1, tzinfo=tzlocal()),
    )

# Create LabMetaData
lab_meta_data = TurnerLabMetaData(
    name="MPTPMetaData",
    MPTP_status="pre-MPTP",
)

# Add to NWBFile
nwbfile.add_lab_meta_data(lab_meta_data=lab_meta_data)

# Write LabMetaData to NWB file
nwbfile_path = "metadata.nwb"
with NWBHDF5IO(nwbfile_path, mode="w") as io:
    io.write(nwbfile)
            
# Check LabMetaData was added to the NWB file
with NWBHDF5IO(nwbfile_path, mode="r", load_namespaces=True) as io:
    read_nwbfile = io.read()
    read_nwbfile_lab_metadata = read_nwbfile.lab_meta_data["MPTPMetaData"]

This extension was created using ndx-template.

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

ndx_turner_metadata-0.1.0.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distribution

ndx_turner_metadata-0.1.0-py2.py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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