Skip to main content

NWB extension to store whisker tracking measurements computed with Whisk (Janelia Whisker Tracker) or other video-based whisker tracking methods.

Project description

ndx-whisk Extension for NWB

ndx-whisk is an NWB extension to store whisker tracking measurements. It is intended to convert .whiskers and .measurements files generated by whisk (Janelia Whisker Tracker), or saved to hdf5 with WhiskiWrap, but can be used with other whisker tracking methods.

Installation

pip install ndx-whisk

Usage

See test script test_whiskermeasurement.py in src/pynwb/tests.

from pynwb import NWBHDF5IO, NWBFile
from ndx_whisk import WhiskerMeasurementTable
import numpy as np

# Load your data
whisker_data = read_whisker_measurement_table('tracked_data.whiskers')

# Create a WhiskerMeasurementTable
whisker_meas = WhiskerMeasurementTable(
    name='name',
    description='description'
)

# Add data to the WhiskerMeasurementTable
for i in range(np.shape(whisker_data['frame_id'])[0]):
    whisker_meas.add_row({k: whisker_data[k][i] for k in whisker_data.keys()})
    
# Set up a NWB file
nwbfile = set_up_nwbfile()
path = 'tracked_data.nwb'

# Add a ProcessingModule for behavioral data
behavior_module = nwbfile.create_processing_module(
    name="behavior", description="Processed behavioral data"
)

# Add the WhiskerMeasurementTable
nwbfile.processing['behavior'].add(whisker_meas)

# Save to NWB file
with NWBHDF5IO(path, mode='w') as io:
    io.write(nwbfile)

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-whisk-0.1.1.tar.gz (10.5 MB view hashes)

Uploaded Source

Built Distribution

ndx_whisk-0.1.1-py2.py3-none-any.whl (4.5 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