Skip to content

abbimajor/Bayesian-Decoder-for-Simulated-Place-Cell-Activity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Bayesian Decoding of Position from Simulated Place Cells

Purpose

Demonstrates how a rat's position on a linear track can be decoded from hippocampal place cell activity using Bayesian inference.

Simulation Pipeline

1. Simulate Rat Movement

  • Rat runs back and forth on a linear track (−1 to +1)
  • Position modelled as a sawtooth wave (0.1 Hz, ~10s per lap)
  • Sampled at 10 ms resolution over 120 seconds

2. Generate Place Fields

  • 30 neurons with Gaussian tuning curves
  • Field centres evenly spaced across the track
  • Peak firing rate: 40 Hz
  • Field width: 0.25 (normalised units)

3. Simulate Spike Trains

  • Firing rates interpolated from place fields based on rat's instantaneous position
  • Spikes generated via inhomogeneous Poisson process:
    P(spike in Δt) = 1 − exp(−λ · Δt)
    

4. Reconstruct Place Fields

  • Bin track into 50 spatial bins
  • Compute firing rate = spike count / occupancy time per bin
  • This mimics what you'd do with real experimental data

5. Bayesian Decoding

  • Decode position in 200 ms windows (τ = 0.2s)
  • For each time window, compute posterior over positions:
    P(position | spikes) ∝ ∏ᵢ Poisson(nᵢ | λᵢ(x) · τ)
    
  • Assumes independent Poisson firing across neurons

6. Evaluation

  • Compare decoded (MAP estimate) vs actual position
  • Visualise posterior distribution over time
  • Scatter plot / 2D histogram of decoding accuracy

Key Outputs (Figures)

  1. Rat position over time
  2. Place fields (tuning curves)
  3. Example neuron firing rate over time
  4. Raster plot of all 30 neurons
  5. Occupancy histogram
  6. Reconstructed (empirical) place fields
  7. Posterior distribution heatmap
  8. Posterior with actual position overlay
  9. Decoded vs actual position (2D histogram)
  10. Decoded vs actual position (scatter)

Parameters

Parameter Value
No. of Neurons 30
Track length −1 to +1 (a.u.)
Time step (Δt) 10ms
Simulation duration 120s
Decoding window (τ) 200ms
Spatial bins 50

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors