Skip to content

catalystneuro/brunton-lab-to-nwb

Repository files navigation

brunton-lab-to-nwb

Package for converting data in the Brunton Lab to NWB.

Installation

pip install git+https://github.com/catalystneuro/brunton-lab-to-nwb.git

Usage

from brunton_lab_to_nwb import run_conversion

run_conversion('in/path', 'out/path')

Example uses:

Load nwb file:

from pynwb import NWBHDF5IO
io = NWBHDF5IO(r'C:\Users\micha\Desktop\Brunton Lab Data\H5\subj_01_day_3.nwb', mode='r')
nwb = io.read()

See accessible fields in nwb file object:

nwb_file.fields

Get electrode series:

nwb_file.electrodes

Align events

# Get reach events
events = nwb_file.processing["behavior"].data_interfaces["ReachEvents"]
# Get reach position
reach_arm_pos = nwb_file.processing["behavior"].data_interfaces["Position"]["L_Wrist"]
# Set window around event alignment
before = 1.5 # in seconds
after = 1.5 # in seconds
starts = self.events - before
stops = self.events + after
# Get trials aligned by events
trials = align_by_times(reach_arm_pos, starts, stops)

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published