← Lab 5

Arrays in one dimension

One neuron, 21,238 numbers, and a mouse deciding whether to drink. Everything from the lecture — now at full length, on the real recording.

The basics
  • ▸np.array — one type, one block of memory
  • ▸.shape, .dtype, .ndim, .size
  • ▸indexing & slicing — exactly like a list
  • ▸arithmetic on every element at once
Asking questions
  • ▸boolean masks — dff > 1 asks all 21,238 at once
  • ▸masking one array with another: dff[go == 1]
  • ▸np.where — from mask to frame numbers
  • ▸np.diff — finding where an event starts
Python for Biologists