Imaging Analysis Course: from raw movie to heading-direction network

Eleven notebooks that follow one question from start to finish: given a two-photon movie, how do we arrive at the statement “these neurons form a heading-direction network”, and how much of it can we defend?

The aim is understanding. Each step that analysis packages do for you is opened up in plain Python, run on data where the right answer is known, then on real recordings where it is not. Every notebook states its question, gives the maths where it matters, asks for a prediction before each result, and ends with exercises and worked answers. It is written for self-study and grew out of the lab’s analysis workshop in November 2026.

Open the repository on GitHub   Contact us for access

The notebooks, code and data are kept in a private GitHub repository: the button works for lab members who are signed in to GitHub, and shows a “not found” page to everyone else. If you would like to use the materials, please get in touch and tell us who you are and what you have in mind. We are happy to share where we can, but access is granted case by case and cannot be guaranteed.

Three panels: contrast of the correlation map, the regions of interest grown from it, and the true cells marked as found or missed.
Part A. Regions of interest grown pixel by pixel from the correlation map of a demonstration movie in which the true cells are known: which were found (green), which were missed (orange), and why.

What the repository contains

Part A. From the raw movie to a neurons × time matrix

  1. A1 The raw movie, and the line offset
  2. A2 Motion correction: three methods compared
  3. A3 The correlation map, and growing ROIs
  4. A4 Traces and quality control
  5. A5 Your own recording

Part B. From the matrix to a heading-direction network

  1. B1 Tuning to a known angle
  2. B2 Structure without a known angle
  3. B3 What a ring does and does not prove
  4. B4 The latent angle
  5. B5 Confounds
  6. B6 All methods, all recordings

Alongside the notebooks, the repository holds two small Python modules with every function the notebooks use, and six recordings as neurons × time matrices (zebrafish and mouse). The full raw recordings of the three unpublished datasets are deposited on Zenodo (doi:10.5281/zenodo.24348859) with restricted access, under the same conditions.

The phase of the network plotted with the fictive heading of the fish, the change of phase against the size of each turn, and the average change of phase after left and right turns.
Part B. A ring of anticorrelated neurons found without any external angle: its phase moves with every turn of the fish. Data from Petrucco et al., Nature Neuroscience 2023.

Credits

The course rests on the data, code and ideas of Anja, Hagar, Julie, Luigi, Ryosuke, You Kure, Younes and Zehui.

← Back to Resources