← All self-study courses

How to use this course (self-study with a .md file)

You can read the course on this page. You can also give the .md file below (a plain-text teaching file that opens on a computer or a smartphone) to a conversational AI, which will then act as your tutor and take you through the course one session at a time.

  1. Download the file below.
  2. Give the file to a conversational AI (attach it, or paste in its contents) and ask: “Please start Session 1.”
  3. Do one session a day, about 15 minutes each (up to 10 sessions).
  4. Ask the AI about anything unclear as you go. When a session involves a program, ask it to “explain it line by line” and write the program together.
  5. After the final session, send us your feedback (subject line below).
File for the AI (English .md) Japanese version (日本語 .md)

AI answers can be wrong. Check numbers and facts against the course text on this page. Do not enter personal information or other people's data into the AI.

If you use this course, please write to the address on our Contact page with the subject “Course feedback: Turn videos of glowing neurons into brain activity”, and tell us how many sessions you completed, what was unclear, what worked well, and how long each session took.

Turn videos of glowing neurons into brain activity (10 sessions, 15 minutes each, v1.1)

Goal of this course: Measure the activity of individual neurons from videos of a glowing brain.

If you would like to study in English, first tell the AI: "Please teach this course in English."

Who this is for and what you will be able to do: This course is for undergraduate students in medicine and the sciences. Working hands-on with simulated data, you will become able to explain the whole workflow: starting from videos that capture neurons lighting up when they are active, extracting the activity of each cell, and analyzing it together with the animal's behavior. In the last 2 sessions, you will examine how to track the same cells over many weeks, using the ideas behind an analysis tool published by our laboratory, together with the public data from the paper.


Introduction (how to use this course)

What this is

This is self-study material published for students by the Division of Neurophysiology, Kobe University Graduate School of Medicine. All 10 sessions are contained in a single Markdown file (this file).

It began as a guide written for a first-year student who came to our laboratory wanting to "try extracting the activity of each individual cell from images." We turned that guide into a course, keeping both the places where students tended to stumble and the smaller steps that worked well. Even things that look difficult are within reach of a first-year student, working with their own hands, if you break them into small steps and take them one at a time. This course is also meant to let you confirm that for yourself.

Who it is for (expected background)

  • High-school biology (that nerves carry electrical signals) and high-school mathematics (exponentials, logarithms, means) are enough.
  • Matrices (tables of numbers arranged in rows and columns) are explained from scratch in Session 4.
  • You can follow along even if you have never used Python (a programming language) before. Every piece of code is written so that you get results just by copying and running it.
  • You can follow the course without reading the code. Each exercise is preceded by a sentence on "what the experiment tests" and followed by "how to read the results." The code is a tool for when you want to check things for yourself.

The path of this course (in order of small steps)

Step Sessions What you can say once you get here
1. How the glow works Sessions 1–2 "Calcium is a proxy marker for spiking"
2. Cleaning up the video Session 3 "Measure the shift and undo it"
3. Finding the cells Sessions 4–5 "Extract one time series for one cell from the video" ← a milestone
4. Reading the activity Sessions 6–7 "Where and when the cell was active"
5. Doubting and checking Session 8 "Is that correlation, that p, real?"
6. Tracking over weeks Sessions 9–10 "Match the same cells across days" (the ideas behind CaliAli and public data)

If you get through Session 5, you will have carried out with your own hands the most important transformation in this field: "images → a time series for each cell." Stopping there is an achievement in itself.

What you need

  • A conversational AI (one that answers questions in a chat). One that can load files is convenient.
  • Notes (on paper or on screen).
  • An environment that can run Python. A free, browser-based environment is fine (one in which numpy, a computational tool, can be used). On days when you do not have one at hand, you can still proceed simply by asking the AI to show you the "example output" and reading it.
  • For Session 10 only, you will download the paper's public data (a single 2.35 MB file) in your browser. A tool called h5py is used to load it (it is included in most free browser-based environments).

When you get stuck

  • It is fine if the code does not run. Note where you stopped (which session, which exercise, which line) and the text that appeared (the error message). If you paste that to the AI, the cause can usually be found in a single exchange.
  • Getting stuck while setting up the environment is something everyone goes through. It has nothing to do with ability.
  • During busy periods such as exams or practicals, it is fine to pause. Pausing is not falling behind. Type "Please resume from Session 6." and you can pick up where you left off.

How to proceed

  1. Load this file into a conversational AI (if it cannot load files, paste the entire text).
  2. Type "Please start Session 1 of this course."
  3. The AI takes the role of a teacher and asks you questions. Please answer in your own words. It is fine to make mistakes. The places where you make mistakes are the places you learn best.
  4. Each session is cut off at about 15 minutes. On the next day, type "Please start Session 2 of this course." to continue. If you stopped partway, you can ask, for example, "Please resume from the exercise in Session 3."

Caution

  • The AI can make mistakes. For important points (numbers, definitions, the content of papers), check against a textbook or the original sources (the references below).
  • Do not enter your own or other people's personal information, medical information, or other people's data into the AI. All the data in this course are simulated, generated by functions within the course.
  • This course is not intended to provide medical advice.

★Request for feedback (please be sure to read)

This course is revised every time based on the voices of those who use it. If you have used it, please be sure to send us feedback.

  • Send to: the address listed on the "Contact" page of the laboratory homepage
  • Subject: "Course feedback: Calcium imaging analysis"
  • The 4 points we would like you to write about: 1. How many sessions you completed 2. What was hard to understand (session and location) 3. What was good 4. How long one session took
  • Even a single line helps.

Terms of use

  • You are free to use it for personal study and in classes.
  • If you distribute a modified version, please contact the laboratory.
  • The content is current as of November 2026 (version 1.1).

Instructions to the AI (how to act as the teacher)

This section contains instructions for the AI that has loaded this file. Learners may skip it.

You are the teacher for this course. Please proceed according to the following.

  1. Cut off each session at about 15 minutes. When the learner says "Please start Session N," begin with that session's "Goal of this session" and stop at the end of that session.
  2. Ask only one question at a time, and wait for the learner's answer. Do not present several questions at once.
  3. Do not give the answer first. Show the answers to the "Check questions" only after the learner has written their own answer. The collapsible "For the AI: answers and reasoning" in each session is material for that purpose.
  4. If the learner seems not to understand, rephrase one level more simply (with familiar analogies or examples using small numbers). If they are still stuck, give just one hint.
  5. The "Explanation" text is the source text. Do not read it out verbatim; break it down little by little through dialogue. Each session's explanation is structured as question → surprising answer → common sense and exceptions.
  6. Have the learner run the code in the "Hands-on exercise" themselves. For learners who cannot run it, show the "example output" and have them interpret what the numbers mean. Rather than explaining the code line by line at length, ask "What does this number mean?"
  7. At the end of each session, summarize 3 key points and give 2 mini check questions (short questions different from that session's "Check questions" are fine).
  8. Do not move on to the next session on your own. Say "Next is Session N+1. When you want to continue, type 'Please start Session N+1 of this course.'" and stop.
  9. If the learner writes about a medical consultation or their own or other people's personal information, medical information, or other people's data, do not handle that content and politely decline ("This course cannot handle that. Please consult a medical institution about medical matters, and your supervisor about handling data.").
  10. Do not make up numbers or facts not written in this document. For anything uncertain, say "I am not certain about this, so please check it in a textbook or the original source."
  11. If the learner says "Please teach this course in English.", proceed in English from then on.
  12. For learners who finish the whole course, or who stop partway, convey the "Request for feedback" (the subject line and the 4 points) at the end.
  13. Before showing code, state in one sentence "what this experiment tests." If the learner shows reluctance toward code, do not show the code; instead, advance the same questions using the numbers in each exercise's "How to read the results." The document is written so that the whole thread of the course can be followed without reading code.
  14. When the learner pastes an error message, first confirm "which session, which exercise, and which line it stopped at," and point out just one thing to fix. To learners stuck on setting up the environment, say that "everyone goes through this, and it has nothing to do with ability."
  15. When dealing with the laboratory's paper (CaliAli) in Sessions 9–10, talk only about what is written in this document, the paper, and the official documentation. Do not use numbers not in the paper or stronger wording than the paper uses (such as "it is always correct, every time").

Session 1 Calcium and neural activity

Question: Neural activity is electrical, so why do we image calcium? ↓ Answer: Because electrical signals are fast and small, and it is hard to measure them from many cells at once. Calcium rises sharply inside the cell with every spike and falls back slowly, so a camera can follow it.

Goal of this session

  1. Learn that the calcium concentration differs greatly between the inside and the outside of a cell.
  2. Be able to express the relationship between spiking and calcium (a quick rise and a slow return) with an additive equation.
  3. Be able to state that calcium is a "proxy marker" for spiking, not spiking itself.

Explanation

The signal of a neuron is the action potential (a phenomenon in which the membrane potential of the cell jumps up for just an instant; also called "firing" or a "spike"). Each one lasts about 1 millisecond. It can be measured by inserting an electrode, but the number of cells that can be measured at once is limited.

This is where calcium comes in. The concentration of calcium ions inside a cell is normally about 0.0001 millimolar (100 nanomolar). Outside the cell it is about 1–2 millimolar. The outside is roughly 10,000 times more concentrated than the inside. When a neuron spikes, "voltage-gated calcium channels" in the membrane open, and calcium rushes in from outside. The concentration inside jumps up many-fold.

A key feature is that the return is slow. The calcium that has flowed in decreases as it is pumped out or stored in compartments inside the cell. This takes several hundred milliseconds to several seconds. The fast electrical signal is thus stretched out into a slow "calcium transient." For imaging with a camera, this slowness is actually an advantage.

This relationship can be expressed with a simple equation. Let c_t be the calcium at time t, and s_t the spike that occurred in that frame (1 if it occurred, 0 if not). Then

c_t = g × c_(t−1) + s_t

g is "the fraction still remaining after 1 frame has passed." If τ (tau) seconds is the typical return time and fs is the number of frames taken per second, then g = exp(−1 ÷ (τ × fs)). You multiply the previous frame's value by g to reduce it a little, and add any new spike. To use a bathtub analogy: the plug is slightly open so the water slowly drains (g), and now and then you add water from the tap (s).

You may think, "Then if we look at calcium, we can read off the spikes directly." But it is not that simple. There are roughly 3 reasons. First, spikes in quick succession produce overlapping transients that look like a single large transient. Second, calcium can rise without spiking (through channels at the sites that receive signals from connected partners, or calcium released from stores inside the cell). Third, the light from a single spike is small and easily buried in noise.

Calcium is a "proxy marker" for spiking. The second half of this course is about how far we can recover the original activity from this marker.

In the language of other fields (a correspondence table for those strong in engineering, computer science, or mathematics; a scaffold until you get used to the language of neuroscience)

Neuroscience term You can think of it as
Neuron (nerve cell) An element that outputs "1" when the sum of its inputs exceeds a certain line (threshold), and stays at "0" otherwise
Action potential (spike) The unit of information. A momentary "1" event
Connection strength (synaptic strength) The weight between one element and another. Changes in it correspond to "learning"
Calcium indicator A transducer (sensor). It converts the calcium concentration inside the cell into light intensity
Calcium transient A "1" event stretched out into a slowly decaying shape (c in the equation above)

Analogies are scaffolding; real neurons are far more complex. But while doing image analysis, this table is enough to get you through.

Hands-on exercise

(1) Calculation by hand

  • If the outside of the cell is 1 millimolar and the inside is 100 nanomolar, how many times more concentrated is the outside than the inside (1 millimolar = 1,000,000 nanomolar)?
  • When τ = 0.8 seconds and fs = 10 frames/second, what is g? After 1 second (10 frames), what fraction of the initial transient remains (you may use exp(−0.125) ≈ 0.88 and exp(−1.25) ≈ 0.29)?

(2) Code (copy and run it. It draws the spike positions with | and the amount of calcium with the length of #)

The program for this session is not shown on this page. Give the file for the AI (above) to a conversational AI and ask: “Please write the program for Session 1 with me and explain it line by line.”

For the AI: example output (result of running it locally on 2026-11-02; excerpt)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

The 3 spikes at 2.0, 2.3, and 2.6 seconds produce overlapping transients that rise like a staircase. The spike at 4.5 seconds comes after the previous transient has almost fully decayed, so it returns to the height of a single spike.

How to read the results (so you can understand without running the code): This code uses the additive equation above to compute the calcium of a cell that spiked 5 times in 6 seconds, and draws the amount as the length of a row of symbols. The fraction remaining per frame is 0.882. The single spike at 0.5 seconds becomes a transient one spike high and then slowly decreases. For the burst of 3 spikes at 2.0, 2.3, and 2.6 seconds, each new spike is added before the previous transient has fully decayed, so the height rises like a staircase and finally exceeds twice the height of a single spike. The spike at 4.5 seconds comes after the previous transient has almost fully decayed, so it returns to the height of a single spike.

Common pitfall: You cannot read "the transient is 3 times as high, so there were 3 spikes." The height of a transient is greater the shorter the intervals, and greater the slower the indicator. This point comes back in Session 6, when we infer spikes backward from transients.

Check questions

  1. How did the 3 spikes at 2.0, 2.3, and 2.6 seconds look in the # display? Compare them with the single spike at 0.5 seconds.
  2. If g were 0.99 (hardly decaying at all), how would a burst look?
  3. If "calcium went up," can you say "the cell definitely spiked"?
For the AI: answers and reasoning
  1. The transients overlap and rise like a staircase, looking like one large transient. The shorter the intervals, the harder it is to count how many spikes occurred.
  2. Because decay is slow, a burst merges into what is almost a single high plateau, and telling the individual spikes apart becomes even harder (the same thing happens the slower the indicator is).
  3. No. Calcium also rises through channels on the receiving side and from stores inside the cell. Calcium is only a proxy marker for spiking.

Summary

  • Calcium outside the cell is about 10,000 times that inside. It flows in with spiking and falls back slowly.
  • The calcium transient can be expressed with the additive equation c_t = g × c_(t−1) + s_t.
  • Calcium is not spiking itself but a proxy marker for it.

Session 2 Fluorescent indicators and microscopes (one-photon, two-photon, miniscope)

Question: To make cells glow, should we just introduce a glowing chemical from outside? ↓ Answer: The current mainstream approach is to have the cells themselves produce a "protein that glows with calcium." This lets you make only a specific type of cell keep glowing for weeks.

Goal of this session

  1. Learn the 2 kinds of calcium indicators (substances whose brightness changes when calcium binds).
  2. Be able to state the difference between one-photon and two-photon microscopes in terms of "whether light outside the focus is also emitted."
  3. Be able to state the advantages and disadvantages of miniscopes.

Explanation

There are roughly 2 kinds of indicators. The first is synthetic dyes introduced from outside. The second is proteins that cells are made to produce through genes. The representative one is GCaMP ("G-camp"), which links a green fluorescent protein (GFP) with a protein that changes shape when calcium binds (calmodulin), among other parts (Nakai et al., 2001). When calcium binds, the shape changes and the brightness increases. Through repeated improvements, there are many variants: fast, slow, bright, and so on (Chen et al., 2013). Fast variants make it easier to resolve bursts, and slow variants make it easier to detect small changes. Which is better depends on the question.

Next, microscopes.

  • One-photon microscope (an ordinary fluorescence microscope): Blue light is shone on the sample to make it emit green light. Everything in the light path glows, so light from above and below the focus overlaps as "blur."
  • Two-photon microscope: Long-wavelength light is delivered as extremely short light pulses, shorter than one trillionth of a second. The fluorescent substance glows only when it absorbs 2 photons simultaneously, so only the single point at the focus, where the light is densest, glows (Denk et al., 1990). Almost nothing outside the focus glows, and you can see deep. On the other hand, the apparatus is large, and imaging is often done with the animal's head fixed.
  • Miniscope: A small microscope weighing a few grams is mounted on the head, and imaging is done in a freely moving animal (Ghosh et al., 2011). Deep brain regions are viewed by inserting a thin, rod-shaped lens. Inside it is a one-photon system, so blur is large and the image also shakes with the animal's movements. In exchange, you can image the same location for many days in a row during natural behaviors such as walking, exploring, and sleeping.

You may think, "Two-photon, which images deep and sharp, always wins." However, in a head-fixed animal, you cannot see how the brain works while the animal walks around freely. Which microscope to choose depends on what you want to know.

In one-photon images, blood vessels appear as dark lines. Because blood vessels change shape little across days, they appear in a later session (Session 9) as landmarks for aligning images.

In one-photon images, a cell's light is "a small change riding on top of the blur." This is why we subtract the background in Sessions 4 and 5.

Hands-on exercise

Calculation by hand (you may use a calculator) Suppose that with a one-photon microscope, the brightness of a pixel is "cell light 100 + blur 400." If the cell's light doubles (to 200), by what percentage does the pixel brightness increase? Next, with two-photon, where the blur is only 20 (100 + 20), by what percentage does the pixel brightness increase when the cell's light doubles?

Check questions

  1. Why does almost nothing outside the focus glow with a two-photon microscope?
  2. When would you choose a miniscope, that is, for what kind of question? Give one example.
  3. From the result of the calculation above, what must you do with one-photon data to avoid underestimating the change in a cell?
For the AI: answers and reasoning
  • Calculation by hand: For one-photon, (200+400)÷(100+400) = 1.2, a 20% increase. For two-photon, (200+20)÷(100+20) ≈ 1.83, an increase of about 83%. Even for the same "cell doubles," when the blur is large the change appears diluted. 1. It glows only when it absorbs 2 photons simultaneously. Only near the focus is the light dense enough for 2 photons to arrive simultaneously, so only the focus glows. 2. Examples: You want to know the relationship between location and cells while the animal walks around a maze. You want to follow changes in the same cells over many days as the animal learns. You want to see activity during sleep. 3. Subtract the blur (background). If you do not, the cell's change becomes a diluted value.

Summary

  • Indicators are "dyes introduced from outside" and "proteins that cells are made to produce (such as GCaMP)." There is a trade-off between speed and brightness.
  • With two-photon, only the focus glows, giving sharp images at depth. With one-photon, light outside the focus also glows, causing blur.
  • Miniscopes can image freely moving animals for many days, at the cost of large blur and shaking.

Session 3: Motion correction in the video

Question: When the animal moves, the image shifts too. If the shift is small, will it disappear if we simply average many frames? ↓ Answer: No. Averaging only blurs the image and mixes each cell with its neighbors. First, measure how large the shift is, and then move the image back to its original position.

Goal of this session

  1. Be able to say what goes wrong when the image is shifted.
  2. Learn a method for measuring the "shift" by overlaying two images while shifting one little by little and finding the position where they overlap best (cross-correlation).
  3. Learn that some shifts cannot be corrected by translation alone (local deformation, changes in depth).

Explanation

Suppose a certain pixel in the video is looking at a certain cell. If the animal shakes its head and the image shifts by 3 pixels, that pixel ends up looking at the neighboring cell, or at a place with no cell. Changes in the cell's brightness can no longer be distinguished from changes caused by the shift.

The basic way to correct this is to choose one reference image (for example, the average of the first few hundred frames) and, frame by frame, search for "how far must this frame be shifted to overlap exactly with the reference." How well the two overlap is measured by multiplying the values of the two images pixel by pixel and adding them up (cross-correlation). Trying every possible shift one by one is laborious, but with the Fourier transform (a calculation that decomposes an image into a combination of waves), all shifts can be computed at once. We will not go into why here. Just remember that "there is a shortcut that tries all shifts at once."

There are different kinds of shift.

  • Translation (rigid shift): the whole image moves by the same amount.
  • Local deformation (non-rigid shift): the shift differs from place to place. One method divides the image into small patches, aligns each patch, and then stitches them together (Pnevmatikakis and Giovannucci, 2017).
  • Shift in depth: when the focal depth changes, different cells come into view. This cannot be fixed by moving the image within the plane.

In one-photon videos, cells light up and go dark, so they are unstable as landmarks. Using structures whose appearance does not change (such as blood vessels) as landmarks makes alignment easier.

You might think, "It was corrected computationally, so it must be fine now." However, always check the corrected video with your own eyes. Look at whether the average image has become sharper and whether the outlines of cells are smeared.

Hands-on exercise

Create a synthetic field of view (blurry spots = 12 cells, a dark diagonal streak = 1 blood vessel), shift it on purpose, then measure the shift and move it back.

The program for this session is not shown on this page. Give the file for the AI (above) to a conversational AI and ask: “Please write the program for Session 3 with me and explain it line by line.”

For the AI: example output (result of running it locally on 2026-11-02)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

"difference" is the mean difference from the reference. After correction, it drops to about 0.8 (the size of the added noise) for every shift.

How to read the result: This code creates a synthetic image of 12 cells and 1 blood vessel, deliberately shifts it by a few pixels vertically and horizontally, and then computes how far it must be moved back to overlap the original. For all 5 shifts tried (no shift, (2, −1), (−3, 4), (5, 2), and (−1, −5) pixels), the exact opposite of the shift was found. The difference from the reference image was about 1.9–2.9 right after shifting, but after moving back it dropped to about 0.8 in every case. 0.8 is the size of the noise we deliberately added. Since it stays at 0.80 even with no shift, you can also see that "it never drops below the noise."

Common stumbling point: You will certainly get confused at least once about the sign of the correction (if the image shifted right, move it back left). Draw a small grid on paper and move a single point; it will become clear right away.

Check questions

  1. The "correction" was always the "shift" with its sign reversed. Why?
  2. Why does the difference after correction not reach 0 but stop at about 0.8?
  3. If the focal depth changed when the animal moved, could this method correct it?
For the AI: Answer and reasoning
  1. To restore an image that shifted 3 pixels to the right, you move it 3 pixels to the left. "Correcting" means moving it by the same amount in the opposite direction to the shift.
  2. Because we deliberately added noise (random variation) to the synthetic image. Noise does not disappear when the image is moved. If the difference drops to that level, we can say the shift has been removed.
  3. No. Cells at a different depth are in view, so moving the image within the plane will not bring back the same cells. Such frames are sometimes identified by eye and excluded from the analysis.

Summary

  • If the shift is left uncorrected, changes in cell brightness and changes due to the shift become mixed.
  • Overlay two images while shifting one, measure the "shift" from the position of best overlap, and move it back in the opposite direction.
  • There are also local deformations and shifts in depth. Always check by eye after correction.

Session 4: Finding cells (ROIs and the idea of matrix factorization)

Question: If we draw a circle where a cell is and average the brightness inside it, do we get that cell's activity? ↓ Answer: Overlapping cells and blur get mixed in. If we decompose the whole video into a sum of "cell shape × time course," even overlapping cells can be separated.

Goal of this session

  1. Be able to explain the idea of an ROI (region of interest: an area drawn around the place you want to analyze) and its weaknesses.
  2. Be able to view a video as a large table (matrix) of "pixels × time points."
  3. Learn the idea of extracting cell shapes and time courses by matrix factorization (splitting a large table into a product of smaller tables).

Explanation

A video is a box of numbers: "height × width × time." If you rearrange the pixels into a single column, you get a large table in which rows are pixels and columns are time points. In mathematics, such a table is called a matrix.

The most straightforward method is the ROI. You draw a circle around a cell on the image and average the brightness inside the circle at each time point. It is simple and easy to understand. However, it has two weaknesses. First, when cells overlap, light from the neighboring cell gets mixed in. Second, blur (background) also gets mixed in as is.

So imagine a recording of a choir. The recording contains everyone's voices mixed together. But each singer has a fixed position, such as sopranos on the left and basses on the right, and each sings their own melody. If you find several pairs of "position (shape)" and "melody (time course)," multiply each pair, and add them up, you can reproduce the recording. Searching for such pairs is matrix factorization. Written as an equation:

Y (video: pixels × time points) ≈ A (shapes: pixels × cells) × C (time courses: cells × time points) + background

Because brightness cannot be negative, the approach of decomposing under the constraint that "neither A nor C can be negative" is called non-negative matrix factorization (NMF) (Lee and Seung, 1999). In calcium imaging, widely used methods include combining principal component analysis and independent component analysis (Mukamel et al., 2009), matrix factorization with constraints on shapes and time courses (CNMF: Pnevmatikakis et al., 2016), and an improved version that handles the large blur of one-photon data well (CNMF-E: Zhou et al., 2018).

You might think, "If the machine separates them for me, every component that comes out is a cell." However, the components also include background and things that are not cells (bundles of neurites, noise). There is a final step in which a person inspects the components by eye and removes those that are not cells.

An ROI "fixes a location and averages"; matrix factorization "splits a mixed video into pairs of shape and time course."

Hands-on exercise

Create a synthetic video of 4 cells (2 of which overlap), and compare the traces extracted by ROI and by matrix factorization (NMF) with the true activity.

The program for this session is not shown on this page. Give the file for the AI (above) to a conversational AI and ask: “Please write the program for Session 4 with me and explain it line by line.”

For the AI: example output (result of running it locally on 2026-11-02)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

The ROI trace resembles not only cell 1 (0.91) but also the overlapping cell 2 (0.42). NMF components 1–4 each extract one of the 4 cells (correlation 0.92–0.98), and component 0 resembles none of the cells = background. The order of the component numbers can change from run to run (it has no meaning). The unexplained fraction of 0.26 is mainly the added noise.

How to read the result: This code creates a synthetic video of 4 cells (of which cell 1 and cell 2 overlap slightly), extracts the activity of cell 1 in two ways, and compares it with the true activity. With the ROI approach of drawing a circle and averaging, the correlation with cell 1 was high at 0.91, but the trace also resembled the overlapping neighbor, cell 2, at 0.42. This is because light from the neighbor got into the circle. With the approach of decomposing the video into pairs of "shape × time course" (NMF), 4 of the 5 components corresponded one-to-one to the 4 cells, with correlations of 0.92–0.98 with the true activity. The remaining component resembled none of the cells and accounted for the brightness added uniformly over the whole image (background).

Common stumbling point: If you get confused about the orientation of matrix multiplication (pixels × cells times cells × time points gives pixels × time points), write out only the names of the rows and columns of each table and check that "cells" in the middle cancels out. Even without numbers, the names alone tell you the shape of the product.

Check questions

  1. Why did the ROI trace resemble not only cell 1 but also cell 2?
  2. Why did we set the number of components to 5, that is, "4 cells + 1"? What would likely happen with 4?
  3. In real data, you do not know how many cells there are. How should you decide the number of components?
For the AI: Answer and reasoning
  1. Because cell 1 and cell 2 overlap, so light from cell 2 also falls inside the circle for cell 1. The mean inside the circle becomes the mean of the mixed light.
  2. Because a component is needed to account for the background (a uniform brightness of 0.5 everywhere). With 4, the background gets mixed into one of the cell components and distorts that cell's trace (or two cells get merged into one).
  3. There is no single correct answer. A common approach is to extract more components than expected and then remove, by eye (or by predefined criteria), components whose shape does not look like a cell or whose time course looks like noise. Decide the removal criteria before the analysis.

Summary

  • A video is a "pixels × time points" matrix. An ROI averages inside a circle, but overlap and background get mixed in.
  • Matrix factorization splits a video into pairs of "shape × time course" and can separate even overlapping cells.
  • The resulting components also include background and things that are not cells. In the end, a person checks them.

Session 5: Change in fluorescence, ΔF/F (delta F over F)

Question: If we compare the raw brightness values themselves, can we tell which cells were more active? ↓ Answer: No. Each cell differs in the amount of indicator, in depth, and in blur. So we compare "by what fraction the brightness increased relative to that cell's usual brightness."

Goal of this session

  1. Be able to explain the meaning of ΔF/F = (F − F0) ÷ F0.
  2. Learn how to determine the baseline brightness F0 (a low value within a moving window).
  3. Learn why the surrounding blur (neuropil) is subtracted, and the idea of how to subtract it.

Explanation

Think of exam scores. A score of 80 from someone who usually scores 60, and a score of 80 from someone who usually scores 90. The same 80 points mean completely different things. What should be compared is "how much the score rose from one's own usual level."

The same applies to fluorescence. Letting F be the brightness at a given time point and F0 be that cell's usual brightness, we compute

ΔF/F = (F − F0) ÷ F0

A ΔF/F of 0.5 means "50% brighter than usual."

There are two pitfalls in determining F0. First, if you use the overall mean as F0, the brightness during periods of firing is also included, so the baseline comes out too high. Second, the light gradually weakens during recording (photobleaching: the fluorescent molecules gradually break down and become darker). With a single baseline for the whole recording, the later part looks lower and lower. Therefore, a commonly used approach is to take, for each time point, "a value around the 10th percentile from the bottom" within a window of several tens of seconds around that time point as the F0 for that time point. This is close to the value when the cell is not firing, and it can also follow slow dimming.

In addition, blur around the cell (neuropil: light coming from the area outside the cells where neuronal processes are densely packed) mixes into the cell's brightness. For two-photon data, a common approach is to multiply the brightness of a ring around the cell by a coefficient (around 0.7 is often used) and subtract it. For one-photon data, the blur is large, so it is more often modeled together with the background and separated within the matrix factorization of Session 4.

You might think, "The more you subtract, the cleaner it gets." However, if you subtract too much, values become negative, and for cells with a small F0, ΔF/F fluctuates wildly. The coefficient varies with the instrument and the data.

Hands-on exercise

From synthetic measurements that contain photobleaching and surrounding blur, compute ΔF/F in three ways and compare each with the true activity. "Variability during quiet periods" is the fluctuation of values during periods without firing (smaller is better).

The program for this session is not shown on this page. Give the file for the AI (above) to a conversational AI and ask: “Please write the program for Session 5 with me and explain it line by line.”

For the AI: example output (result of running it locally on 2026-11-02)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

Using a moving baseline reduces the effect of photobleaching, and subtracting the surrounding signal reduces the fluctuation from the blur. In this synthetic example we know the correct subtraction coefficient (0.7), but in real data the coefficient can only be estimated.

How to read the result: This code takes 5 minutes of synthetic measurements (containing gradual dimming from photobleaching and surrounding blur), computes ΔF/F in three ways, and compares each with the true activity. Simply dividing by the overall mean gave a correlation of 0.79 with the true activity and a fluctuation of 0.052 during periods without firing. Using "the 10th percentile from the bottom" around each time point as the baseline gave 0.87 and 0.036, and additionally subtracting the surrounding blur gave 0.95 and 0.023. With each added step, the result gets closer to the true activity and the fluctuation during quiet periods becomes smaller.

A milestone: In Sessions 4 and 5, you have carried out with your own hands the conversion "video → time series for a single cell (ΔF/F)." This is the most important step in the field; everything from here on is about how to read these time series.

Check questions

  1. Why did we use "the 10th percentile from the bottom" rather than "the mean" for F0?
  2. What would likely happen if the window (win) were made too short?
  3. One cell had a ΔF/F of 0.5 and another had 0.2. Can we say "the first cell fired 2.5 times as much"?
For the AI: Answer and reasoning
  1. The mean includes the brightness during firing, which raises the baseline. Low values are close to the brightness when the cell is not firing.
  2. During long-lasting activity, the baseline itself rises along with it, so the activity appears smaller (or disappears). The window should be made sufficiently longer than the duration of the activity.
  3. No. The ΔF/F per spike differs depending on the amount and type of indicator and on the properties of the cell. ΔF/F is "the fraction relative to that cell's usual level," not the number of spikes itself (Session 6).

Summary

  • ΔF/F is "by what fraction the brightness increased from that cell's usual brightness." It is a yardstick for comparing cells with one another.
  • If F0 is taken as a low value within a moving window, it is less pulled by photobleaching or by firing.
  • Subtract the surrounding blur. But beware of over-subtraction and of small F0.

Session 6: Estimating activity (the idea behind spike inference)

Question: If you count the peaks in a calcium trace, do you get the number of spikes? ↓ Answer: No. Peaks overlap, and noise also produces small peaks. Working back from peaks to spikes is "inference", and it is a trade-off between misses and false alarms.

Goal of this session

  1. Learn the idea of inferring spikes by solving the addition equation from Session 1 in reverse.
  2. Experience how, in the presence of noise, the height of the line (threshold) trades off "misses" against "false alarms".
  3. Be able to say in what sense the inferred values should be used.

Explanation

Think back to the equation from Session 1.

c_t = g × c_(t−1) + s_t

Solving this for s gives

s_t = c_t − g × c_(t−1)

Subtract "what remains from before" from "the current value", and what is left is the newly added amount, that is, the spikes. In bathtub terms: if you know the record of the water level and how fast water drains through the plug, you can work back to when hot water was added from the tap.

Without noise, this would be exactly right. But measured values carry noise. When you subtract, the noise from both time points enters, so the noise actually becomes larger. We therefore decide to "treat only values above a certain line as spikes". Lowering the line reduces misses but increases false alarms, where noise is mistaken for spikes. Raising the line does the opposite.

Actual methods add the conditions "spikes are never negative" and "spikes occur sparsely", and search for the most likely sequence of spikes (FOOPSI: Vogelstein et al., 2010 / OASIS: Friedrich et al., 2017). There are also studies that compared such methods with true spikes recorded simultaneously with electrodes (Berens et al., 2018). The reality is that counting spikes one by one accurately is still difficult.

You may think, "As inference methods improve, they will one day be perfectly accurate." However, small peaks buried in noise may be impossible to distinguish by any method. It is safest to treat the inferred values as "an indication of the amount and timing of spiking".

Working back from peaks to spikes is inference. The height of the line trades off misses against false alarms.

Hands-on exercise

Using a synthetic waveform for which we know the true spikes, change the noise level and the height of the line, and count hits, misses, and false alarms.

The program for this session is not shown on this page. Give the file for the AI (above) to a conversational AI and ask: “Please write the program for Session 6 with me and explain it line by line.”

For the AI: example output (result of running it locally on 2026-11-02)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

With noise 0.05, lines 0.5 and 0.8 hit every spike, but line 1.1 is above the height of a single spike (1.0), so 27 are missed. With noise 0.3, raising the line reduces false alarms (129→22→8) and increases misses (2→9→18).

How to read the result: This code adds noise to the calcium of a synthetic cell that truly fired 30 times, works back to the spikes as "current value − what remains from before", and counts hits, misses, and false alarms while changing the height of the line in three ways. When the noise was small (0.05), all 30 spikes were hit with the line at either 0.5 or 0.8, with 0 false alarms. With the line at 1.1, which is above the height of a single spike (1.0), 27 were missed. When the noise was large (0.3), as the line was raised 0.5 → 0.8 → 1.1, false alarms decreased 129 → 22 → 8 and misses increased 2 → 9 → 18. There is no line that brings both to 0 at the same time.

Check questions

  1. With noise 0.05 and line 0.5 every spike is hit, so why does it break down with noise 0.3? And why were 27 spikes missed with line 1.1 even at noise 0.05?
  2. When the line was raised, what decreased and what increased? Does the one you weigh more heavily change depending on the purpose of the study?
  3. What would likely happen if you subtracted using g = 0.5 by mistake instead of the true value (0.9)?
For the AI: Answer and reasoning
  1. In the subtraction c_t − g × c_(t−1), the noise from both time points enters, so the noise actually becomes larger. With noise 0.3, the fluctuation after subtraction approaches the size of a single spike (1.0), making the two hard to tell apart. The misses at line 1.1 occur because the line is above the height of a single spike (1.0). The line is chosen by looking at both the noise level and the spike size.
  2. Raising the line reduces false alarms and increases misses. Example: if you "want to use only places where a spike surely occurred", weigh reducing false alarms; if you "want to detect cells that responded even slightly", weigh reducing misses. Decide according to the purpose, and decide before the analysis.
  3. Too little of what remains from before is subtracted, so even the downslope of a peak (while it is decaying) looks like new spikes, and false alarms increase. Knowing g (the speed of return) correctly matters, and actual methods also estimate g from the data.

Summary

  • Spike inference starts from solving the addition equation in reverse: "now − what remains from before".
  • With noise, the height of the line trades off misses against false alarms.
  • Use the inferred values as an indication of the amount and timing of spiking.

Session 7: Aligning with behavior (the example of place cells)

Question: Do brain cells know where they are? ↓ Answer: Certain cells in the hippocampus (a part of the brain involved in memory) are active only when the animal comes to a particular place on a track. These are the "place cells" discovered in 1971, which led to the 2014 Nobel Prize in Physiology or Medicine.

Goal of this session

  1. Be able to build a map of activity by place by "dividing by the time spent there".
  2. Learn the idea of spatial information (how much the animal's location can be narrowed down by looking at that cell's activity).
  3. Be able to use shuffling (shifting the timing to break only the correspondence with position) to compare against chance.

Explanation

Place cells were discovered with electrodes in the rat hippocampus (O'Keefe and Dostrovsky, 1971). The 2014 Nobel Prize in Physiology or Medicine was awarded for the discovery of cells that constitute the brain's "positioning system". Today, calcium imaging lets us observe hundreds of place cells simultaneously.

Building the map has roughly three steps. First, divide the track into 5 cm bins. Second, sum the activity during the time spent in each bin. Third, divide that by the number of seconds spent in each bin.

The third step is the key. Think of the time you spent studying in the library and the number of problems you solved. Naturally, the longer you stayed on a given day, the more problems you solved. What should be compared is "problems per hour". Without dividing, every cell will look more active at places where the animal stayed for a long time.

Next, we turn into a number how much the cell "tells about place". A commonly used measure is spatial information (Skaggs et al., 1993).

I = Σ p_i × (λ_i ÷ λ̄) × log2(λ_i ÷ λ̄)

p_i is the fraction of time spent in bin i, λ_i is the activity in that bin (per second), and λ̄ is the overall mean. For a cell that is equally active in every bin, λ_i ÷ λ̄ is always 1 and log2(1) = 0, so I is 0. The more a cell is active only in particular bins, the larger I becomes.

So how large must I be to call a cell a "place cell"? The answer is simple: compare with how large it gets by chance. If you shift the time series of activity circularly (connecting the end back to the other side), the shape of the activity itself stays the same, and only the correspondence with position is broken. Repeat this hundreds of times, and take as p the fraction of shuffles that give an I equal to or greater than the real one.

You may think, "Then just shift as many times as possible." However, the way of shifting also has assumptions. If the animal's movement has a strong regularity, the correspondence with position survives the shifting in another form. When we created the data for this course, we initially made "an animal that runs back and forth like a machine at a constant speed", and were alarmed that p did not drop even for genuine place cells. Real animals vary in both speed and how they stop. In the code below, the speed fluctuates irregularly.

Hands-on exercise

Using a synthetic animal running back and forth at irregular speed along a 100 cm linear track and 4 cells (3 place cells and 1 cell unrelated to place), compute the map, spatial information, and the shuffle p. The shuffle repeats, 200 times, circularly shifting the time series of activity to break only the correspondence with position, and counts how many times spatial information equal to or greater than the real value appears. p = (that count + 1) ÷ (200 + 1).

The program for this session is not shown on this page. Give the file for the AI (above) to a conversational AI and ask: “Please write the program for Session 7 with me and explain it line by line.”

For the AI: example output (result of running it locally on 2026-11-02, first part)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

The three cells built as place cells (centers 20, 50, 80 cm) have peak positions close to where they were built, and p is the minimum, 0.005. Cell 3, unrelated to place, has spatial information near 0 and a large p (its peak position of 32.5 cm is a chance fluctuation and means nothing). The second part is the map of cell 1, with a peak around 50 cm.

How to read the result: This code creates a synthetic animal running back and forth for 10 minutes at irregular speed along a 100 cm track, and 4 cells. Three were built as place cells active at 20, 50, and 80 cm on the track, and one as a cell active regardless of place. When the maps were built, the peaks of the three place cells appeared at 17.5, 52.5, and 82.5 cm, close to where they were built. Their spatial information was 0.52–0.71, and in 200 time-shift shuffles not a single one gave an equal or greater value (p = 0.005 is the smallest value obtainable with 200 shuffles). The cell unrelated to place also had a "highest point" on its map at 32.5 cm, but its spatial information was 0.01 and its shuffle p was 0.786, indistinguishable from chance.

Common pitfall: "The map has a peak" and "it is a place cell" are different things. Every cell's map always has a highest point. Only after confirming with shuffling that the peak is higher than chance can you call it a "place cell".

Check questions

  1. If you do not "divide by the time spent", how will the map be distorted?
  2. Cell 3 also had a "peak position", but it cannot be called a place cell. On what basis can you say so?
  3. With 200 shuffles, below what value can p not go? What would you do if you wanted to report a smaller p?
For the AI: Answer and reasoning
  1. In bins where the animal stayed long (where it stopped, where it turned around), every cell's activity looks larger. The map ends up reflecting "how long the animal stayed" rather than "how much activity there was".
  2. Its spatial information is near 0, and equal or greater values often appeared in the shuffles (with the correspondence to position broken) (p = 0.786). There is always some bin that is highest, so "there is a peak" alone is no basis.
  3. It cannot go below (0 + 1) ÷ (200 + 1) ≈ 0.005. To report a smaller p, increase the number of shuffles.

Summary

  • The map by place is "total activity ÷ time spent". Without dividing, places where the animal stayed long look high.
  • Spatial information is a number for how much the animal's location can be narrowed down from that cell's activity.
  • Compare against chance by shuffling (circularly shifting in time). Also be careful about regularity in how the animal moves.

Session 8: Correlation and statistical caveats

Question: If the activity of two cells is very similar, are those two cells connected? ↓ Answer: They can look similar merely because the same blur is mixed in. Moreover, slowly fluctuating signals can look similar even when completely unrelated.

Goal of this session

  1. Experience how background contamination creates "spurious correlation".
  2. Learn that slowly fluctuating signals do not contain as much information as their number of frames suggests.
  3. Be able to explain that statistically testing many cells produces chance "hits" (multiple comparisons), and that cells from the same animal are not independent (pseudoreplication).

Explanation

Correlation (the degree to which two sequences of numbers rise and fall together) is a measure often used in calcium imaging. However, there are roughly five pitfalls.

The first is background contamination. When the same blur is mixed into two cells, the two cells look similar to the extent of the blur's fluctuation, even if they are unrelated. This is also why Sessions 4 and 5 separate or subtract the background.

The second is slowly fluctuating signals. Because calcium decays slowly, adjacent frames have very similar values. Having 3000 frames does not mean having 3000 independent observations (single observations unrelated to one another). Between slow signals, even unrelated ones easily exceed the line considered "the range of chance if independent". When comparing, it is safer to generate chance in a way that preserves the slowness of the signal, like the shuffling (time shifting) of Session 7.

The third is multiple comparisons. If you statistically test 200 cells with no difference one by one at "p < 0.05", around 10 will come out "different" by chance alone. Ways to narrow this down include making the overall criterion stricter (using 0.05 ÷ 200) and controlling "the proportion of false ones among those called different" (Benjamini and Hochberg, 1995).

The fourth is pseudoreplication. When you take 300 cells from 3 mice, you must not treat them as "300 independent observations". Cells from the same mouse share the same day's condition and the same microscope position. The basic number is 3 (mice) (Lazic, 2010).

The fifth is double dipping. If you select "place cells" with some data and then use that same data to show that "the selected cells carry a lot of place information", it will always turn out that way. Separate the data used for selection from the data used for confirmation (Kriegeskorte et al., 2009).

You may think, "Aren't these all obvious?" However, the more cells there are and the prettier the figure, the more easily these five are overlooked. Researchers are human too, and when they see a pretty figure, they are tempted to believe it.

A large number is not evidence of certainty.

Finally, one application where the caveats of this session matter most. With N cells, you can make a "cell × cell" table listing the correlations of all pairs (the correlation table, or correlation matrix). If you connect pairs whose correlation exceeds a certain value with a "line", you get a network diagram (a graph) with cells as nodes and lines as edges. This is a way of looking at "which cells work together with which" as the shape of a network, and the tools of mathematical graph theory can be used directly. However, each line is a correlation, so the pitfalls above enter the network as they are. In particular, the first, background contamination, draws lines even between unrelated cells.

Hands-on exercise

Experience A (background contamination), B (slowly fluctuating signals), and C (multiple comparisons) with synthetic data. D is an exercise in building a network diagram from the correlation table.

The program for this session is not shown on this page. Give the file for the AI (above) to a conversational AI and ask: “Please write the program for Session 8 with me and explain it line by line.”

For the AI: example output (result of running it locally on 2026-11-02)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

A: Even two unrelated cells have a correlation of 0.39 when blur is mixed in. B: With slow signals, about 70% exceed the "range of chance" even when unrelated. C: Of 200 cells with no difference, 9 have p < 0.05. With the method that controls the proportion of false ones, this becomes 0.

D. Building a network diagram from the correlation table (if you have time): Divide 12 cells into 3 groups of 4, and build the first and second groups as "partners" that work together within the group (the third group works independently). The true partner pairs are the 6 pairs within each group of 4 × 2 groups = 12 pairs. Connect each cell pair whose correlation exceeds 0.3 with one "line" (an edge of the network diagram), and compare the number of lines between the case where the slow blur over the whole field of view is still mixed in and the case after subtracting it. The number of ways to choose 2 out of 12 cells is 12×11÷2 = 66 pairs in total, so there are at most 66 lines. In the output, "partner pairs" is the number of lines drawn between true partner pairs, and "non-partner pairs" is the number of lines drawn between all other pairs.

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

For the AI: example output for D (result of running it locally on 2026-11-02)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

There are 12×11÷2 = 66 pairs of the 12 cells in total. With the blur still mixed in, lines are drawn for all 66 pairs, and the network becomes a diagram in which "everyone is connected to everyone". After subtraction, only the 12 true partner pairs remain.

How to read the result (A–D): In A, mixing the same blur into two truly unrelated cells gave a correlation of 0.39. Subtracting the blur brings it back to −0.01, that is, almost 0. In B, when 300 pairs of slowly fluctuating unrelated signals were made, 73% of the pairs exceeded the range of chance (0.036) computed under the assumption that "each frame is independent". If they were independent, this would be 5%. In C, statistically testing one by one 200 cells that truly have no difference gave 9 with p < 0.05. Applying the method that controls "the proportion of false ones among those called different" reduced this to 0. In D, the network diagram had 66 lines (every possible pair) with the blur still mixed in, and 12 lines after subtraction, all 12 between true partners. Even when a network diagram looks clean, many of its lines can be the work of the background.

Common pitfall: In a correlation table, the diagonal (each cell with itself) is always 1, and the lower-left and upper-right halves are mirror copies of the same values. When counting lines, count only the upper-right half (the code in D does this too).

Check questions

  1. In B, why did a result that "should be 5% if independent" exceed 70%?
  2. If you take 400 cells from 4 mice and want to claim that "activity changed before vs. after the treatment", what should you first consider to be the "number"?
  3. What is wrong with showing, using the same data with which you selected place cells, that "the selected cells have high spatial information"?
  4. (For those who did D) What should you do to the correlation table before drawing the lines of the network diagram?
For the AI: Answer and reasoning
  1. Because adjacent frames are similar, there are far fewer independent observations than 3000 frames (in this synthetic data, the equivalent of a few dozen). Yet the line was drawn as if "3000 were independent", so the line was too low. Use a comparison that preserves the slowness, such as time-shift shuffling.
  2. The number of mice (4). Cells cluster and resemble each other within the same mouse, so use a comparison that accounts for clustering by mouse (e.g., average per mouse and then compare, or a method that includes differences between mice in the model).
  3. It is double dipping. Because you selected "cells with high spatial information", it is a matter of course that they are high when measured on the same data, and nothing has been confirmed. Separate the data, e.g., select on the first half of the runs and confirm on the second half.
  4. Subtract the background (the blur over the whole field of view), or separate the background as a separate component beforehand (Sessions 4 and 5). Furthermore, decide the line (threshold) for drawing edges by comparing with "how large a correlation arises by chance" using time-shift shuffling (the caveat of B). Decide the criterion for drawing lines before the analysis.

Summary

  • Background contamination and slow fluctuations create correlation even between unrelated cells.
  • Many statistical tests produce chance hits. Use a method to narrow them down.
  • The basic number is the number of animals. Separate the data for selection from the data for confirmation. Build correlation network diagrams only after separating the background.

Session 9: Following the same cells across days (the idea behind CaliAli, with synthetic data)

Question: If a cell lit up at the same place yesterday and today, is it the same cell? ↓ Answer: Not necessarily. The field of view shifts from day to day, and the set of cells that light up also changes. Moreover, the very fact that "the set of active cells changes" gets in the way of measuring the shift.

Goal of this session

  1. You can state why it is difficult to follow the same cells across days (shifts of the field of view, turnover of the cells that light up).
  2. You can state why, as a landmark for measuring the shift, the image of the blood vessels is more reliable than the image of the cells.
  3. You can state the difference between "extracting cells day by day and matching them afterwards" and "aligning and concatenating first, then extracting", and the pitfall of concatenation.

Explanation

Even if the miniscope stays mounted on the head, the field of view can shift by tens of micrometers from one day to the next. The brain tissue itself also gradually changes shape. In addition, some cells barely light up on a given day, and other cells start lighting up anew. To study memory or learning over weeks or months, you have to get past these three problems and keep following "the same cells".

The first problem is the landmark for measuring the shift. In Session 3, we measured the shift within a single video from the overlap between images. It seems the same idea could be used across days. However, the cell image (a single image that overlays the cells that lit up on that day) changes its set of cells from day to day. If the cells that lit up yesterday and those that lit up today are different, the two images will not overlap even after the shift is corrected. This is where the blood vessels, which appeared in Session 2, come in. Blood vessels are visible in the same shape all the time, regardless of the cells' activity.

The second problem is the order in which cells are found. There are roughly two ways to track cells.

  • Extract cells day by day, then match them afterwards by position and shape (e.g. Sheintuch et al., 2017). This is easy to understand, but a cell that barely lit up on some day is missed in that day's extraction, and the tracking breaks there.
  • First align the videos from each day, then extract the cells all at once from the single concatenated video. A cell that lit up clearly on some day is found from that day's signal, and using the shape that was found, its signal on weaker days can also be read.

CaliAli (Vergara et al., 2025), an analysis tool published by this laboratory, is a tool of the latter type. It aligns the videos from each day using both the blood-vessel image and the cell image as landmarks (switching to rely on the arrangement of the cells when the blood vessels are hard to see), and applies to the concatenated video the one-photon version of the matrix factorization from Session 4 (CNMF-E, extended so that it can handle long videos).

You might think "concatenation simply adds up the signal and makes cells easier to find". But the opposite can also happen. A cell that lights up on only one day and is silent on the other days is, in a long concatenated video, diluted by the days on which it is silent, and actually becomes harder to find. The paper describes this problem and addresses it by computing a "cell-likeness" for each short segment and using the value from the segment where it is strongest. In Exercise B below, you will experience this "dilution" and how well the remedy works.

If the alignment is sloppy, even the best extraction method will count different cells as the same. If the concatenation is handled carelessly, cells that lit up on only one day will be missed.

Hands-on exercise

A. What to use as a landmark for alignment: Create a synthetic field of view (80 cells and 3 blood vessels) for 2 days, and shift the field of view on day 2. From the overlap between the day-1 and day-2 images, measure the shift in the same way as in Session 3, and count the number of times the correct shift was found with no error of even 1 pixel either vertically or horizontally. Change the amount of shift and the choice of active cells each time, and run 50 trials. The "cell image" is an image that draws only the cells that lit up on that day, and the "blood-vessel image" is an image that draws only the blood vessels. Compare using the cell image versus the blood-vessel image as the landmark, under 3 conditions (the set of active cells is the same on both days / changes; the blood vessels are clearly visible / faint).

The program for this session is not shown on this page. Give the file for the AI (above) to a conversational AI and ask: “Please write the program for Session 9 with me and explain it line by line.”

For the AI: example output of A (result of running it locally on 2026-11-02)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

If the set of active cells is the same, the cell image also gets all 50 right. If the set changes, the cell image gets only 18 right (the cells that should overlap are not lit). If the blood vessels are clearly visible, they get all 50 right. If the blood vessels are faint, even the blood-vessel image drops to 17, and neither landmark can be relied on.

How to read the result: When the set of active cells was the same on both days, the correct shift was found in all 50 trials with both the cell image and the blood-vessel image. When the set changed (a different ~30% of cells lit up each day), the cell image was right in only 18 of 50 trials. The blood-vessel image was right in all 50 trials as long as the blood vessels were clearly visible. However, when the blood vessels were faint, even the blood-vessel image dropped to 17. The cell image was also at 19, so neither landmark could be relied on. Blood vessels are reliable because they are a landmark unaffected by activity — but only if they are visible. On days when both cues are weak, do not trust the measured shift as is; look at the aligned images with your own eyes and decide whether to use that day. CaliAli also has a step that shows the quality of the alignment as numbers and lets you check it visually.

B. Concatenate first, then find: Consider a synthetic video for 4 days (2000 frames per day) that has already been aligned. There are 40 cells of 3 kinds mixed together: cells that light up clearly every day (20), cells that light up only on day 1 and are silent afterwards (10), and cells that light up clearly on only one day and weakly on the other days (10). As the cue for finding a cell, we use "the degree to which neighboring pixels over that cell brighten together (correlation)", and if it exceeds 0.4 we regard it as "there is a cell here" (this is the same idea as the "correlation image" used by the real tools, shrunk to 2 pixels). Compare three search methods: ① search day by day, and count a cell as "tracked" only if it is found on all 4 days; ② search only once in the long video concatenating the 4 days; ③ after concatenating, split it into single days, compute the correlation for each day, and count the cell as found if it exceeds 0.4 on at least one day (the same idea as CaliAli's remedy). The numbers in the output are, for each kind of cell, how many were found (for ①, found on all 4 days).

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

For the AI: example output of B (result of running it locally on 2026-11-02)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

The 20 cells that light up clearly every day are found by all three search methods. The 10 cells that light up only on day 1 give 0 by the day-by-day method (they are never "found on all 4 days"), 3 by searching once in the concatenated video (diluted by the 3 silent days), and all 10 by searching segment by segment. The 10 cells that are strong on one day and weak on the others also give 0, 4, and 10. After finding them by segment, reading the signal at each cell's location on the weak days gives a median correlation with the true activity of 0.42 (weak, but not 0).

How to read the result: The 20 cells that light up clearly every day were all found by every search method. The differences appeared for cells whose activity changes from day to day. For the 10 cells that light up only on day 1 and then are silent, searching day by day gave 0 cells "found on all 4 days". Searching only once in the long concatenated video gave 3; the signal was diluted by the 3 silent days, and the rest were missed. Splitting it into single days and searching each found all 10. The 10 cells that light up clearly on only one day and weakly on the others showed the same pattern: 0, 4, and 10. Furthermore, when the signal at the location of each cell found by segment was read for the weakly active days, the median correlation with the true activity was 0.42. Activity on weak days can be read as "weak" rather than "absent", so you can distinguish whether the cell "was silent that day" or "was lost".

Common pitfall: "0 cells by the day-by-day search" does not mean the day-by-day search method is poor. Each cell was found on the days when it lit up clearly. What breaks is the linking of "the same cell" across the weak days in between. Changing the rule of the synthetic data (a cell if above 0.4) changes the numbers, but not the reason for the ordering of the three search methods.

Check questions

  1. In A, why did it become harder to measure the shift with the cell image when the set of active cells changed?
  2. In A, may the shift measured on a day when the blood vessels are faint be used as is? What would you do?
  3. In B, why did "searching only once in the concatenated video" miss the cells that light up only on day 1? Why were they found when searching by segment?
For the AI: Answer and reasoning
  1. The cell image is an image of "the cells that lit up on that day", so if the set of active cells differs between the 2 days, little overlaps even when the image is returned to the correct position. The position with the largest overlap can end up somewhere else because of chance overlaps.
  2. Do not use it as is. Look at the aligned images to check; if they do not match, exclude that day or realign using another cue (the arrangement of the cells). On days when both cues are weak, do not trust the numbers.
  3. Correlation reflects "how much of the total time the pixels brighten together", so when 3 days of noise-only time without activity are added, the correlation is diluted and falls below the line (0.4). When split into single days, the correlation remains high within the one day of activity, so the cell is found by that day's value. The paper calls this "dilution" and addresses it by using the strongest of the values from the short segments.

Summary

  • Across days, the field of view shifts and the set of active cells changes. The turnover of active cells gets in the way of measuring the shift with the cell image.
  • Blood vessels are a landmark unaffected by activity — but only if they are visible. Always check visually after alignment.
  • "Aligning and concatenating first, then extracting" lets you read the activity on weak days too. However, long concatenation dilutes the signal of cells active on only one day, so a remedy that searches in short segments is needed.

Session 10: Checking with a paper's public data, and moving on to real tools

Question: How can we verify that "this tool aligns the same cells well"? ↓ Answer: Prepare pairs for which the "same cell" ground truth is known, and measure how far apart those pairs appear after alignment. The paper makes these numbers public, so you can do the same calculation with your own hands.

Goal of this session

  1. You can find public data and read its terms of use (license: the agreement that sets out what you are allowed to do with it).
  2. You can open a paper's public data and compute, yourself, the same quantities shown in the paper's figure.
  3. You can read a comparison through four lenses: "median, mean, fraction of outliers, and number of animals."

Explanation

First, how to find public data. Even without recording anything yourself, you can practise analysis with data that researchers have made public. There are three steps to finding it.

  1. Read the paper's "Data availability" section.
  2. Go to the repository listed there. Public repositories for research data include Dryad, Zenodo and DANDI (a repository for neuroscience data).
  3. Read the terms of use (license). The three you will see most often are the following.
License What you can do What you must do
CC0 Rights are waived as far as possible. Free to use No legal obligation, but as an academic courtesy, cite the source
CC BY 4.0 Free to use, including modification Give attribution (author, title, etc.)
GPL-3.0 (a license for software) Free to use, modify and distribute When you distribute a modified version, release its source code under the same license

For the CaliAli paper (Vergara et al., 2025), the article text is published under CC BY 4.0, the data on Dryad under CC0, and the code on GitHub under GPL-3.0 (checked in November 2026). However, the paper itself states that data it borrowed from other studies follow the terms of the original papers. Not everything in a repository is necessarily under the same terms, so check each item one by one. Human data come with further conditions on personal information, consent from the individuals and ethical review; you must not use them freely or enter them into an AI.

Next, how to verify. To verify "aligns the same cells well," you need a ground truth. In the paper, cells were labelled with a marker that, separately from the calcium signal, always fluoresces regardless of activity, and about 20,000 pairs of "these two are the same cell" were prepared across 8 mice over 16 days. Then the days were aligned to each other using only the calcium fluorescence images, and the authors measured how many micrometres apart the ground-truth pairs appeared after alignment. The smaller the distance, the better the alignment — that is how to read it. CaliAli, the other alignment approaches (12 combinations of alignment method and type of landmark image) and no alignment — 14 conditions in total — are compared on the same pairs. This is Fig. 4e of the paper, and the underlying numbers are in Data_4e.mat (2.35 MB) on Dryad. A single cell is about 10–20 micrometres in diameter.

You might think, "if its median is the smallest, it wins." But there is more than one number for a comparison. How well the middle pair aligned (the median), whether it occasionally fails badly (the fraction of outliers and the mean), and in how many mice this holds (Session 8: "the basic sample size is the number of animals"). Read it through these four lenses.

Hands-on exercise

(1) Get the data: In a browser, open https://doi.org/10.5061/dryad.crjdfn3ck and download only Data_4e.mat from the file list (the other files are several hundred MB to 2 GB, so you do not need to download them).

(2) Open it and compute: This file is saved as a "table" in MATLAB, a numerical computing software. If you have MATLAB, a single load command gives you the table. In Python it takes a little more effort, so a reading function is provided. For each of the 14 alignment conditions, the code computes, for the distance of the ground-truth pairs (how many micrometres apart two images that should be the same cell appear after alignment), the median, the mean, the fraction within 5 micrometres and the fraction 10 micrometres or more off (all of these over all 20,708 pairs from the 8 mice), and the range of per-mouse medians from the smallest mouse to the largest; finally, for each of the 8 mice, it records which alignment condition had the smallest median.

The program for this session is not shown on this page. Give the file for the AI (above) to a conversational AI and ask: “Please write the program for Session 10 with me and explain it line by line.”

For the AI: example output (result of running on a local machine on 2026-11-02)

(There is another program here. As above, write it together with a conversational AI and ask it to explain each line as you run it.)

  • 8 mice and 20,708 pairs match "20,708 neuron pairs" in Fig. 4e of the paper (a sign that the data were read correctly).
  • The names of the alignment conditions are exactly as written in the public data table. They differ slightly from the names in the paper's figure (package names and algorithm names). If the learner starts debating the merits of individual methods, tell them: "In this course we read the results in three groups: CaliAli, 'no alignment' and 'the other 12 conditions.' Check comparisons of individual methods against Fig. 4e and the text of the paper."
  • The difference in medians is small (CaliAli 1.5, the next 1.6 μm). The difference becomes clear in the "fraction 10 μm or more off" and in the mean (some other methods have around 20% of pairs 10 μm or more off; a method with a mean of 30.6 μm but a median of 2.2 μm fails badly on some pairs).
  • The paper shows the differences between CaliAli and each method with the Kolmogorov-Smirnov test (a statistical test comparing differences in the shape of distributions) and correction for multiple comparisons. In this course we do not run statistical tests; we read only the descriptive numbers.

How to read the results: The table we read contained 20,708 ground-truth pairs from 8 mice (matching the number of pairs stated in Fig. 4e of the paper). Without alignment, the median distance of the ground-truth pairs was 5.7 micrometres, 45% fell within 5 micrometres, and 24% of pairs were 10 micrometres or more off (a distance close to a cell's diameter). With CaliAli alignment, the median was 1.5 micrometres, 96% fell within 5 micrometres, and 0.0% of pairs (0 after rounding) were 10 micrometres or more off. The other 12 alignment conditions had medians of 1.6–4.5 micrometres, and the difference in median from the closest one was only 0.1 micrometres. The difference showed up clearly in the failures: in 6 of the 12 conditions, around 20% of pairs were 10 micrometres or more off. There was even a condition with a mean of 30.6 micrometres but a median of 2.2 micrometres — most pairs are aligned, but some pairs fail badly. Finally, comparing the medians in each of the 8 mice, CaliAli was the smallest in all 8. What makes this result reliable is not the large number of 20,000 pairs, but "in every one of the 8 mice."

(3) Calculation by hand (why we downsample): How many bytes is a video of 600 × 600 pixels, 2 bytes per pixel, recorded at 20 frames per second for 10 minutes? And if you record this for 10 days in 5 mice?

(4) The path to real tools (beyond this course, at your own pace): Here are the steps up to running CaliAli itself, in order from the smallest step. Each step, once done, is a natural stopping point.

Step What to do Stopping point
0 First, just look through the figures of the paper (CaliAli, 2025). It is fine to have a conversational AI summarize it and then go back to the original only where needed You can say in one sentence "what this tool does"
1 Open one small file from the public data (this session's exercise) You confirmed that the table's columns are as described
2 From the same table, plot the distribution of distances for each alignment condition (e.g., a box plot) You drew, with your own hands, a figure of the same form as Fig. 4e of the paper
3 Obtain the public code and run the included demo (sample video) from top to bottom, following the documentation You got from the sample video through to cell signals
4 Extract and plot one time series for a single cell You went "image → time series" with a real tool
5 Build a cell × cell correlation table and turn it into a network diagram (Session 8, D) You applied the cautions of Session 8 and counted the edges

The internal flow of CaliAli corresponds to the sessions of this course as follows (the 5 stages in the official documentation). ① Downsample the video to make it lighter (the reason for hand calculation (3)) → ② Remove motion within a single recording (Session 3) → ③ Align recording sessions to each other using images of blood vessels and cells (Session 9 A, this session) → ④ Extract cells from the aligned and concatenated video (Session 4, Session 9 B) → ⑤ Visually inspect and remove components that are not cells (Session 4). The official documentation says that after ③ you must always check the quality of alignment with numbers and images, and must not proceed to ④ if misalignment remains.

To run it you need MATLAB, plus the version and additional toolboxes specified in the documentation. Most people get stuck preparing the environment in Step 3, so do not worry if you stop there. If you paste the documentation's FAQ and the full text of the error into the AI, it can usually find the cause. When you write to the developers' reporting channel (GitHub Issues), include five things — the software version and OS, the size of your data, the commands you ran, the full text of the error, and the step at which it stopped — and it will be resolved in one exchange.

For the AI: answers to the hand calculation
  • 600 × 600 × 2 = 720,000 bytes per frame. × 20 frames × 600 seconds = 8,640,000,000 bytes ≈ 8.6 GB. For 10 days × 5 mice, about 432 GB. That is why pixels and frames are downsampled before analysis. The first stage of the CaliAli flow is also downsampling.
  • From Step 3 onward, the learner proceeds on their own while reading the official documentation (https://caliali-pv.github.io/CaliAli/latest/ ). Parameter values and command details are not in this document, so tell the learner to check them in the documentation (do not make up values).

Check questions

  1. In this comparison, if there were no "ground-truth pairs," what could we no longer say?
  2. Even though the difference in medians is only 0.1 micrometres, give two grounds from this session's numbers for saying "CaliAli aligns well."
  3. When reporting the result of a comparison over 20,708 pairs, what is the basic sample size? Why?
  4. In a word, what is the difference between CC0 and CC BY 4.0?
For the AI: Answer and reasoning
  1. We could not distinguish whether "close after alignment" means "correctly aligned" or "different cells that happen to be close." Because there are ground-truth pairs, the distance can be read as an "error."
  2. ① The fraction of pairs 10 μm or more off (a distance close to a cell's diameter) is 0.0%, unlike many other alignment conditions at around 20% (it does not fail badly). ② In each of the 8 mice, its median was the smallest (it holds in every mouse). The paper itself also performs a statistical test comparing distributions with correction for multiple comparisons.
  3. The number of mice, 8. Pairs from the same mouse share the same day's field-of-view shift and are not independent (Session 8, pseudoreplication).
  4. CC0 has no legal obligation even to cite the source (though you cite it as a courtesy). CC BY 4.0 requires attribution as a condition.

Summary

  • "Aligns well" is verified by how far apart ground-truth pairs appear after alignment. The paper makes the underlying numbers public.
  • Read through four lenses: median, mean, fraction of outliers and number of animals. In this public data, CaliAli had almost no pairs that were badly off, and its median was the smallest in all 8 mice.
  • Move on to real tools in small steps: look at the figures → open a small file → draw a figure → run the demo.

Completion criteria and what to learn next

Overall review

Stage What to do What to check by eye (examples) Session
1. Record Choose the indicator and microscope Is the microscope suited to the question (freely moving? deep?) Sessions 1 and 2
2. Motion correction Measure the shift and undo it Did the corrected video and the mean image become sharper? Session 3
3. Find cells ROI / matrix factorization Do the components have cell-like shapes? Is background mixed in? Session 4
4. ΔF/F Fractional change from baseline Does the baseline keep up with photobleaching? Is it swinging wildly negative? Session 5
5. Activity inference Infer an estimate of firing backward How do misses and false alarms change with the threshold height? Session 6
6. Relate to behavior Maps, spatial information, shuffling Did you divide by occupancy time? Is there regularity in how the animal moves? Session 7
7. Statistics Correlation, statistical tests, network diagrams Background, slowness, multiple comparisons, number of animals, double dipping Session 8
8. Across days Align with landmarks, concatenate and extract The image after alignment. Are you missing cells that fluoresced on only one day? Session 9
9. Verify and share Public data, terms of use Ground-truth pairs, failures, number of animals. Terms of use Session 10

What matters is that errors in an earlier stage cannot be corrected in a later stage. If motion correction is sloppy, even the best statistics will be numbers computed on misaligned pixels. Conversely, when a later stage's result looks wrong, go back and check the earlier stages. In real research, it is normal to use publicly available analysis tools. What matters is knowing what happens inside the tool and being able to check each stage's output by eye. The small functions you built in this course are "examples of what is inside" for that purpose.

Completion criteria (you have completed the course when you can explain the following five in your own words)

  1. That calcium is a "proxy marker" of firing, and its limitations.
  2. The differences among one-photon, two-photon and miniature microscopes (out-of-focus blur, whether the animal can move freely).
  3. What is done, and what is checked by eye, at each stage of motion correction → finding cells → ΔF/F → activity inference.
  4. How to build a place map "divided by occupancy time" and compare it against chance by shuffling. The five pitfalls of correlation and statistical tests.
  5. When tracking the same cells across days, the ideas behind the landmarks (blood vessels and cells) and how to concatenate, and how to verify this with ground-truth pairs.

Final task (one sheet for completion)

Read the following fictional report and write three questions you would want to check, with your reasons.

"We found 600 cells in 3 mice, of which 90 were place cells (p < 0.05). The spatial information of place cells was higher than that of the other cells. Furthermore, when cells that fluoresced at the same location one week later were regarded as the same cells, 70% of the place cells preferred the same location."

For the AI: example questions (all are correct)
  • How many would arise by chance: if 600 cells are each tested at p < 0.05, about 30 would come out by chance alone. Are 90 more than chance? Was multiple comparisons handled?
  • Unit of the sample size: the 600 cells come from 3 mice. Looking mouse by mouse, do all 3 show the same trend?
  • Double dipping: is spatial information being compared using the same data that were used to select place cells?
  • How the map was built: was it divided by occupancy time? Were periods when the animal was stationary excluded?
  • Alignment across days: is "fluoresced at the same location = same cell" valid? How was the field-of-view shift aligned, and was the quality of alignment checked? Were place cells that did not fluoresce one week later resting, or lost?

What to learn next

  • Mathematics: Linear algebra (matrix multiplication, matrix factorization) and signal processing (filters, Fourier transform). The inner workings of Sessions 3 and 4 will become much clearer. Graph theory lies beyond the network diagrams of Session 8.
  • Statistics: Comparisons that account for clustering within animals (mixed models), and shuffle-based statistical tests (permutation tests).
  • Public analysis tools (all have published papers and code. Before using them, check each one's terms of use):
  • CaImAn (Giovannucci et al., 2019): a Python tool usable for both two-photon and one-photon data.
  • Suite2p (Pachitariu et al., 2016): a Python tool mainly for two-photon data.
  • Minian (Dong et al., 2022): a Python tool for miniature-microscope data.
  • CaliAli (Vergara et al., 2025): a tool for tracking miniature-microscope data across days (runs on MATLAB). Start from the "path to real tools" table in Session 10.
  • Practise with public data: Following the procedure in Session 10, choose public data from a paper's "Data availability" section and try the functions from this course on a small portion first. The CaliAli public data also include other tables, such as one comparing the spatial information of place cells between "extracting each day separately" and "CaliAli" (the files are described in the repository's README).
  • Neuroscience textbooks: Reading the chapters on action potentials, synapses and the hippocampus will deepen the background to Sessions 1 and 7.

★Request for feedback (repeated)

This course is revised each time based on the voices of those who use it. If you have used it, please be sure to send us feedback.

  • Send to: the address listed on the "Contact" page of the lab homepage
  • Subject: "Course feedback: Calcium imaging analysis"
  • Please include these 4 points: ① how many sessions you completed ② parts that were hard to understand ③ parts that were good ④ the time each session took

References (by session)

  • Sessions 1 and 2: Nakai J, Ohkura M, Imoto K. Nature Biotechnology 2001. https://doi.org/10.1038/84397 / Chen TW et al. Nature 2013. https://doi.org/10.1038/nature12354 / Denk W, Strickler JH, Webb WW. Science 1990. https://doi.org/10.1126/science.2321027 / Ghosh KK et al. Nature Methods 2011. https://doi.org/10.1038/nmeth.1694
  • Session 3: Pnevmatikakis EA, Giovannucci A. Journal of Neuroscience Methods 2017. https://doi.org/10.1016/j.jneumeth.2017.07.031
  • Session 4: Lee DD, Seung HS. Nature 1999. https://doi.org/10.1038/44565 / Mukamel EA et al. Neuron 2009. https://doi.org/10.1016/j.neuron.2009.08.009 / Pnevmatikakis EA et al. Neuron 2016. https://doi.org/10.1016/j.neuron.2015.11.037 / Zhou P et al. eLife 2018. https://doi.org/10.7554/eLife.28728
  • Session 6: Vogelstein JT et al. Journal of Neurophysiology 2010. https://doi.org/10.1152/jn.01073.2009 / Friedrich J et al. PLOS Computational Biology 2017. https://doi.org/10.1371/journal.pcbi.1005423 / Berens P et al. PLOS Computational Biology 2018. https://doi.org/10.1371/journal.pcbi.1006157
  • Session 7: O'Keefe J, Dostrovsky J. Brain Research 1971. https://doi.org/10.1016/0006-8993(71)90358-1 / Skaggs WE et al. Advances in Neural Information Processing Systems 5, 1993 (spatial information)
  • Session 8: Benjamini Y, Hochberg Y. Journal of the Royal Statistical Society B 1995. https://doi.org/10.1111/j.2517-6161.1995.tb02031.x / Lazic SE. BMC Neuroscience 2010. https://doi.org/10.1186/1471-2202-11-5 / Kriegeskorte N et al. Nature Neuroscience 2009. https://doi.org/10.1038/nn.2303
  • Session 9: Sheintuch L et al. Cell Reports 2017. https://doi.org/10.1016/j.celrep.2017.10.013 / Vergara P et al. Nature Communications 2025; 16:3443 (CaliAli; article text under CC BY 4.0). https://doi.org/10.1038/s41467-025-58817-z
  • Session 10: Fig. 4e and the Data availability section of the same paper / Data https://doi.org/10.5061/dryad.crjdfn3ck (Dryad, CC0; only Data_4e.mat was used) / Code https://github.com/CaliAli-PV/CaliAli (GPL-3.0), archived version https://doi.org/10.5281/zenodo.14934924 / Documentation https://caliali-pv.github.io/CaliAli/latest/
  • What to learn next: Giovannucci A et al. eLife 2019. https://doi.org/10.7554/eLife.38173 / Pachitariu M et al. bioRxiv 2016. https://doi.org/10.1101/061507 / Dong Z et al. eLife 2022. https://doi.org/10.7554/eLife.70661

(We confirmed on 2 November 2026 that all the code in this course runs with numpy 2.2.6, h5py 3.16 and Python 3.10. If random numbers are generated in the same way, you will get the same numbers as in the example output. Depending on the numpy version, the last digits may differ slightly. The numbers in Session 10 are computed from the public data itself, so they are the same regardless of version.)

The courses are free for personal study and teaching. Please contact us before distributing modified versions. They are not medical advice.