Interactive NWB Data Exploration#

As we saw in the last section, the NWB file contains a ton of information about the experiment, as well as the actual data. We can look through each of the groups in the NWB file to pull out this information, or we can use a handy widget created by the NWB team.

This widget will also let us take a sneak peek at the behavioral and neural data as well. As a first pass, it can be very useful to explore the dataset in this high level way. This allows you to inspect the data for quality, and look for any interesting trends.

First, let’s set up our notebook and read the NWB file that we previously downloaded.

# import necessary packages
from pynwb import NWBHDF5IO
from nwbwidgets import nwb2widget

# set the filename
filename = '000006/sub-anm369962/sub-anm369962_ses-20170310.nwb'

# assign file as an NWBHDF5IO object
io = NWBHDF5IO(filename, 'r')

# read the file
nwb_file = io.read()

print('NWB file found and read.')
print(type(nwb_file))
NWB file found and read.
<class 'pynwb.file.NWBFile'>

Below, we’ll take advantage of the nwbwidgets package to explore the data. This package usefully automatically renders information and visualizations of the data, depending on what it is. We’ll use the nwb2widget function to explore the dataset we read above.

To take a peek at the neural data here, you can look under the “Units” header below.

Note: You won’t be able to see the output from the nwb4edu.github.io website. To see the output below, launch this in an interactive environment!

nwb2widget(nwb_file)

Questions for consideration

  1. What is the raw data being used to plot the visualizations in “units”? What is this data showing us?

  2. What kinds of visualizations do you see under “units”? Which of these are summary visualizations, versus more raw visualizations?

  3. Do you see any interesting trends in the data?


Lesson 1 Wrap Up#

In this first lesson, we showed you how to explore an NWB file. We discussed common elements in the structure, and how you can use nwbwidgets to explore the data at a high level.

Hopefully now you can:

✔️ Explain the three common features of datasets: metadata, raw data, and processed data

✔️ Identify and implement multiple ways to obtain a NWB dataset via DANDI

✔️ Explore the metadata contained in a typical Dandiset

✔️ Use an interactive widget for a big picture view of a Dandiset

In the following lesson, we’ll demonstrate different kinds of visualizations and analyses that you might do with the data.

Before moving on, try the Lesson #1 problem set to test your understanding and to put some of these new skills to work. 💪

Additional Resources#