Edit this page


:rewind: Back to the projects list

Filter Read by Label

Key Investigators

Project Description

We would like to define a standard way to associate data points in an NWB file with multiple user-defined categorical labels, and then be able to selectively read from a dataset just the data points that satisfy a boolean filter based on those labels. An example would be a dataset of UnitTimes containing spike trains recorded from an extracellular electrophysiology experiment. Each neuron in the dataset could be assigned a categorical label according to its 1) cell_type, 2) feature_selectivity (grid cell or head direction cell?), 3) active during sleep / wake?, etc. Then the user could read into memory the spikes from all cells that match a query for ‘cell_type’ == ‘basket_cell’, ‘selectivity’ == ‘running_speed’, ‘behavioral_state’ == ‘sleep’, e.g.


  1. Create a CategoricalLabels specification for assigning categorical labels to cell_identifiers in a SpikeTimes NWB dataset.
  2. Write a python function that takes in 1) a PyNWB SpikeTimes dataset object, 2) a newly-defined PyNWB CategoricalLabels object, and 3) a filter query in the form of a python dictionary with category_names as keys and lists of category_labels as values. Have it return a list of cell_ids that satisfy the filter, possibly with RangeReferences to the actual corresponding values in the data array.

Approach and Plan

Progress and Next Steps


Background and References