This repository contains scripts for processing video tracking recordings aligned to stimulus onset and for visualizing the resulting data.
The workflow is divided into two stages:
- Data preparation – extracting time windows of movement aligned to stimulus onset and storing them in a matrix.
- Visualization – generating plots from the aligned data matrix and manual annotations.
.
├── data/ # raw or intermediate data files
├── scripts/ # analysis scripts
│ ├── save_window.py
│ ├── plot_raw.py
│ ├── plot_average.py
│ └── plot_proportion.py
└── README.md
Run the script:
save_window.py
This script:
- Loads the position of the animal per frame recorded
- Calculate the speed of the animal at each frame
- Extracts time windows around each stimulus
- Aligns them to stimulus onset
- Stores the result as a matrix
Typical output structure:
all_speeds.npy
Matrix dimensions usually follow:
(trials × timepoints)
After creating the aligned matrix, the following scripts generate visualizations.
plot_raw.py
Displays the aligned speed as a 2D heatmap (e.g., trials vs time).
plot_average.py
Plots the average response across trials aligned to stimulus onset.
plot_proportion.py
Computes proportion of trials that exhibit a particular motor response depending on the stimulus location and age.
- includes fitting curve
Run the scripts in the following order:
python save_window.py
python plot_raw.py
python plot_proportion.py
python plot_average.py
Typical Python packages used:
numpy
matplotlib
scipy
pandas
Install with:
pip install numpy matplotlib scipy pandas
- The plotting scripts expect the aligned matrix generated by
create_windows.py. - Ensure file paths inside the scripts point to the correct data directories.