Skip to main content

NWB:N extension for storing metadata for Tank lab

Project description

ndx-tank-metadata

NWB LabMetaData extension for Tank lab.

Install

$ pip install ndx-tank-metadata

Usage

This extension is built for extending the LabMetaData schema with custom fields requested for the conversion of Virmen metadata. The extension is built into the Tank lab conversion pipeline (tank-lab-to-nwb) and is not necessary to be installed separately. Alternatively, it can be used from a python script as demonstrated below.

import os
from pynwb import NWBFile, NWBHDF5IO
from datetime import datetime

from ndx_tank_metadata import LabMetaDataExtension, RigExtension, MazeExtension

nwbfile = NWBFile('description', 'id', datetime.now().astimezone())

# Add rig information
rig = {'name': 'rig',
       'rig': 'VRTrain6',
       'simulationMode': 0,
       'hasDAQ': 1,
       'hasSyncComm': 0,
       'minIterationDT': 0.01,
       'arduinoPort': 'COM5',
       'sensorDotsPerRev': [1967.6, 1967.6, 1967.6, 1967.6],
       'ballCircumference': 63.8,
       'toroidXFormP1': 0.5193,
       'toroidXFormP2': 0.5171,
       'colorAdjustment': [0., 0.4, 0.5],
       'soundAdjustment': 0.2,
       'nidaqDevice': 1,
       'nidaqPort': 1,
       'nidaqLines': [0, 11],
       'syncClockChannel': 5,
       'syncDataChannel': 6,
       'rewardChannel': 0,
       'rewardSize': 0.004,
       'rewardDuration': 0.05,
       'laserChannel': 1,
       'rightPuffChannel': 2,
       'leftPuffChannel': 3,
       'webcam_name': 'Live! Cam Sync HD VF0770'}
rig_extension = RigExtension(**rig)

# Create mazes table
maze_extension = MazeExtension(name='mazes',
                               description='description of the mazes')

maze_dict = {'world': 1,
             'lStart': '5',
             'lCue': '45',
             'lMemory': '10',
             'cueDuration': 'NaN',
             'cueVisibleAt': 'Inf',
             'cueProbability': 'Inf',
             'cueDensityPerM': '3',
             'nCueSlots': '3',
             'tri_turnHint': 1,
             'color': [],
             'turnHint_Mem': 0,
             'numTrials': 10,
             'numTrialsPerMin': 2,
             'criteriaNTrials': 1,
             'warmupNTrials': [],
             'numSessions': 0,
             'performance': 0, 
             'maxBias': 1,
             'warmupMaze': [],
             'warmupPerform': [],
             'warmupBias': [],
             'warmupMotor': [],
             'easyBlock': 0,
             'easyBlockNTrials': 10,
             'numBlockTrials': 20,
             'blockPerform': 0.7}

# Add each maze to extension
maze_extension.add_row(**maze_dict)

# Create LabMetaData container
lab_metadata_dict = dict(
    name='LabMetaData',
    experiment_name='test',
    world_file_name='test',
    protocol_name='test',
    stimulus_bank_path='test',
    commit_id='test',
    location='test',
    num_trials=245,
    session_end_time=datetime.utcnow().isoformat(),
    rig=rig_extension,
    mazes=maze_extension
)

# Populate metadata extension 
lab_metadata = LabMetaDataExtension(**lab_metadata_dict)

# Add to file
nwbfile.add_lab_meta_data(lab_metadata)

filename = 'test_labmetadata.nwb'
with NWBHDF5IO(filename, 'w') as io:
    io.write(nwbfile)

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-tank-metadata-0.2.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

ndx_tank_metadata-0.2.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file ndx-tank-metadata-0.2.0.tar.gz.

File metadata

  • Download URL: ndx-tank-metadata-0.2.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3.post20210118 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

File hashes

Hashes for ndx-tank-metadata-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6268a6cfe268c73665d34f2227902a5efbc1d1d23ff01c4466c10d60ab4efcbe
MD5 8c2480dcd66be1ddee831aa51c449e13
BLAKE2b-256 4c0fd3d23deae930b5296dde1fbb29906522440974e2e9d9af0d2a2105818e9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ndx_tank_metadata-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3.post20210118 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

File hashes

Hashes for ndx_tank_metadata-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b593808dc5c6adb49a4e9fb359a74339d9fb8b38c2102415d44114cc8319fff2
MD5 4592d536e5bf025a51c1e1b4d28adafe
BLAKE2b-256 c802178d6e5839b04c5fcfdaf331bd19cd965523dad83e9fdb942cbce483193f

See more details on using hashes here.

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