Skip to content

Tectum/DegusBehavior

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Behavioural Data Analysis: stimulus-aligned and visualization of motor responses to looming.

Overview

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:

  1. Data preparation – extracting time windows of movement aligned to stimulus onset and storing them in a matrix.
  2. Visualization – generating plots from the aligned data matrix and manual annotations.

Repository Structure

.
├── data/                # raw or intermediate data files
├── scripts/             # analysis scripts
│   ├── save_window.py
│   ├── plot_raw.py
│   ├── plot_average.py
│   └── plot_proportion.py
└── README.md

Step 1: Generate Stimulus-Aligned Data

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)

Step 2: Generate Plots

After creating the aligned matrix, the following scripts generate visualizations.

1. Heatmap visualization

plot_raw.py

Displays the aligned speed as a 2D heatmap (e.g., trials vs time).

2. Average trace plots

plot_average.py

Plots the average response across trials aligned to stimulus onset.

3. Proportion plots

plot_proportion.py

Computes proportion of trials that exhibit a particular motor response depending on the stimulus location and age.

  • includes fitting curve

Typical Workflow

Run the scripts in the following order:

python save_window.py
python plot_raw.py
python plot_proportion.py
python plot_average.py

Requirements

Typical Python packages used:

numpy
matplotlib
scipy
pandas

Install with:

pip install numpy matplotlib scipy pandas

Notes

  • The plotting scripts expect the aligned matrix generated by create_windows.py.
  • Ensure file paths inside the scripts point to the correct data directories.

About

codes to process animals reaction in response to looming across ontogeny

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors