image thumbnail


version 0.9.1 (2.08 MB) by Ethan Meyers
A MATLAB toolbox for interacting with the Allen Brain Observatory


Updated 17 Jun 2021

From GitHub

View license on GitHub

View Brain-Observatory-Toolbox on File Exchange

Brain Observatory Toolbox

A MATLAB toolbox for accessing and using the neural recording public datasets from the Allen Brain Observatory[1].

👀 See the Brain Observatory Toolbox in action, with the EphysDemo and the OphysDemo demonstration live scripts.

🚧 The Brain Observatory Toolbox is at an early stage (v0.9), meaning two things:

  • Questions, suggestions, and other feedback are highly welcomed (in the Discussion forum)
  • Some interface compatibility changes may occur at each early-stage release (v0.9.x)
    • The Allen Brain Observatory dataset records, files, and values browsed and accessed by this toolbox would not be impacted.

About the Allen Brain Observatory datasets

Data releases from the Allen Brain Observatory include two datasets of neural activity recordings:

Dataset Recording Type Nickname Details
Visual Coding Neuropixels [2] Large-scale neural probe recordings "ephys" (electrophysiology) details
Visual Coding 2P [3] Two-photon calcium imaging "ophys" (optical physiology) details

The Visual Coding datasets are both collected from the living mouse brain during presentation of varying visual stimuli. Technical white papers (see Details for each dataset) provide detailed information about the experimental technicalities and computational pipelines.

About the Brain Observatory Toolbox (BOT)

The Brain Observatory Toolbox (BOT) provides a uniform interface to access and use these Visual Coding neural datasets.

The BOT interface provides tabular representations of available dataset items and object representations of specific dataset items:

alt text

Key Points:

  • Dataset items supported include experimental sessions (for both 2P and Neuropixels) as well as probes, channels, and units (for Neuropixels)
    • Tabular indexing or unique item identifiers allow specific item selection from item tables, for inspection and analysis as item objects
  • Item object properties access direct, derived, and file-linked values for an item
    • "On demand" properties defer value retrieval, for those item object properties involving extensive compute or file reading
    • Item object methods are used to compute values requiring additional user-specified arguments
  • Local caching is implemented*, to provide the fastest possible initial and repeat performance within and across MATLAB sessions

*For retrieved item information, object representations, and file contents

Installation Instructions

  1. Download the .zip file from the latest GitHub release
  2. Unzip via preferred system tool to desired local folder location
  3. Open MATLAB
  4. Add root directory of the unzipped folder contents to the MATLAB path, in one of three ways:
    1. Navigate to root directory in the Current Folder browser and select "Add to Path" from the right-click context menu, using the "Selected Folder" option*
    2. Open the Set Path dialog from the Environment section of the Home tab
    3. Call addpath(<root directory location>) in the Command Window

*The BOT is contained in the +bot package folder. For package folders, adding the parent folder is sufficient to include all package contents.

Required products

  • MATLAB (R2021a)
  • Image Processing Toolbox (if running the Visual Coding 2P demonstration OphysDemo.mlx)

Getting started

Four MATLAB live scripts are provided to help get started:

Live Script(s) About
Demonstrations of illustrative neurophysiological analyses using the BOT and the datasets
Step-by-step instruction and "under the hood" technical detail about using the BOT and the datasets

Or to get a fast first look yourself, enter the following commands in MATLAB:

>> sessions = bot.fetchSessions('ephys'); 
>> head(sessions) 
>> session = bot.session(sessions(1,:))
>> methods(session) 


[1] Copyright 2016 Allen Institute for Brain Science. Allen Brain Observatory. Available from:

[2] Copyright 2019 Allen Institute for Brain Science. Visual Coding Neuropixels Dataset. Available from:

[3] Copyright 2016 Allen Institute for Brain Science. Visual Coding 2P Dataset. Available from:


Initial engineering work was supported by the Foundation of Psychocultural Research and Sherman Fairchild Award at Hampshire College and hosted by the Center for Brains, Minds, and Machines at the Massachusetts Institute of Technology.

Cite As

Ethan Meyers (2021). Brain-Observatory-Toolbox (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with R2021a
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.