ERP Analysis With Pandas And Seaborn

Authors
Dr. Nicholas Del Grosso | Dr. Sangeetha Nandakumar | Dr. Ole Bialas | Dr. Atle E. Rimehaug

We will use the Steinmetz et al., 2019 in Nature dataset. The experiment involved a mouse being presented with two gradients of varying intensities. The mouse’s task was to adjust a wheel to center the brighter gradient on the screen. Simultaneously, Local Field Potential (LFP) measurements were recorded across various brain areas. These measurements were taken 250 times in 2.5 seconds.

Analysis goals

In these exercises, our primary objective is to analyze and visualize Local Field Potential (LFP) data collected from distinct brain regions separately. Through this analysis, we aim to:

  • compute trial statistics on LFP amplitudes (e.g. mean, min, max)
  • compare these statistics between different brain areas

Learning goals

In this notebook, we’ll focus on learning Seaborn’s:

  • sns.catplot() function for categorical plots
  • sns.lineplot() function for plotting time series models
  • sns.relplot() for making plots that display relations between different variables in the data
  • sns.heatmap() for using colors to compare trends.

Setup

Import Libraries

import xarray as xr
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from pathlib import Path
import owncloud

Download the dataset

Path('data').mkdir(exist_ok=True, parents=True)

owncloud.Client.from_public_link('https://uni-bonn.sciebo.de/s/ntp2JGQ2Xqi4MTw', folder_password="ibots").get_file('/', f'data/steinmetz_2016-12-14_Cori.nc')
True

Section 1: Extracting Data from XArray Datasets into Tidy DataFrames and Plot with Seaborn Catplot

In this section, we’ll work with a dataset from a single session recording of Cori the mouse 🐁 (‘steinmetz_2016-12-14_Cori.nc’).

Our primary objective is to read this data and convert it into a Pandas dataframe, which will serve as the foundation for the subsequent exercises.

Load dataset and convert to Pandas dataframe:

Code Description
dset = xr.load_dataset("path/to/file/like/this.nc") Loads the dataset from the specified file path using xarray (xr).
df = dset['column1'].to_dataframe() Extracts the ‘column1’ data variable from the dataset and converts it into a Pandas DataFrame (df).
df.reset_index() Resets the index of the ‘df’ DataFrame to create a default integer index.
dset['column1'].to_dataframe().reset_index() All of it, together!
dset[['column1', 'column2']].to_dataframe().reset_index() Extracts column1 and column2, converts to dataframe, and resets index
sns.catplot(data=df, x='categorical_column_1', y='continuous_column', kind='bar'/'count'/'box'), col='categorical_column_2 Makes categorical plots of specified kind split into columns based on categories in categorical_column_2

Run the code below to make a variable called dset by calling by Xarray’s xr.load_dataset() function on the ‘steinmetz_2016-12-14_Cori.nc’ session file. Confirm that the “lfp” data variable is there.

Exercises

dset = xr.load_dataset('data/steinmetz_2016-12-14_Cori.nc')
dset
<xarray.Dataset> Size: 118MB
Dimensions:             (trial: 364, time: 250, cell: 734,
                         waveform_component: 3, sample: 82, probe: 384,
                         brain_area_lfp: 7, spike_id: 2446173)
Coordinates:
  * trial               (trial) int32 1kB 1 2 3 4 5 6 ... 360 361 362 363 364
  * time                (time) float64 2kB 0.01 0.02 0.03 0.04 ... 2.48 2.49 2.5
  * cell                (cell) int32 3kB 1 2 3 4 5 6 ... 729 730 731 732 733 734
  * waveform_component  (waveform_component) int32 12B 1 2 3
  * probe               (probe) int32 2kB 1 2 3 4 5 6 ... 380 381 382 383 384
  * brain_area_lfp      (brain_area_lfp) <U4 112B 'ACA' 'LS' ... 'SUB' 'VISp'
  * spike_id            (spike_id) int32 10MB 1 2 3 ... 2446171 2446172 2446173
Dimensions without coordinates: sample
Data variables: (12/31)
    contrast_left       (trial) int8 364B 100 0 100 0 50 0 ... 50 50 0 25 100
    contrast_right      (trial) int8 364B 0 50 50 0 100 0 ... 100 25 25 50 0 100
    gocue               (trial) float64 3kB 1.027 0.8744 0.8252 ... nan nan nan
    stim_onset          (trial) float64 3kB 0.5 0.5 0.5 0.5 ... 0.5 0.5 0.5 0.5
    feedback_type       (trial) float64 3kB 1.0 1.0 1.0 1.0 ... nan nan nan nan
    feedback_time       (trial) float64 3kB 1.187 1.438 0.986 ... nan nan nan
    ...                  ...
    waveform_w          (cell, sample, waveform_component) float32 722kB 0.0 ...
    waveform_u          (cell, waveform_component, probe) float32 3MB 0.0 ......
    lfp                 (brain_area_lfp, trial, time) float64 5MB -2.851 ... ...
    spike_time          (spike_id) float32 10MB 0.2676 2.308 ... 2.189 2.399
    spike_cell          (spike_id) uint32 10MB 1 1 1 1 1 ... 734 734 734 734 734
    spike_trial         (spike_id) uint32 10MB 21 21 31 37 ... 364 364 364 364
Attributes:
    session_date:  2016-12-14
    mouse:         Cori
    stim_onset:    0.5
    bin_size:      0.01
xarray.Dataset
    • trial: 364
    • time: 250
    • cell: 734
    • waveform_component: 3
    • sample: 82
    • probe: 384
    • brain_area_lfp: 7
    • spike_id: 2446173
    • trial
      (trial)
      int32
      1 2 3 4 5 6 ... 360 361 362 363 364
      array([  1,   2,   3, ..., 362, 363, 364], dtype=int32)
    • time
      (time)
      float64
      0.01 0.02 0.03 ... 2.48 2.49 2.5
      array([0.01, 0.02, 0.03, ..., 2.48, 2.49, 2.5 ])
    • cell
      (cell)
      int32
      1 2 3 4 5 6 ... 730 731 732 733 734
      array([  1,   2,   3, ..., 732, 733, 734], dtype=int32)
    • waveform_component
      (waveform_component)
      int32
      1 2 3
      array([1, 2, 3], dtype=int32)
    • probe
      (probe)
      int32
      1 2 3 4 5 6 ... 380 381 382 383 384
      array([  1,   2,   3, ..., 382, 383, 384], dtype=int32)
    • brain_area_lfp
      (brain_area_lfp)
      <U4
      'ACA' 'LS' 'MOs' ... 'SUB' 'VISp'
      array(['ACA', 'LS', 'MOs', 'CA3', 'DG', 'SUB', 'VISp'], dtype='<U4')
    • spike_id
      (spike_id)
      int32
      1 2 3 4 ... 2446171 2446172 2446173
      array([      1,       2,       3, ..., 2446171, 2446172, 2446173], dtype=int32)
    • contrast_left
      (trial)
      int8
      100 0 100 0 50 0 ... 50 50 0 25 100
      array([100,   0, 100,   0,  50,   0,   0,   0,   0, 100,  50,   0,  50,
             100,  50,   0,   0, 100,   0,   0,   0,   0,   0,   0,  50,   0,
               0,   0,  50,  25,  25,   0, 100,  50,   0,   0,   0,   0,  50,
              25, 100,   0,   0,   0,   0,   0,   0,  50,  25,  50,   0,   0,
               0, 100,  50,  50,   0,   0,   0,  50,  25,   0,   0,   0, 100,
               0,  25,   0,   0,   0, 100,   0, 100,  50,   0, 100, 100,   0,
               0,   0,  25,  25,  25,   0, 100,  50,   0,  50,   0,  50, 100,
              25,  50,  50,   0, 100,   0,  25,  25,  25,  25, 100,   0,   0,
               0,   0,   0,   0,   0,   0,  25,  25,  25,  25,  25,   0,  50,
              50,   0,  50,   0,  50,   0, 100,  25, 100,   0,  25, 100,   0,
               0,   0,   0,   0,   0,  25,   0,  50,   0,   0, 100,  50,   0,
              25,  50,   0,  25,  50,   0,  50, 100,   0, 100,   0,   0, 100,
              50,   0,   0,  25,   0, 100,   0,   0,   0,  50, 100, 100,  25,
              25,  25,  25,  25,  25,  25,  25,  50, 100,   0,  50, 100, 100,
               0,  50,   0,   0,   0,  25,   0,  50, 100,  25,  50, 100,  50,
             100, 100, 100,  25,   0,  25,   0,   0,   0,   0,  25,  25,  25,
              25,  25,  25,  25,  25,  25,   0, 100,  25,  25,   0, 100,  25,
               0,  25,  50,  50,  50, 100,  50, 100,   0,   0,  50,   0,  25,
             100,  50,  25,   0, 100, 100,  25,  50,  50,  50, 100,  25,   0,
             100, 100,  50,   0,  50, 100,  50,  25,   0,  25, 100, 100, 100,
             100,  50, 100,  50,  25,   0,  50,  25,  50,  50,   0, 100,  25,
              25,  50, 100, 100,  25, 100,   0,  25, 100,  25,  25, 100,  50,
              25,  50,   0,  50,   0,  50,   0, 100, 100,  25,  50,  25, 100,
              25,  25,  50,  25,   0,   0,  50,  25,   0,   0, 100,  25,   0,
              50,  50,   0,  50,  25,  25, 100,  25,  25,  50, 100,  25,  50,
             100, 100,  25, 100,  25,  25, 100, 100,  50,  50, 100,  50, 100,
              50, 100,  25,  50,  50,   0,  25,   0,  50,  25,  25, 100,   0,
               0,   0,   0,  50, 100,  25,   0, 100,  50,  50,   0,  25, 100],
            dtype=int8)
    • contrast_right
      (trial)
      int8
      0 50 50 0 100 0 ... 25 25 50 0 100
      array([  0,  50,  50,   0, 100,   0,   0,   0,   0,  50,   0,   0,  25,
               0,   0, 100,   0, 100,   0,   0,   0,   0,   0,   0,   0,   0,
               0,  50,  25, 100, 100,   0,  50,   0,   0,   0,   0,  25, 100,
               0,  25,  50, 100,   0,   0,  50, 100,   0,  25,   0, 100,   0,
               0,  25,  50,  50,  25, 100,  50,  50, 100, 100,   0,  50,   0,
              50,  25,   0, 100,  50,   0,  25,  25, 100, 100,   0, 100,  25,
              50,   0, 100, 100, 100, 100,  25,   0,   0,   0,  50,   0,   0,
              50,   0,   0,  50,   0, 100, 100, 100, 100, 100,   0, 100, 100,
             100,   0, 100, 100, 100,   0,  25, 100, 100, 100, 100,   0,  25,
               0,   0,   0,  25,   0, 100,  50,  50,   0,  50, 100,   0,   0,
              25,   0,  50,  50, 100,  50,   0,  25,   0,  50,  25,  50,  50,
              50, 100,   0,  50,   0,   0,  50,   0,   0,   0,   0,   0, 100,
               0,  50,   0,   0,  50,   0, 100, 100, 100,  25,   0,  25, 100,
             100, 100, 100, 100, 100, 100, 100,  25,   0,  50,   0,   0,   0,
               0,   0,   0,  50,   0, 100,   0,  25,   0,   0,  50,  50, 100,
              50,  25,  25,  50,   0,   0,  50,  25,  50,  50, 100, 100, 100,
             100, 100, 100, 100, 100, 100, 100,  25,   0,  50, 100,  50, 100,
              50,  25, 100,  50,  25, 100,   0,   0,  50, 100,  25, 100,  50,
              50,   0,  25,  25,  25, 100,  50,  50, 100,  25,  50,  50,  25,
              50, 100,  50,  25,  50,  25,  25,  25,  25, 100,   0,   0,  25,
              50, 100,  50,  25,  50, 100, 100,  25,  50,  50,  50,  50,  50,
              25, 100, 100,  50, 100,   0,  50,  25,  25,  25,  50,   0,  25,
              50,  50, 100,   0,  25,  25,  25, 100,   0,  25,   0,  25,  25,
               0, 100,   0,   0, 100,  50,  25,   0,  25,  50,   0,   0, 100,
             100,  50, 100,   0, 100,  50,   0, 100, 100, 100, 100,   0,  50,
              25, 100, 100,   0, 100, 100,  50, 100, 100, 100,   0,   0,  25,
             100,  25,  25,   0,   0,  50,   0,  25,  50,   0,  50,  50,  25,
              50, 100,  50,   0,  25,   0,  25, 100,  25,  25,  50,   0, 100],
            dtype=int8)
    • gocue
      (trial)
      float64
      1.027 0.8744 0.8252 ... nan nan nan
      array([1.02721625, 0.87441381, 0.82521303, 0.76161202, 0.66201043,
             1.18681879, 0.58800925, 0.60640954, 0.5912093 , 1.07121695,
             0.64601017, 1.18161871, 0.96601527, 1.07081695, 1.01921612,
             0.54640858, 0.74681178, 0.98841563, 0.76841212, 1.12161776,
             1.0492166 , 0.7668121 , 1.00961597, 0.9428149 , 0.84121328,
             0.89201409, 0.52760828, 0.82801307, 0.82441302, 0.52800829,
             0.99361571, 0.56200883, 0.94721497, 0.7856124 , 0.87681385,
             0.48680763, 0.53000832, 0.84881341, 0.96001518, 1.11761769,
             0.50400791, 1.05081663, 0.9176145 , 0.76321204, 0.51720812,
             0.51640811, 0.99801578, 0.68161074, 0.55040865, 1.04321651,
             0.92521462, 0.71921134, 0.63881006, 1.06321682, 0.50800797,
             0.97321539, 1.06841691, 1.02721625, 0.57520904, 0.75001183,
             1.02881628, 0.91641448, 0.98441557, 0.98841563, 0.56800893,
             0.93721482, 1.15241825, 0.9300147 , 0.93881484, 0.6416101 ,
             0.78761243, 0.90641432, 0.62680987, 1.18241872, 1.17681864,
             0.54880862, 0.59000928, 0.81361284, 0.87441381, 0.50440791,
             0.65841037, 0.54440855, 1.15521829, 0.58040913, 0.94561495,
             1.06241681, 0.8608136 , 0.58680923, 0.89121408, 1.02761626,
             0.83681321, 0.95721513, 0.58800925, 1.09401732, 0.86161361,
             0.85761355, 1.09841739, 0.53520841, 0.64281012, 0.56920895,
      ...
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan])
    • stim_onset
      (trial)
      float64
      0.5 0.5 0.5 0.5 ... 0.5 0.5 0.5 0.5
      array([0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
             0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5])
    • feedback_type
      (trial)
      float64
      1.0 1.0 1.0 1.0 ... nan nan nan nan
      array([ 1.,  1.,  1.,  1., -1., -1., -1., -1.,  1.,  1.,  1.,  1.,  1.,
              1.,  1.,  1.,  1., -1., -1., -1.,  1., -1., -1.,  1.,  1., -1.,
              1.,  1.,  1.,  1.,  1.,  1., -1.,  1., -1.,  1.,  1.,  1.,  1.,
              1.,  1.,  1.,  1., -1.,  1.,  1.,  1.,  1.,  1.,  1.,  1., -1.,
              1.,  1.,  1.,  1.,  1.,  1.,  1., -1.,  1.,  1.,  1.,  1.,  1.,
              1., -1.,  1.,  1., -1.,  1.,  1.,  1.,  1.,  1.,  1., -1.,  1.,
              1.,  1., -1., -1.,  1.,  1.,  1., -1.,  1.,  1.,  1.,  1.,  1.,
             -1.,  1., -1.,  1.,  1.,  1., -1., -1., -1.,  1.,  1.,  1., -1.,
              1.,  1.,  1., -1.,  1.,  1., -1., -1., -1., -1.,  1.,  1.,  1.,
              1.,  1.,  1., -1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
              1.,  1.,  1.,  1.,  1., -1.,  1.,  1.,  1.,  1.,  1., -1.,  1.,
             -1.,  1.,  1., -1.,  1.,  1.,  1.,  1.,  1.,  1., -1.,  1., -1.,
              1.,  1.,  1., -1., -1.,  1., -1., -1.,  1.,  1.,  1.,  1., -1.,
             -1., -1., -1., -1., -1., -1.,  1.,  1.,  1., -1., -1., -1.,  1.,
              1., -1.,  1.,  1.,  1.,  1.,  1.,  1.,  1., -1., -1.,  1., -1.,
             -1., -1.,  1., -1.,  1.,  1., -1., -1., -1., -1., -1., -1., -1.,
             -1., -1., -1., -1., -1., -1., nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan])
    • feedback_time
      (trial)
      float64
      1.187 1.438 0.986 ... nan nan nan
      array([1.18681879, 1.43762279, 0.98601559, 2.29643649, 0.82761307,
             1.54682453, 1.14201808, 1.35682151, 2.13763395, 1.28682039,
             0.886014  , 2.7176432 , 1.15401827, 1.37002172, 1.20161903,
             0.67001055, 2.28243626, 2.27283611, 1.04201649, 1.50322384,
             2.5856411 , 1.12401779, 1.89643011, 2.48123943, 1.20321906,
             1.20321906, 2.06403278, 1.32002092, 1.03761642, 0.68681082,
             1.50282383, 2.10043336, 1.27722024, 1.00601591, 1.32362098,
             2.02523216, 2.07683298, 1.25321985, 1.1872188 , 1.2376196 ,
             0.62200979, 1.52082412, 1.12041774, 1.62202573, 2.05603265,
             0.6728106 , 1.35362145, 0.88721402, 0.72121137, 1.25401987,
             2.00443183, 1.13201792, 2.17923462, 1.27082013, 0.67041056,
             1.17001853, 1.70362703, 1.58562515, 0.72121137, 1.30762072,
             1.23921963, 1.18601878, 2.51964004, 1.48642357, 0.73721163,
             1.5700249 , 1.98723156, 2.46963925, 1.40442226, 2.1532342 ,
             0.93801483, 1.06961693, 0.78801244, 1.41962251, 1.35442147,
             0.70361109, 0.82081296, 1.05361667, 0.9864156 , 2.0464325 ,
             2.16243435, 0.95961517, 2.35283739, 0.73841165, 1.25321985,
             2.56924084, 2.39843811, 0.68681082, 1.3692217 , 1.20361906,
             1.06921692, 1.12881787, 1.01841611, 2.60124135, 1.3692217 ,
             1.05321666, 1.65282622, 2.0400324 , 1.04041646, 2.08763316,
      ...
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan])
    • response_type
      (trial)
      float64
      1.0 -1.0 1.0 0.0 ... nan nan nan
      array([ 1., -1.,  1.,  0.,  1.,  1., -1., -1.,  0.,  1.,  1.,  0.,  1.,
              1.,  1., -1.,  0., -1., -1., -1.,  0.,  1.,  1.,  0.,  1.,  1.,
              0., -1.,  1., -1., -1.,  0., -1.,  1., -1.,  0.,  0., -1., -1.,
              1.,  1., -1., -1., -1.,  0., -1., -1.,  1., -1.,  1., -1., -1.,
              0.,  1.,  1., -1., -1., -1., -1., -1., -1., -1.,  0., -1.,  1.,
             -1., -1.,  0., -1.,  0.,  1., -1.,  1., -1., -1.,  1., -1., -1.,
             -1.,  0.,  0.,  1., -1., -1.,  1.,  0.,  0.,  1., -1.,  1.,  1.,
              1.,  1.,  0., -1.,  1., -1.,  0.,  1.,  0., -1.,  1., -1.,  0.,
             -1.,  0., -1.,  0., -1.,  0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,
              1.,  0.,  1.,  0.,  1., -1.,  1., -1.,  1., -1., -1.,  1.,  0.,
             -1.,  0., -1., -1., -1.,  0.,  0.,  1.,  0., -1.,  1., -1., -1.,
              1., -1.,  0.,  0.,  1.,  0.,  1.,  1.,  0.,  1., -1.,  0., -1.,
              1., -1.,  0.,  0.,  0.,  1.,  1.,  0., -1.,  1.,  1.,  1.,  0.,
              0.,  0.,  0.,  1.,  0.,  0., -1.,  1.,  1.,  1.,  0.,  0.,  1.,
              0.,  0.,  0., -1.,  0., -1.,  0.,  1.,  1.,  0.,  0.,  1.,  0.,
              0.,  0.,  1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  1.,  1.,  0.,
              1.,  1.,  1.,  0.,  0.,  1., nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan])
    • response_time
      (trial)
      float64
      1.15 1.4 0.9493 ... nan nan nan
      array([1.15020363, 1.39950287, 0.94929105, 2.26680167, 0.81677584,
             1.51710695, 1.13321043, 1.34983104, 2.09712508, 1.24966756,
             0.85012552, 2.68711772, 1.11656384, 1.33318552, 1.16616737,
             0.63355482, 2.25236982, 2.26686564, 1.0334353 , 1.50068597,
             2.55500321, 1.11652772, 1.88402217, 2.45124877, 1.16664193,
             1.20006031, 2.03322566, 1.28394722, 1.00076718, 0.65046396,
             1.46640514, 2.06899863, 1.26769545, 0.96801046, 1.31672231,
             1.9945947 , 2.04642421, 1.21717001, 1.15041613, 1.20058137,
             0.58430745, 1.48373157, 1.08377657, 1.61696393, 2.0249377 ,
             0.63468075, 1.31750766, 0.85095507, 0.68352361, 1.21828197,
             1.97045611, 1.11797797, 2.1441927 , 1.23396189, 0.63466365,
             1.1342873 , 1.66770751, 1.55014191, 0.68371489, 1.30129107,
             1.20153896, 1.15070234, 2.48842292, 1.45103799, 0.70175933,
             1.53410517, 1.98478822, 2.43346185, 1.36750195, 2.14922358,
             0.90154979, 1.03394011, 0.75082235, 1.38440318, 1.31853061,
             0.66763416, 0.81730739, 1.01777675, 0.95186767, 2.01481996,
             2.16295917, 0.951785  , 2.31831362, 0.70186012, 1.21846907,
             2.56933478, 2.36544238, 0.65215477, 1.33471536, 1.16827375,
             1.03429643, 1.1177492 , 0.98402039, 2.60262985, 1.33511192,
             1.01833607, 1.61876251, 2.03657985, 1.03549279, 2.08261646,
      ...
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan,        nan,
                    nan,        nan,        nan,        nan])
    • reaction_type
      (trial)
      float64
      1.0 -1.0 1.0 1.0 ... nan nan nan
      array([ 1., -1.,  1.,  1.,  1.,  1.,  1., -1.,  1.,  1.,  1., -1.,  1.,
              1.,  1., -1., -1., -1., -1., -1., -1.,  1.,  1.,  0.,  1.,  1.,
             -1., -1.,  1.,  1., -1.,  0.,  1.,  1., -1.,  0.,  0., -1., -1.,
              1.,  1., -1., -1.,  1.,  0., -1., -1.,  1.,  1.,  1., -1.,  1.,
              0.,  1.,  1.,  1., -1., -1., -1.,  1., -1., -1.,  0., -1.,  1.,
             -1.,  1.,  0., -1.,  0.,  1., -1.,  1.,  1., -1.,  1.,  1., -1.,
             -1.,  0.,  0.,  1.,  0., -1.,  1.,  1.,  0.,  1., -1.,  1.,  1.,
              1.,  1.,  1., -1.,  1.,  1.,  0.,  1.,  0., -1.,  1.,  1.,  0.,
             -1.,  0., -1.,  1., -1.,  0.,  1.,  0.,  0.,  0., -1.,  1.,  1.,
              1., -1.,  1.,  0.,  1., -1.,  1.,  1.,  1., -1., -1.,  1.,  1.,
             -1., -1.,  1., -1., -1.,  0.,  0.,  1.,  0., -1.,  1., -1., -1.,
              1., -1., -1.,  0.,  1.,  0.,  1.,  1.,  1.,  1., -1.,  0.,  1.,
              1., -1.,  1.,  0.,  0.,  1.,  1.,  0.,  1.,  1.,  1.,  1.,  0.,
              0.,  0.,  0.,  1.,  0.,  0., -1.,  1.,  1.,  1.,  0.,  1.,  1.,
              0.,  0.,  0.,  0.,  0., -1.,  0.,  1.,  1.,  0.,  0.,  0.,  0.,
              0.,  0.,  1.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  1.,  1.,  0.,
              1.,  1.,  1.,  0.,  0.,  1., nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
             nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan])
    • reaction_time
      (trial)
      float64
      170.0 230.0 200.0 ... nan nan nan
      array([ 170.,  230.,  200.,  860.,  140., 1340.,  740.,  990., 1180.,
              200.,  290., 1410.,  160.,  140.,  220.,  170.,  340.,  190.,
              920., 1360., 1590., 1000., 1740.,   inf,  180.,  450.,  910.,
              120.,  190.,  120.,  200.,   inf,  330.,  210.,  250.,   inf,
               inf,  490.,  150.,  190.,  160.,   90.,  200.,  180.,   inf,
              190.,  150.,  170.,  200.,  170.,  150.,  490.,   inf,  180.,
              140.,  210.,  170.,  170.,  200.,  210.,  190.,  170.,   inf,
              140.,  170.,  220.,  250.,   inf,  320.,   inf,  210.,  160.,
              170.,    0.,  170.,  130.,  230.,  140.,  810.,   inf,   inf,
              810.,   inf,  220.,  290.,  220.,   inf,  210.,  160.,  180.,
              180., 1010.,  200.,  230.,  200.,  200.,   60.,   inf,  860.,
               inf, 1330.,  150.,   70.,   inf,  180.,   inf,  250.,  460.,
             1560.,   inf,  400.,   inf,   inf,   inf,  390.,  990.,  180.,
              190., 1310.,  190.,   inf,  210.,  230.,  220.,  230.,  220.,
             1310.,  290.,  240.,  550.,  450.,  810., 1040.,  150.,  200.,
               inf,   inf,  170.,   inf, 1700.,  220., 1030., 1030., 1350.,
             1100., 1750.,   inf,  800.,   inf,  700.,  210.,  890.,  220.,
             1210.,   inf,  330.,  890., 1010.,  160.,   inf,   inf,  160.,
             1220.,   inf, 1080.,  200.,  180.,  200.,   inf,   inf,   inf,
               inf, 1070.,   inf,   inf, 1490., 1010., 1060.,  590.,   inf,
      ...
             1200.,  190.,   inf,   inf,   inf,   inf,   inf,   inf,  360.,
               inf,   inf, 1370.,   inf,   inf,   inf,   inf, 1680., 1650.,
               inf, 1310., 1300., 1050.,   inf,   inf, 1350.,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,   nan,
               nan,   nan,   nan,   nan])
    • prev_reward
      (trial)
      float64
      -10.0 -4.733 -3.4 ... nan nan nan
      array([-10.        ,  -4.73309097,  -3.40017445,  -4.18359159,
              -3.24888707,  -2.98288554,  -3.76657809,  -2.38324644,
              -4.61586487,  -3.35336262,  -3.61601082,  -6.83359779,
              -3.2789782 ,  -2.38349276,  -2.28327294,  -4.93273066,
              -8.91579823,  -6.33096783,  -4.18283799,  -2.49902181,
              -2.51657888,  -6.4779416 ,  -2.41552939,  -2.58324985,
              -3.86525274,  -3.13302742,  -2.54880025,  -2.31684449,
              -2.79891867,  -5.66613991,  -8.29927953,  -3.25007085,
              -5.39632119,  -2.64876779,  -4.81568255,  -2.54894012,
             -10.12239929,  -2.46964859,  -3.36610386,  -3.33245614,
             -10.24840196,  -3.44935766,  -3.14874309,  -3.16669199,
              -4.09832799,  -2.44153431,  -3.69858914,  -6.99862573,
              -3.31631217,  -3.59854546,  -5.74902991,  -3.3616297 ,
              -3.08168979,  -6.30634283,  -3.13170851,  -4.46501846,
              -2.96537886,  -2.9995677 ,  -3.16633409,  -4.48196827,
              -2.96477774,  -3.01572907,  -3.18176753,  -2.27805387,
              -3.29863853,  -3.06470152,  -3.26557216,  -2.39808245,
              -2.56701867,  -4.01578467,  -2.29964815,  -3.89892755,
              -2.86572286,  -3.39884461,  -3.13126961,  -2.61553291,
              -2.96562457,  -3.84876781,  -2.48147984,  -2.74859213,
      ...
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan,
                      nan,          nan,          nan,          nan])
    • active_trials
      (trial)
      bool
      True True True ... False False
      array([ True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
      ...
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True,  True,  True,
              True,  True,  True,  True,  True,  True,  True, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False, False, False, False, False, False,
             False, False, False, False])
    • wheel
      (trial, time)
      int8
      -1 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0
      array([[-1,  0,  0, ...,  1,  0,  1],
             [ 0, -1,  0, ...,  1,  0,  0],
             [ 0,  0, -1, ..., -1,  0,  0],
             ...,
             [ 0,  0,  0, ...,  0,  0,  0],
             [ 0,  0,  0, ...,  0,  0,  0],
             [ 0,  0,  0, ...,  0,  0,  0]], dtype=int8)
    • licks
      (trial, time)
      int8
      0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0
      array([[0, 0, 0, ..., 0, 0, 0],
             [0, 0, 0, ..., 0, 0, 1],
             [0, 0, 0, ..., 0, 0, 0],
             ...,
             [0, 0, 0, ..., 0, 0, 0],
             [0, 0, 0, ..., 0, 0, 0],
             [0, 0, 0, ..., 0, 0, 0]], dtype=int8)
    • pupil_x
      (trial, time)
      float64
      0.8129 0.7782 ... -0.486 -0.4916
      array([[ 0.81285601,  0.77816193,  0.81235208, ...,  0.7957129 ,
               0.85481015,  0.9076376 ],
             [ 0.94817386,  0.95962932,  0.95623047, ...,  0.38599669,
               0.34658371,  0.30899389],
             [ 0.3880897 ,  0.3856168 ,  0.32983245, ...,  0.52308137,
               0.67938778,  0.79211687],
             ...,
             [ 0.21872131,  0.14844803,  0.14106962, ...,  0.03984695,
               0.1192567 ,  0.03193037],
             [-0.23057746, -0.1832362 , -0.3408799 , ..., -0.30211522,
              -0.26709205, -0.30083151],
             [-0.39643424, -0.45370558, -0.45053439, ..., -0.45360652,
              -0.48602562, -0.49164412]])
    • pupil_y
      (trial, time)
      float64
      0.6642 0.6128 ... 0.2392 0.27
      array([[ 0.66424745,  0.6127516 ,  0.63276851, ...,  0.37188813,
               0.23835723,  0.23160477],
             [ 1.23273747,  1.1461164 ,  1.07586317, ..., -0.90672734,
              -0.76225968, -0.7643367 ],
             [-0.54593809, -0.54971865, -0.53757296, ..., -0.25438543,
              -0.10055672,  0.02068106],
             ...,
             [ 1.07398729,  1.21567852,  1.14906106, ...,  1.07504472,
               1.12505063,  1.14535118],
             [ 0.23600561,  0.19862846,  0.19627369, ...,  0.12601246,
               0.06920929,  0.06199038],
             [-0.11972398, -0.14335603, -0.12658565, ...,  0.13045109,
               0.23918371,  0.27000163]])
    • pupil_area
      (trial, time)
      float64
      0.1658 0.1587 ... 0.1099 0.1199
      array([[0.16584056, 0.15866767, 0.16966705, ..., 0.16423223, 0.17261705,
              0.17060842],
             [0.17180513, 0.16491603, 0.15992441, ..., 0.21022576, 0.20026623,
              0.19983341],
             [0.15330889, 0.14533824, 0.14872697, ..., 0.12516653, 0.14728813,
              0.13150498],
             ...,
             [0.04059704, 0.05748408, 0.05283589, ..., 0.09169307, 0.08196067,
              0.09649467],
             [0.0453804 , 0.04017045, 0.06644672, ..., 0.1050599 , 0.10896764,
              0.09869005],
             [0.07131883, 0.0601189 , 0.06215936, ..., 0.11383507, 0.10993529,
              0.11992919]])
    • face
      (trial, time)
      float64
      1.146 1.146 1.146 ... 0.1302 0.1302
      array([[1.14573477, 1.14573477, 1.14573477, ..., 1.91909053, 2.02131222,
              2.02131222],
             [2.01705299, 2.01705299, 2.01705299, ..., 1.87284739, 1.26742726,
              1.26742726],
             [1.46396063, 1.46396063, 1.12626397, ..., 1.90692128, 1.90692128,
              1.90692128],
             ...,
             [0.1734118 , 0.09735399, 0.09735399, ..., 1.51811379, 1.51811379,
              1.34713584],
             [0.85793204, 0.85793204, 0.87375206, ..., 0.68512871, 0.68512871,
              0.48311918],
             [0.29267043, 0.29267043, 0.29267043, ..., 0.16185101, 0.13021096,
              0.13021096]])
    • spike_rate
      (cell, trial, time)
      int8
      0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0
      array([[[0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              ...,
              [0, 1, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0]],
             [[0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              ...,
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0]],
             [[0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              ...,
      ...
              ...,
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 1, 0, ..., 0, 0, 0]],
             [[0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              ...,
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0]],
             [[0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              ...,
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0],
              [0, 0, 0, ..., 0, 0, 0]]], dtype=int8)
    • trough_to_peak
      (cell)
      int8
      19 19 10 17 27 20 ... 26 16 8 20 10
      array([19, 19, 10, 17, 27, 20,  8, 12, 17,  9, 14, 12, 14, 16, 15, 11, 19,
             12, 19, 28, 30, 11, 11, 18, 14, 14, 21,  6, 17, 21, 22, 25, 21, 20,
             17, 14, 19, 24, 21, 22, 19, 16, 17, 22, 16, 16,  9, 19, 19, 27, 22,
              6, 15, 21, 12, 24, 20, 33, 24, 14, 22, 23, 18, 14, 12, 15, 17, 11,
             16, 19, 15, 22, 13, 22, 20, 14, 17, 19, 15, 22, 23, 10, 17, 12, 25,
             17, 28, 14, 11, 11, 19, 20, 26, 23, 16, 14,  9, 17, 18, 20,  7, 19,
             28, 24, 15, 21, 17, 19,  9, 20, 24, 18, 14, 27, 17, 18, 30, 26, 13,
             10, 34, 20, 15, 20,  6, 13, 21,  8,  9,  9, 20, 21, 22, 18, 16, 14,
             19, 26, 22, 18, 14, 15, 18, 23,  8, 14, 14, 17, 22, 22, 16,  6, 15,
             19, 12, 17, 21, 30, 20, 16, 11, 18, 15,  7, 19, 10, 20, 21, 20,  8,
             25, 20, 20, 20,  4, 20, 25, 18, 10, 16, 19, 19, 19, 17, 19, 18, 16,
             18, 26, 12, 23, 18, 19, 26, 12, 12, 16, 14, 17, 20, 22, 19, 17, 17,
             18, 28, 23,  9, 18, 15, 22,  5, 13, 15, 33, 20, 13, 10,  8, 17, 16,
             13, 20, 19, 20, 11, 19, 19, 18, 19, 11, 20, 23, 15, 13, 17, 11,  6,
             13, 31, 18, 18, 15, 20, 19, 28, 16, 17, 23, 12, 17, 19, 17, 18,  9,
             29, 23,  8, 15, 30, 13, 28, 17, 15, 24, 16, 15,  9, 18, 22, 20, 20,
             11, 11, 21, 19, 20, 12,  8, 19, 32, 16, 14, 19, 17, 14, 17, 15, 18,
             21, 13, 22, 14, 13, 16, 12, 15, 20, 19, 16, 20, 16, 17, 27, 15, 19,
             14, 15, 20, 16, 14, 14, 27, 13, 12, 15, 11, 10, 23, 13, 20, 19, 15,
             15, 16, 13,  7, 16, 15, 18, 27, 25, 18, 17, 16, 23, 16, 15, 15, 13,
      ...
             21, 21, 11, 18, 18,  8, 25, 19, 15, 17, 17, 31,  7, 23,  9, 21, 17,
             20, 17, 14, 13, 19, 19,  9, 14, 11, 17, 10, 21,  8, 19, 10, 13, 29,
             14, 19, 13, 23, 18, 19, 11, 20, 17, 20, 12, 21,  7,  9, 10,  7, 20,
             17, 21, 19, 11, 19, 18, 20, 16, 15, 13, 15, 16, 21,  7, 19, 15,  9,
             16, 18, 19, 15, 19, 23, 11, 19, 13, 12, 19, 18, 21, 18,  7, 21,  8,
             17, 15, 21, 14, 16, 21, 19, 13, 20, 10, 18, 18, 14,  9, 19, 10, 17,
             22, 31, 12, 23, 19, 10, 15, 19, 18,  5, 22, 18, 19, 16, 21, 20, 21,
             15, 20, 19,  7,  7, 13, 17, 18, 21, 23, 18,  8, 16, 10, 12, 18, 13,
             21,  6, 12,  7, 15, 23, 20, 19, 16, 14, 18, 19, 16, 15, 20, 17,  9,
             20, 10, 27, 21, 18,  9, 22, 19, 16, 17, 20,  6, 10, 19, 20,  8, 20,
             20, 17, 15, 10, 16, 10, 21, 16, 21, 23, 19, 10, 17, 14,  9,  9, 10,
              5, 11, 12, 17, 18, 22,  5, 18, 10, 21, 14, 21, 17, 20, 32,  7, 19,
             27, 27, 11, 20, 27,  5, 21,  7, 24, 20, 16, 11, 20, 17,  9, 18, 20,
              7, 23, 18, 10, 22, 18,  8, 19, 20,  8, 16, 12, 23, 22, 21, 19, 10,
             11, 18, 19, 21, 27, 16, 17,  9,  6, 15, 16, 13,  7, 19, 15, 23, 20,
             20, 14, 19, 19, 13,  7, 19,  7, 14,  8, 20, 11, 16, 13, 16, 14, 20,
             12, 26, 12,  7, 15, 25, 20, 30, 14, 19, 18, 16, 12, 12, 18, 24, 19,
             20, 21, 22, 18, 12, 17, 18, 22, 18, 16, 17, 19, 19, 10,  6, 16, 11,
             10, 22, 15, 29, 11, 12, 11, 15,  8, 10, 29, 21, 17, 13, 18, 26, 16,
              8, 20, 10], dtype=int8)
    • ccf_ap
      (cell)
      float64
      4.09e+03 3.952e+03 ... 8.914e+03
      array([4090. , 3952.4, 4172.1, 4391.7, 4006.9, 4069.2, 4211.6, 4009.8,
             3986. , 4339.3, 4431.3, 4374.9, 4003.9, 4306.6, 4398.7, 4333.4,
             4092.9, 4021.7, 4042.5, 4012.8, 4036.6, 4432.3, 3995. , 3983.1,
             4112.7, 4012.8, 3932.6, 4028.6, 4268.1, 4006.9, 3959.4, 4117.7,
             3953.5, 3958.4, 4010.8, 4361. , 4110.7, 4428.4, 3944.5, 4122.6,
             4348.2, 4303.7, 4063.2, 4135.5, 4297.8, 4274. , 4098.8, 4116.6,
             4300.7, 3959.4, 3951.4, 4076.1, 4012.8, 3932.6, 4297.8, 4000.9,
             4011.8, 4135.5, 4141.4, 4308.6, 3957.4, 4084. , 4288.8, 4339.3,
             3951.4, 3935.6, 4342.2, 4300.7, 4348.2, 4095.9, 4006.9, 3957.4,
             4306.6, 4076.1, 4054.4, 4385.8, 4327.4, 4111.7, 4284.9, 3916.8,
             4082. , 4344.2, 4084. , 4374.9, 3989.1, 3935.6, 4000.9, 4404.6,
             3974.2, 4342.2, 4083. , 4090. , 4095.9, 3956.4, 4279.9, 4092.9,
             4036.6, 4314.6, 4092.9, 4308.6, 3933.6, 4017.7, 3976.2, 4136.5,
             4339.3, 4082. , 4099.8, 4030.6, 4206.7, 3941.6, 3945.5, 4006.9,
             4291.8, 4030.6, 4321.5, 4107.8, 4084. , 4095.9, 4300.7, 4303.7,
             4066.2, 3917.8, 4333.4, 3933.6, 4131.5, 4106.8, 4042.5, 4027.6,
             4063.2, 4131.5, 4023.7, 4082. , 4030.6, 4386.8, 4397.7, 4345.2,
             4003.9, 3938.6, 3947.5, 4134.5, 4318.5, 4350.2, 4282.9, 3995. ,
             3932.6, 3993. , 4339.3, 4312.5, 4054.4, 3916.8, 4432.3, 4084. ,
             4357.1, 4312.5, 4291.8, 4279.9, 3917.8, 4036.6, 4054.4, 4024.7,
      ...
             9241.5, 9482.8, 9238.2, 9201.3, 8940.5, 9342.5, 9274.1, 9545.7,
             9543.6, 9438.1, 9421.9, 9465.4, 9378.5, 8951.3, 9496.9, 8839.4,
             8804.7, 9100.3, 8815.4, 8909. , 8820.8, 8818.7, 9241.5, 9232.8,
             9568.5, 9296.9, 9220.8, 8813.3, 9577.2, 9397.9, 9394.7, 9262.1,
             9540.4, 9210. , 9366.5, 9369.8, 8804.7, 9523. , 8792.7, 8864.3,
             9352.4, 9284.9, 9456.7, 9430.6, 9230.7, 9227.4, 9543.6, 8822. ,
             8803.5, 9470.8, 8824.1, 9204.6, 9516.4, 9458.8, 9413.2, 9456.7,
             8975.2, 9404.5, 9201.3, 9065.5, 9528.4, 9404.5, 8977.3, 9526.3,
             8822. , 9421.9, 9371.9, 8820.8, 9201.3, 8971.9, 8820.8, 9230.7,
             9236.1, 9392.6, 9397.9, 9472.9, 9455.5, 8891.6, 9284.9, 9230.7,
             9458.8, 8820.8, 8925.2, 9255.5, 9246.9, 9255.5, 9499. , 9264.2,
             9218.7, 9239.4, 9250.2, 9299. , 8891.6, 9446.8, 9470.8, 9220.8,
             9003.4, 9533.8, 8848.1, 9542.5, 8907.8, 8919.8, 8827.4, 8812.2,
             8794.8, 9403.3, 8829.5, 9256.7, 8829.5, 9491.5, 8899.1, 9545.7,
             9519.7, 9401.2, 8822. , 9274.1, 8804.7, 9427.3, 9458.8, 8813.3,
             9392.6, 9490.3, 9413.2, 9505.6, 9533.8, 8838.2, 9351.2, 9455.5,
             8796. , 9516.4, 9551.1, 9246.9, 8778.6, 8864.3, 8804.7, 8971.9,
             9386. , 8813.3, 8813.3, 8818.7, 9403.3, 9357.8, 8804.7, 8829.5,
             9490.3, 9406.6, 8818.7, 8824.1, 8801.4, 9383.9, 8876.3, 8827.4,
             8893.7, 9222. , 8881.7, 8940.5, 9537.1, 8914.4])
    • ccf_dv
      (cell)
      float64
      2.445e+03 1.516e+03 ... 4.094e+03
      array([2445.4, 1516. , 2979.3, 4442.7, 1891.7, 2267.4, 3216.6, 1871.9,
             1713.7, 4106.5, 4680. , 4343.8, 1832.4, 3849.4, 4502. , 4066.9,
             2425.6, 1951. , 2129. , 1931.2, 2089.4, 4699.7, 1812.6, 1733.5,
             2583.8, 1931.2, 1357.8, 2010.3, 3631.9, 1891.7, 1575.3, 2603.6,
             1535.7, 1555.5, 1891.7, 4225.1, 2544.3, 4699.7, 1436.9, 2623.4,
             4126.3, 3869.2, 2227.9, 2722.2, 3829.6, 3671.4, 2465.2, 2583.8,
             3809.9, 1575.3, 1496.2, 2326.7, 1931.2, 1357.8, 3829.6, 1852.1,
             1911.5, 2722.2, 2761.8, 3889. , 1535.7, 2405.8, 3730.8, 4106.5,
             1496.2, 1417.1, 4086.7, 3809.9, 4126.3, 2484.9, 1891.7, 1535.7,
             3849.4, 2326.7, 2208.1, 4403.1, 4027.4, 2564. , 3730.8, 1278.7,
             2366.3, 4126.3, 2405.8, 4343.8, 1773. , 1417.1, 1852.1, 4541.5,
             1634.6, 4086.7, 2386.1, 2445.4, 2484.9, 1516. , 3711. , 2425.6,
             2089.4, 3928.5, 2425.6, 3889. , 1377.5, 1951. , 1674.2, 2742. ,
             4106.5, 2366.3, 2484.9, 2049.9, 3196.8, 1456.6, 1456.6, 1891.7,
             3790.1, 2049.9, 3987.8, 2564. , 2405.8, 2484.9, 3809.9, 3869.2,
             2287.2, 1298.4, 4066.9, 1377.5, 2722.2, 2544.3, 2129. , 1990.6,
             2227.9, 2722.2, 1990.6, 2366.3, 2049.9, 4422.9, 4482.2, 4146. ,
             1832.4, 1397.3, 1496.2, 2702.5, 3928.5, 4165.8, 3691.2, 1812.6,
             1357.8, 1773. , 4106.5, 3889. , 2208.1, 1278.7, 4699.7, 2405.8,
             4225.1, 3889. , 3790.1, 3711. , 1298.4, 2089.4, 2208.1, 2010.3,
      ...
             2689.5, 1535.5, 2747.2, 2824.2, 3978.2, 2285.6, 2458.7, 1343.1,
             1266.2, 1862.4, 1804.7, 1612.4, 1997.1, 4016.7, 1516.2, 4382.2,
             4536. , 3228.1, 4574.5, 4074.4, 4593.7, 4516.8, 2689.5, 2728. ,
             1285.4, 2401. , 2824.2, 4497.6, 1246.9, 1997.1, 2054.8, 2554.9,
             1323.9, 2785.7, 2093.3, 2035.6, 4536. , 1400.8, 4632.2, 4401.4,
             2112.5, 2497.2, 1650.9, 1766.3, 2651.1, 2708.8, 1266.2, 4459.1,
             4670.7, 1631.6, 4536. , 2766.5, 1516.2, 1727.8, 1843.2, 1650.9,
             3824.4, 1881.7, 2824.2, 3382. , 1420. , 1881.7, 3901.3, 1343.1,
             4459.1, 1804.7, 2112.5, 4593.7, 2824.2, 3882.1, 4593.7, 2651.1,
             2670.3, 1977.8, 1997.1, 1708.6, 1785.5, 4151.3, 2497.2, 2651.1,
             1727.8, 4593.7, 4132.1, 2670.3, 2708.8, 2670.3, 1593.2, 2631.8,
             2747.2, 2612.6, 2651.1, 2477.9, 4151.3, 1824. , 1631.6, 2824.2,
             3785.9, 1439.3, 4343.7, 1400.8, 4209. , 4112.9, 4478.3, 4632.2,
             4709.1, 2016.3, 4555.3, 2535.6, 4555.3, 1497. , 4247.5, 1343.1,
             1458.5, 1939.4, 4459.1, 2458.7, 4536. , 1824. , 1727.8, 4497.6,
             1977.8, 1631.6, 1843.2, 1477.8, 1439.3, 4516.8, 2247.1, 1785.5,
             4574.5, 1516.2, 1362.3, 2708.8, 4651.4, 4401.4, 4536. , 3882.1,
             2093.3, 4497.6, 4497.6, 4516.8, 2016.3, 2131.7, 4536. , 4555.3,
             1631.6, 1958.6, 4516.8, 4536. , 4593.7, 2016.3, 4305.2, 4478.3,
             4228.3, 2689.5, 4324.5, 3978.2, 1381.6, 4093.6])
    • ccf_lr
      (cell)
      float64
      5.012e+03 5.046e+03 ... 3.021e+03
      array([5012.4, 5045.5, 5018.3, 4991.2, 5022.6, 5063.3, 5045.7, 5070.6,
             5073.6, 4981.6, 5018.6, 4977.2, 5071.4, 5034. , 4974.2, 4982.3,
             5060.4, 5069.2, 5018.2, 5021.9, 5019. , 5002.3, 5024.1, 5025.6,
             5025.7, 5021.9, 5080.2, 5052.2, 4990.4, 5022.6, 5028.5, 5041.2,
             5029.2, 5044.7, 5054.4, 5011.1, 5058.2, 4970.6, 5078.7, 5056.7,
             5028.8, 4986. , 5064. , 5039. , 4986.7, 4989.6, 5059.6, 5057.4,
             5034.7, 5028.5, 5061.7, 5046.3, 5021.9, 5080.2, 4986.7, 5023.4,
             5038.1, 5039. , 5038.2, 5001.5, 5061. , 5013.1, 5036.2, 4981.6,
             5061.7, 5031.4, 5029.6, 5034.7, 5028.8, 5011.6, 5022.6, 5061. ,
             5034. , 5046.3, 5016.8, 4991.9, 4983. , 5041.9, 5004.4, 5049.9,
             5045.6, 4997.1, 5013.1, 4977.2, 5024.8, 5031.4, 5023.4, 4973.5,
             5075. , 5029.6, 5029.3, 5012.4, 5011.6, 5077.2, 4988.9, 5060.4,
             5019. , 5000.7, 5060.4, 5001.5, 5063.9, 5037.4, 5042.5, 5022.7,
             4981.6, 5045.6, 5043.4, 5019.7, 5030.2, 5030.7, 5062.4, 5022.6,
             4987.4, 5019.7, 4983.8, 5010.2, 5013.1, 5011.6, 5034.7, 4986. ,
             5015.3, 5033.6, 4982.3, 5063.9, 5007.2, 5026.4, 5018.2, 5068.4,
             5064. , 5007.2, 5036.7, 5045.6, 5019.7, 4975.7, 4990.5, 4980.8,
             5071.4, 5079.4, 5029.9, 5055.2, 5032.5, 4996.3, 5036.9, 5024.1,
             5080.2, 5056.6, 4981.6, 5033.2, 5016.8, 5049.9, 5002.3, 5013.1,
             4979.4, 5033.2, 4987.4, 4988.9, 5033.6, 5019. , 5016.8, 5020.4,
      ...
             2790. , 2564.4, 2812.7, 2800.7, 3000.9, 2732.6, 2724.6, 2556.4,
             2517.6, 2659.2, 2611.1, 2577.7, 2644.5, 3033. , 2573.7, 3058.3,
             3085. , 2858.1, 3117.1, 3004.9, 3133.1, 3094.4, 2790. , 2796.7,
             2559.1, 2727.2, 2826. , 3078.3, 2552.4, 2669.9, 2692.6, 2753.9,
             2540.4, 2794. , 2673.8, 2651.1, 3085. , 2553.7, 3114.4, 3099.7,
             2664.5, 2756.6, 2584.4, 2604.4, 2757.9, 2780.6, 2517.6, 3071.6,
             3146.4, 2593.8, 3110.4, 2778. , 2599.1, 2623.1, 2617.8, 2584.4,
             2974.2, 2624.4, 2800.7, 2884.8, 2569.7, 2624.4, 3012.9, 2531. ,
             3071.6, 2611.1, 2689.9, 3133.1, 2800.7, 2996.9, 3133.1, 2757.9,
             2774. , 2653.8, 2669.9, 2632.5, 2645.8, 3018.3, 2756.6, 2757.9,
             2623.1, 3133.1, 3053. , 2799.3, 2806. , 2799.3, 2612.5, 2792.7,
             2787.3, 2751.3, 2783.3, 2766. , 3018.3, 2652.5, 2593.8, 2826. ,
             2992.9, 2585.8, 3051.6, 2579.1, 3066.3, 3037. , 3087.7, 3139.8,
             3153.1, 2685.9, 3126.4, 2737.9, 3126.4, 2557.7, 3073. , 2556.4,
             2576.4, 2647.1, 3071.6, 2724.6, 3085. , 2627.1, 2623.1, 3078.3,
             2653.8, 2619.1, 2617.8, 2567.1, 2585.8, 3119.7, 2725.9, 2645.8,
             3091.7, 2599.1, 2572.4, 2806. , 3105. , 3099.7, 3085. , 2996.9,
             2699.2, 3078.3, 3078.3, 3094.4, 2685.9, 2680.5, 3085. , 3126.4,
             2619.1, 2663.2, 3094.4, 3110.4, 3107.7, 2660.5, 3070.3, 3087.7,
             3057. , 2764.6, 3086.4, 3000.9, 2563.1, 3020.9])
    • brain_area
      (cell)
      <U4
      'ACA' 'MOs' 'ACA' ... 'VISp' 'DG'
      array(['ACA', 'MOs', 'ACA', 'LS', 'MOs', 'ACA', 'root', 'MOs', 'MOs',
             'LS', 'LS', 'LS', 'MOs', 'LS', 'LS', 'LS', 'ACA', 'MOs', 'ACA',
             'MOs', 'ACA', 'LS', 'MOs', 'MOs', 'ACA', 'MOs', 'MOs', 'MOs', 'LS',
             'MOs', 'MOs', 'ACA', 'MOs', 'MOs', 'MOs', 'LS', 'ACA', 'LS', 'MOs',
             'ACA', 'LS', 'LS', 'ACA', 'ACA', 'LS', 'LS', 'ACA', 'ACA', 'LS',
             'MOs', 'MOs', 'ACA', 'MOs', 'MOs', 'LS', 'MOs', 'MOs', 'ACA',
             'ACA', 'LS', 'MOs', 'ACA', 'LS', 'LS', 'MOs', 'MOs', 'LS', 'LS',
             'LS', 'ACA', 'MOs', 'MOs', 'LS', 'ACA', 'ACA', 'LS', 'LS', 'ACA',
             'LS', 'MOs', 'ACA', 'LS', 'ACA', 'LS', 'MOs', 'MOs', 'MOs', 'LS',
             'MOs', 'LS', 'ACA', 'ACA', 'ACA', 'MOs', 'LS', 'ACA', 'ACA', 'LS',
             'ACA', 'LS', 'MOs', 'MOs', 'MOs', 'ACA', 'LS', 'ACA', 'ACA', 'MOs',
             'root', 'MOs', 'MOs', 'MOs', 'LS', 'MOs', 'LS', 'ACA', 'ACA',
             'ACA', 'LS', 'LS', 'ACA', 'MOs', 'LS', 'MOs', 'ACA', 'ACA', 'ACA',
             'MOs', 'ACA', 'ACA', 'MOs', 'ACA', 'MOs', 'LS', 'LS', 'LS', 'MOs',
             'MOs', 'MOs', 'ACA', 'LS', 'LS', 'LS', 'MOs', 'MOs', 'MOs', 'LS',
             'LS', 'ACA', 'MOs', 'LS', 'ACA', 'LS', 'LS', 'LS', 'LS', 'MOs',
             'ACA', 'ACA', 'MOs', 'LS', 'MOs', 'MOs', 'MOs', 'MOs', 'LS', 'ACA',
             'MOs', 'LS', 'ACA', 'ACA', 'LS', 'MOs', 'ACA', 'ACA', 'MOs', 'MOs',
             'MOs', 'LS', 'LS', 'MOs', 'ACA', 'ACA', 'LS', 'ACA', 'ACA', 'ACA',
             'ACA', 'MOs', 'ACA', 'MOs', 'MOs', 'ACA', 'LS', 'LS', 'MOs', 'LS',
      ...
             'VISp', 'VISp', 'VISp', 'SUB', 'SUB', 'VISp', 'SUB', 'DG', 'root',
             'VISp', 'VISp', 'SUB', 'VISp', 'SUB', 'SUB', 'DG', 'SUB', 'SUB',
             'VISp', 'VISp', 'VISp', 'VISp', 'VISp', 'VISp', 'DG', 'VISp', 'DG',
             'CA3', 'root', 'CA3', 'DG', 'CA3', 'CA3', 'SUB', 'SUB', 'VISp',
             'SUB', 'SUB', 'CA3', 'VISp', 'VISp', 'VISp', 'SUB', 'VISp', 'SUB',
             'VISp', 'VISp', 'CA3', 'VISp', 'CA3', 'CA3', 'VISp', 'SUB', 'VISp',
             'VISp', 'SUB', 'SUB', 'VISp', 'CA3', 'CA3', 'VISp', 'CA3', 'SUB',
             'VISp', 'VISp', 'VISp', 'VISp', 'DG', 'VISp', 'SUB', 'root',
             'VISp', 'VISp', 'DG', 'VISp', 'CA3', 'VISp', 'VISp', 'CA3', 'SUB',
             'DG', 'CA3', 'SUB', 'SUB', 'VISp', 'VISp', 'VISp', 'VISp', 'DG',
             'SUB', 'SUB', 'VISp', 'CA3', 'DG', 'SUB', 'SUB', 'SUB', 'VISp',
             'SUB', 'SUB', 'SUB', 'SUB', 'SUB', 'DG', 'VISp', 'VISp', 'SUB',
             'DG', 'VISp', 'DG', 'VISp', 'DG', 'DG', 'CA3', 'CA3', 'CA3',
             'VISp', 'CA3', 'SUB', 'CA3', 'VISp', 'DG', 'VISp', 'VISp', 'VISp',
             'CA3', 'SUB', 'CA3', 'VISp', 'VISp', 'CA3', 'VISp', 'VISp', 'VISp',
             'VISp', 'VISp', 'CA3', 'root', 'VISp', 'CA3', 'VISp', 'VISp',
             'SUB', 'CA3', 'CA3', 'CA3', 'DG', 'VISp', 'CA3', 'CA3', 'CA3',
             'VISp', 'VISp', 'CA3', 'CA3', 'VISp', 'VISp', 'CA3', 'CA3', 'CA3',
             'VISp', 'DG', 'CA3', 'DG', 'SUB', 'DG', 'DG', 'VISp', 'DG'],
            dtype='<U4')
    • brain_groups
      (cell)
      <U17
      'non-visual cortex' ... 'hippoca...
      array(['non-visual cortex', 'non-visual cortex', 'non-visual cortex',
             'basal ganglia', 'non-visual cortex', 'non-visual cortex', 'root',
             'non-visual cortex', 'non-visual cortex', 'basal ganglia',
             'basal ganglia', 'basal ganglia', 'non-visual cortex',
             'basal ganglia', 'basal ganglia', 'basal ganglia',
             'non-visual cortex', 'non-visual cortex', 'non-visual cortex',
             'non-visual cortex', 'non-visual cortex', 'basal ganglia',
             'non-visual cortex', 'non-visual cortex', 'non-visual cortex',
             'non-visual cortex', 'non-visual cortex', 'non-visual cortex',
             'basal ganglia', 'non-visual cortex', 'non-visual cortex',
             'non-visual cortex', 'non-visual cortex', 'non-visual cortex',
             'non-visual cortex', 'basal ganglia', 'non-visual cortex',
             'basal ganglia', 'non-visual cortex', 'non-visual cortex',
             'basal ganglia', 'basal ganglia', 'non-visual cortex',
             'non-visual cortex', 'basal ganglia', 'basal ganglia',
             'non-visual cortex', 'non-visual cortex', 'basal ganglia',
             'non-visual cortex', 'non-visual cortex', 'non-visual cortex',
             'non-visual cortex', 'non-visual cortex', 'basal ganglia',
             'non-visual cortex', 'non-visual cortex', 'non-visual cortex',
             'non-visual cortex', 'basal ganglia', 'non-visual cortex',
      ...
             'hippocampus', 'hippocampus', 'hippocampus', 'hippocampus',
             'hippocampus', 'visual cortex', 'hippocampus', 'hippocampus',
             'hippocampus', 'hippocampus', 'hippocampus', 'hippocampus',
             'visual cortex', 'visual cortex', 'hippocampus', 'hippocampus',
             'visual cortex', 'hippocampus', 'visual cortex', 'hippocampus',
             'hippocampus', 'hippocampus', 'hippocampus', 'hippocampus',
             'visual cortex', 'hippocampus', 'hippocampus', 'hippocampus',
             'visual cortex', 'hippocampus', 'visual cortex', 'visual cortex',
             'visual cortex', 'hippocampus', 'hippocampus', 'hippocampus',
             'visual cortex', 'visual cortex', 'hippocampus', 'visual cortex',
             'visual cortex', 'visual cortex', 'visual cortex', 'visual cortex',
             'hippocampus', 'root', 'visual cortex', 'hippocampus',
             'visual cortex', 'visual cortex', 'hippocampus', 'hippocampus',
             'hippocampus', 'hippocampus', 'hippocampus', 'visual cortex',
             'hippocampus', 'hippocampus', 'hippocampus', 'visual cortex',
             'visual cortex', 'hippocampus', 'hippocampus', 'visual cortex',
             'visual cortex', 'hippocampus', 'hippocampus', 'hippocampus',
             'visual cortex', 'hippocampus', 'hippocampus', 'hippocampus',
             'hippocampus', 'hippocampus', 'hippocampus', 'visual cortex',
             'hippocampus'], dtype='<U17')
    • waveform_w
      (cell, sample, waveform_component)
      float32
      0.0 0.0 0.0 ... 0.3759 -0.0752
      array([[[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              ...,
              [ 3.68710645e-02, -4.50368822e-02,  6.54156506e-03],
              [ 5.33648171e-02, -3.61156538e-02,  4.85891290e-03],
              [ 5.65737486e-02, -3.27301621e-02, -1.83911808e-03]],
             [[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              ...,
              [-3.92077237e-01,  1.23770356e-01,  9.49557498e-03],
              [-3.47889751e-01,  1.20285451e-01,  1.09481462e-03],
              [-3.23961437e-01,  1.22066997e-01,  6.95943274e-03]],
             [[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              ...,
      ...
              [ 2.13282752e+00,  4.32471246e-01, -6.04320876e-02],
              [ 2.08903956e+00,  3.83396894e-01, -7.46156126e-02],
              [ 2.04134631e+00,  3.45410287e-01, -7.93920383e-02]],
             [[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              ...,
              [-4.25578952e-01,  1.63250580e-01, -9.46141630e-02],
              [-3.69955659e-01,  1.64518878e-01, -9.61371809e-02],
              [-3.02389175e-01,  1.44267663e-01, -9.69227552e-02]],
             [[ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              [ 0.00000000e+00,  0.00000000e+00,  0.00000000e+00],
              ...,
              [-1.26795590e-01,  5.11937916e-01, -7.75787160e-02],
              [-1.24428548e-01,  4.38707560e-01, -8.89739767e-02],
              [-8.06227699e-02,  3.75862122e-01, -7.52028227e-02]]],
            dtype=float32)
    • waveform_u
      (cell, waveform_component, probe)
      float32
      0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0
      array([[[ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ]],
             [[ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ]],
             [[ 0.00750537,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [-0.00120244,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.01852353,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ]],
      ...
             [[ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ]],
             [[ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ]],
             [[ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ],
              [ 0.        ,  0.        ,  0.        , ...,  0.        ,
                0.        ,  0.        ]]], dtype=float32)
    • lfp
      (brain_area_lfp, trial, time)
      float64
      -2.851 -4.04 -4.195 ... 16.04 5.571
      array([[[-2.85079365e+00, -4.03968254e+00, -4.19523810e+00, ...,
                7.26984127e-01, -2.21746032e+00,  1.09936508e+01],
              [ 9.14263039e+00,  1.14759637e+01,  1.47648526e+01, ...,
                3.03151927e+00,  9.20929705e+00,  7.97596372e+00],
              [ 2.65668934e+00,  4.54557823e+00,  7.65668934e+00, ...,
               -1.79877551e+01, -1.76544218e+01, -1.15433107e+01],
              ...,
              [-3.73741497e+00, -1.10408163e+00, -2.80408163e+00, ...,
                6.68480726e+00,  1.34514739e+01, -9.29705215e-02],
              [-6.76190476e-01, -3.77619048e+00, -8.06507937e+00, ...,
                2.03349206e+01,  1.96126984e+01,  7.19047619e+00],
              [ 3.18326531e+01,  2.46215420e+01,  1.04659864e+01, ...,
               -5.93401361e+00, -1.26451247e+01, -1.59229025e+01]],
             [[ 9.41496599e-01, -4.18367347e-02, -8.50850340e+00, ...,
                4.52482993e+00, -1.68367347e-02,  8.23316327e+00],
              [ 8.85068027e+00,  7.84234694e+00,  7.06734694e+00, ...,
                2.85068027e+00,  1.97568027e+00,  6.57568027e+00],
              [ 1.14316327e+01, -2.35034014e-01,  4.95663265e+00, ...,
               -1.97100340e+01, -1.91850340e+01, -9.22670068e+00],
      ...
              [ 2.80408163e+00,  1.77707483e+01,  2.32540816e+01, ...,
               -1.15125850e+01, -1.95918367e-01,  4.32074830e+00],
              [-1.01176871e+01, -3.34353741e-01,  7.71564626e+00, ...,
               -1.76870748e-02,  1.30823129e+01,  7.11564626e+00],
              [ 1.50935374e+01,  6.76020408e+00,  2.27687075e+00, ...,
                3.46020408e+00,  1.41102041e+01, -5.80646259e+00]],
             [[ 1.12764378e+00, -5.85417440e+00, -7.71781076e+00, ...,
                1.09458256e+01,  5.78218924e+00,  1.44640074e+01],
              [-3.92912801e+00, -6.65640074e+00,  1.47996289e+00, ...,
                1.15708720e+01,  1.94526902e+01,  1.67163265e+01],
              [ 7.94990724e+00, -6.82745826e-02, -1.21319109e+01, ...,
               -2.12500928e+01, -6.23191095e+00, -1.09554731e+00],
              ...,
              [ 1.08935065e+01,  1.26844156e+01,  2.68441558e+00, ...,
                3.86623377e+00, -5.24675325e-01, -4.33376623e+00],
              [-1.07480519e+01, -8.59350649e+00, -2.16623377e+00, ...,
                9.79220779e-01,  1.14064935e+01,  4.43376623e+00],
              [ 5.38868275e+00, -3.72040816e+00, -4.64768089e+00, ...,
                1.55523191e+01,  1.60432282e+01,  5.57050093e+00]]])
    • spike_time
      (spike_id)
      float32
      0.2676 2.308 0.8535 ... 2.189 2.399
      array([0.2676345 , 2.3083346 , 0.85347587, ..., 0.61856014, 2.188634  ,
             2.3993347 ], dtype=float32)
    • spike_cell
      (spike_id)
      uint32
      1 1 1 1 1 1 ... 734 734 734 734 734
      array([  1,   1,   1, ..., 734, 734, 734], dtype=uint32)
    • spike_trial
      (spike_id)
      uint32
      21 21 31 37 43 ... 364 364 364 364
      array([ 21,  21,  31, ..., 364, 364, 364], dtype=uint32)
    • trial
      PandasIndex
      PandasIndex(Index([  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,
             ...
             355, 356, 357, 358, 359, 360, 361, 362, 363, 364],
            dtype='int32', name='trial', length=364))
    • time
      PandasIndex
      PandasIndex(Index([0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09,  0.1,
             ...
             2.41, 2.42, 2.43, 2.44, 2.45, 2.46, 2.47, 2.48, 2.49,  2.5],
            dtype='float64', name='time', length=250))
    • cell
      PandasIndex
      PandasIndex(Index([  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,
             ...
             725, 726, 727, 728, 729, 730, 731, 732, 733, 734],
            dtype='int32', name='cell', length=734))
    • waveform_component
      PandasIndex
      PandasIndex(Index([1, 2, 3], dtype='int32', name='waveform_component'))
    • probe
      PandasIndex
      PandasIndex(Index([  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,
             ...
             375, 376, 377, 378, 379, 380, 381, 382, 383, 384],
            dtype='int32', name='probe', length=384))
    • brain_area_lfp
      PandasIndex
      PandasIndex(Index(['ACA', 'LS', 'MOs', 'CA3', 'DG', 'SUB', 'VISp'], dtype='object', name='brain_area_lfp'))
    • spike_id
      PandasIndex
      PandasIndex(Index([      1,       2,       3,       4,       5,       6,       7,       8,
                   9,      10,
             ...
             2446164, 2446165, 2446166, 2446167, 2446168, 2446169, 2446170, 2446171,
             2446172, 2446173],
            dtype='int32', name='spike_id', length=2446173))
  • session_date :
    2016-12-14
    mouse :
    Cori
    stim_onset :
    0.5
    bin_size :
    0.01

Example: Make a catplot for feedback_type counting number of values in each category.

df = dset['feedback_type'].to_dataframe().reset_index()
sns.catplot(data=df, x='feedback_type', kind='count')

Exercise: Make a catplot for response_type counting number of values in each category.

Solution
df = dset['response_type'].to_dataframe().reset_index()
sns.catplot(data=df, x='response_type', kind='count')

Exercise: Make a catplot for brain_area counting number of values in each category.

Solution
df = dset['brain_area'].to_dataframe().reset_index()
sns.catplot(data=df, x='brain_area', kind='count')

Example: Make a bar plot visualizing how mean reaction time varies for different feedback types.

df = dset[['feedback_type', 'reaction_time']].to_dataframe().reset_index()
sns.catplot(data=df, x='feedback_type', y='reaction_time', kind='bar')

Exercise: Make a bar plot visualizing how mean response time varies for different feedback types.

Solution
df = dset[['feedback_type', 'response_time']].to_dataframe().reset_index()
sns.catplot(data=df, x='feedback_type', y='response_time', kind='bar')

Exercise: Make a bar plot visualizing how mean response time varies for different response types.

Solution
df = dset[['response_type', 'response_time']].to_dataframe().reset_index()
sns.catplot(data=df, x='response_type', y='response_time', kind='bar')

Exercise: Make a box plot visualizing how mean response time varies for different response types.

Hint: Use kind='box'

Solution
df = dset[['response_type', 'response_time']].to_dataframe().reset_index()
sns.catplot(data=df, x='response_type', y='response_time', kind='box')

Exercise: Make a box plot visualizing how mean feedback time varies for different feedback types.

Solution
df = dset[['feedback_type', 'feedback_time']].to_dataframe().reset_index()
sns.catplot(data=df, x='feedback_type', y='feedback_time', kind='box')

Exercise: Make a box plot visualizing how mean feedback time varies for different feedback types in different columns.

Solution
df = dset[['feedback_type', 'feedback_time']].to_dataframe().reset_index()
sns.catplot(data=df, x='feedback_type', y='feedback_time', kind='box', col='feedback_type')

Exercise: Make a box plot visualizing how mean response time varies for different feedback types in different columns

Solution
df = dset[['feedback_type', 'response_time']].to_dataframe().reset_index()
sns.catplot(data=df, x='feedback_type', y='response_time', kind='box', col='feedback_type')

Exercise: Make a box plot visualizing how mean feedback time varies for different feedback types separated into columns based on response types.

Solution
df = dset[['feedback_type', 'feedback_time', 'response_type']].to_dataframe().reset_index()
sns.catplot(data=df, x='feedback_type', y='feedback_time', kind='box', col='response_type')

Exercise: Let’s plot this another way. Make a box plot visualizing how mean feedback time varies for different response types separated into columns based on feedback types.

Solution
df = dset[['feedback_type', 'feedback_time', 'response_type']].to_dataframe().reset_index()
sns.catplot(data=df, x='response_type', y='feedback_time', kind='box', col='feedback_type')

Exercise: Make a bar plot visualizing how mean lfp varies for different brain areas separated into columns based on feedback types.

Solution
df = dset[['lfp', 'feedback_type']].to_dataframe().reset_index()
sns.catplot(data=df, x='brain_area_lfp', y='lfp', kind='bar', col='feedback_type')

Exercise: Make a bar plot visualizing how mean lfp varies for different brain areas separated into columns based on response types.

Solution
df = dset[['lfp', 'response_type']].to_dataframe().reset_index()
sns.catplot(data=df, x='brain_area_lfp', y='lfp', kind='bar', col='response_type')

Section 2: Selecting Data based on its Values (“Logical Indexing” or “Masking”) and Plotting it in MultiFaceted Line Plots with sns.relplot()

Code Description
mask = df["col_1"] == 'val_1' Store which values of col_1 are equal to 'val_'
mask = mask1 & mask2 Store which values are true for both mask1 and mask2
mask = mask1 | mask2 Store which values are true for at least one of mask1 or mask2
df[mask] Get only the rows of df for which the values in mask are True.
Plotting MultiFaceted Line Plots with Seaborn: sns.relplot()
Code Description
sns.relplot() Creates a relational plot using Seaborn. Specifies the following parameters:
data: DataFrame variable that the plot will be made from.
x=: Column to use for the x-axis of the plot.
y=: Column to use for the y-axis of the plot.
kind=: “line” for a line plot, “scatter” for a scatter plot.
col=: Column to use to split the figure into columns
col_wrap=: The max number of columns per row
n_boot=: Number of bootstrap resampling to compute confidence intervals.

Exercises

Example: Make a line plot of time vs lfp, but only for trial numbers less than 50.

df = dset[['lfp']].to_dataframe().reset_index()
mask = df['trial'] < 50
sns.relplot(data=df[mask], x='time', y='lfp', kind='line', n_boot=20);

Exercise: Make a line plot of time vs lfp, but only for trials where contrast_left was 100

Solution
df = dset[['lfp', 'contrast_left']].to_dataframe().reset_index()
mask = df['contrast_left'] == 100
sns.relplot(data=df[mask], x='time', y='lfp', kind='line', n_boot=1);

Exercise: There seems to be a strong response right after t=0.5. This is when the visual stimulus appeared in each trial. Let’s see if the response is still there when no stimulus was presented:

Make a line plot of time vs lfp, but only for trials where contrast_left was 0 and contrast_right was 0.

Solution
df = dset[['lfp', 'contrast_left', 'contrast_right']].to_dataframe().reset_index()
mask1 = df['contrast_left'] == 0
mask2 = df['contrast_right'] == 0
mask = mask1 & mask2
sns.relplot(data=df[mask], x='time', y='lfp', kind='line', n_boot=20);

Exercise: Make a line plot of time vs lfp, but only for trials where either contrast_left was greater than 50 or contrast_right was greater than 50

Solution
df = dset[['lfp', 'contrast_left', 'contrast_right']].to_dataframe().reset_index()
mask1 = df['contrast_left'] > 50
mask2 = df['contrast_right'] > 50
mask = mask1 | mask2
sns.relplot(data=df[mask], x='time', y='lfp', kind='line', n_boot=20);

Exercise: Make a line plot of time vs lfp, but only for brain_area_lfp measurements in the visual cortex area 'VISp'.

Solution
df = dset[['lfp', 'brain_area_lfp']].to_dataframe().reset_index()
mask = df['brain_area_lfp'] == 'VISp'
sns.relplot(data=df[mask], x='time', y='lfp', kind='line', n_boot=20);

Exercise: Does the hippocampus have such a distinct response? Make a line plot of time vs lfp, but only for brain_area_lfp measurements in either 'DG' or 'CA3'.

Solution
df = dset[['lfp', 'brain_area_lfp']].to_dataframe().reset_index()
mask1 = df['brain_area_lfp'] == 'DG'
mask2 = df['brain_area_lfp'] == 'CA3'
mask = mask1 | mask2
sns.relplot(data=df[mask], x='time', y='lfp', kind='line', n_boot=20);

Exercise: How does the mouse’s response affect the lfp in the visual cortex? Make a line plot of time vs lfp, but only for brain_area_lfp measurements in the visual cortex area 'VISp', and use hue to compare the lfp between different response_type values.

Solution
df = dset[['lfp', 'brain_area_lfp', 'response_type']].to_dataframe().reset_index()
mask = df['brain_area_lfp'] == 'VISp'
sns.relplot(data=df[mask], x='time', y='lfp', kind='line', hue='response_type', n_boot=20);

Exercise: There are so many different brain areas; let’s plot them all at once in different subplots. Make a line plot of time vs lfp, where col is the brain area. (if there are too many columns, you can set col_wrap=3 to make new rows automatically).

Solution
df = dset[['lfp', 'brain_area_lfp']].to_dataframe().reset_index()
sns.relplot(data=df, x='time', y='lfp', kind='line', col='brain_area_lfp', col_wrap=4, n_boot=20);

Exercise: For each brain area, compare the lfps to different response types. Which brain areas seem most related to the subject’s behavior?

Solution
df = dset[['lfp', 'brain_area_lfp', 'response_type']].to_dataframe().reset_index()
sns.relplot(data=df, x='time', y='lfp', kind='line', col='brain_area_lfp', hue='response_type', col_wrap=4, n_boot=20);

Section 3: Visualizing Average LFP Data with Heatmap

Let’s try to visualize same information for all brain area in a different format. Sometimes, it might be enough to only see variations in terms of color change rather than number. In this case, a heatmap could be a very informative way to identify patterns in the time series of mean LFP signal across all trials.

We will make use of group-by and pivot_table method of Pandas dataframe to aggregate LFP and Seaborn heatmap method to visualize

Method Description
mask = df["col_1"] == 'val_1' Store which values of col_1 are equal to 'val_1'.
mask = mask1 & mask2 Store which values are true for both mask1 and mask2.
mask = mask1 | mask2 Store which values are true for at least one of mask1 or mask2.
df[mask] Get only the rows of df for which the values in mask are True.
df.groupby(['column1','column2'])['column3'].mean().unstack() Aggregate column3 with respect to column1 and column2 and unstack the table.
df.pivot_table(index='column1', columns='column2', values='column3', aggfunc='mean') Does the same as above.
sns.heatmap(grouped_df) Create heatmap of grouped_df

Exercise: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time.

Solution
df = dset['lfp'].to_dataframe().reset_index()
group = df.groupby(['brain_area_lfp', 'time'])['lfp'].mean().unstack()
sns.heatmap(group)

Exercise: Make a heatmap visualization of the median Local Field Potential (LFP) data grouped by brain_area_lfp and time.

Solution
df = dset['lfp'].to_dataframe().reset_index()
group = df.groupby(['brain_area_lfp', 'time'])['lfp'].median().unstack()
sns.heatmap(group)

Exercise: Make a heatmap visualization of the maximum Local Field Potential (LFP) data grouped by brain_area_lfp and time.

Solution
df = dset['lfp'].to_dataframe().reset_index()
group = df.groupby(['brain_area_lfp', 'time'])['lfp'].max().unstack()
sns.heatmap(group)

Exercise: Make a heatmap visualization of the minimum Local Field Potential (LFP) data grouped by brain_area_lfp and time.

Solution
df = dset['lfp'].to_dataframe().reset_index()
group = df.groupby(['brain_area_lfp', 'time'])['lfp'].min().unstack()
sns.heatmap(group)

Exercise: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time but only for feedback_type == 1.

Solution
df = dset[['lfp', 'feedback_type']].to_dataframe().reset_index()
mask = df['feedback_type'] == 1
group = df[mask].groupby(['brain_area_lfp', 'time'])['lfp'].mean().unstack()
sns.heatmap(group)

Exercise: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time but only for feedback_type == -1.

Solution
df = dset[['lfp', 'feedback_type']].to_dataframe().reset_index()
mask = df['feedback_type'] == -1
group = df[mask].groupby(['brain_area_lfp', 'time'])['lfp'].mean().unstack()
sns.heatmap(group)

We can get the same group with a Pandas method called pivot_table.

Example: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time using pivot_table.

df = dset['lfp'].to_dataframe().reset_index()
group = df.pivot_table(index='brain_area_lfp', columns='time', values='lfp', aggfunc='mean')
sns.heatmap(group)

Exercise: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time but only for feedback_type == 1 using pivot table.

Solution
df = dset[['lfp', 'feedback_type']].to_dataframe().reset_index()
mask = df['feedback_type'] == 1
group = df[mask].pivot_table(index='brain_area_lfp', columns='time', values='lfp', aggfunc='mean')
sns.heatmap(group)

Exercise: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time but only for response_type == 1 using pivot table.

Solution
df = dset[['lfp', 'response_type']].to_dataframe().reset_index()
mask = df['response_type'] == 1
group = df[mask].pivot_table(index='brain_area_lfp', columns='time', values='lfp', aggfunc='mean')
sns.heatmap(group)

Exercise: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time but only for feedback_type == -1 using pivot_table method.

Solution
df = dset[['lfp', 'feedback_type']].to_dataframe().reset_index()
mask = df['feedback_type'] == -1
group = df[mask].pivot_table(index='brain_area_lfp', columns='time', values='lfp', aggfunc='max')
sns.heatmap(group)

Exercise: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time but only for feedback_type == 1 and response_type == 1 using pivot_table method

Solution
df = dset[['lfp', 'feedback_type', 'response_type']].to_dataframe().reset_index()
mask1 = df['response_type'] == 1
mask2 = df['feedback_type'] == 1
mask = mask1 & mask2
group = df[mask].pivot_table(index='brain_area_lfp', columns='time', values='lfp', aggfunc='mean')
sns.heatmap(group)

Exercise: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time but only for feedback_type == 1 and response_type == -1 using pivot_table method

Solution
df = dset[['lfp', 'feedback_type', 'response_type']].to_dataframe().reset_index()
mask1 = df['response_type'] == -1
mask2 = df['feedback_type'] == 1
mask = mask1 & mask2
group = df[mask].pivot_table(index='brain_area_lfp', columns='time', values='lfp', aggfunc='mean')
sns.heatmap(group)

Exercise: Make a heatmap visualization of the mean Local Field Potential (LFP) data grouped by brain_area_lfp and time but only for feedback_type == -1 and response_type == 0 using pivot_table method.

Solution
df = dset[['lfp', 'feedback_type', 'response_type']].to_dataframe().reset_index()
mask1 = df['response_type'] == 0
mask2 = df['feedback_type'] == -1
mask = mask1 & mask2
group = df[mask].pivot_table(index='brain_area_lfp', columns='time', values='lfp', aggfunc='mean')
sns.heatmap(group)

Exercise: Make a heatmap visualization of the median Local Field Potential (LFP) data grouped by brain_area_lfp and time but only for either VISp or DG brain areas using pivot_table method.

Solution
df = dset[['lfp']].to_dataframe().reset_index()
mask1 = df['brain_area_lfp'] == 'VISp'
mask2 = df['brain_area_lfp'] == 'DG'
mask = mask1 | mask2
group = df[mask].pivot_table(index='brain_area_lfp', columns='time', values='lfp', aggfunc='median')
sns.heatmap(group)