This repository implements classification of task engagement as "active" or "passive", based on the respective reward contingencies provided in the Visual Behavior task from Allen Brain Institute. **Image change detection task** ![task_setup](./Figures/task_diagram.png) Image credit: Allen Insitute for Brain Science. [Brain Map Portal](https://portal.brain-map.org/circuits-behavior/visual-behavior-neuropixels) In this task, mice are presented with multiple flashes of 8 possible full-screen images and are instructed to catch flashed image identity changes by licking to reward spouts. Successful detection of image changes within 0-750 ms correspond to receiving a fluid reward in the "active" version of the task, and no reward in the "passive" version of the task. This difference serves to implement two task engagement levels, which are used as classes to label laminar and spectral resolved data. In order to bring together temporal and cortical depth information, we first compute Current-Source-Density (CSD) using the purpose-specific [Elephant](https://elephant.readthedocs.io/en/latest/reference/current_source_density.html) library based on "KCSD1D" published methods [1,2]. **Layer- and Frequency-specific task engagement** ![img_segmentation](./Figures/segmentation-csd.png) **Conceptual sketch of Power Spectra and CSD discretization.** We discretize CSD profiles in bins for every cortical layer and the following times from stimulus onset: 0-50ms, 50-100 ms, 100-150 ms, 150-200 ms, 200-250 ms. Following discretization, we apply Linear Discriminant Analysis (see `/Code` folder), and provide decoding accuracy results listed in the `/Code/CSD_analysis.ipynb` notebook file. **References** [1] Potworowski, J., Jakuczun, W., Łęski, S. & Wójcik, D. (2012) 'Kernel current source density method.' Neural Comput 24(2), 541-575. [2] Pettersen, K. H., Devor, A., Ulbert, I., Dale, A. M. & Einevoll, G. T. (2006) 'Current-source density estimation based on inversion of electrostatic forward solution: effects of finite extent of neuronal activity and conductivity discontinuities.' J Neurosci Methods 154(1-2), 116-133. **Release notes** Data from [Visual Behavior - Neuropixels](https://portal.brain-map.org/circuits-behavior/visual-behavior-neuropixels). Images from Brain Map Portal, (c) Allen Institute for Brain Science. License note for [Visual Behavior Neuropixels data](https://knowledge.brain-map.org/data/LOW0UCZ3FE0DHWZOSXU/summary) and [Images](https://alleninstitute.org/citation-policy/). The code is written in Python v3.8.18 and imports [Allen SDK](https://allensdk.readthedocs.io/en/latest/), please check [versions](/versions.txt/) for details. License CC-NC-BY-SA 4.0 - authors [Demetrio Ferro](https://gin.g-node.org/56Fe) and [Pau Boncompte Carré](https://gin.g-node.org/PauBonco).