Skip to content

Latest commit

 

History

299 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cb-epileptor

Two-population neuron model simulating epileptic behavior and endocannabinoid dynamics using Brian2.

The model couples an excitatory population (Hindmarsh-Rose model) with an inhibitory population (Morris-Lecar model) through first-order chemical synapses. The synapses incorporates voltage-gated bidirectional plasticity simulating endocannabinoid retrograde signaling. The neural network reproduces seizure dynamics, including preictal activity increase, ictal synchronization, and subtle status epilepticus in post-ictal stage.

Setup

python -m venv ../.cn_venv      # parent dir, matches Condor wrapper.sh expectations
source ../.cn_venv/bin/activate
pip install -r requirements.txt

The Condor sweep scripts hardcode the venv at SR-CB/.cn_venv/ (one level above this repo). If you only run sims locally you can put the venv anywhere and activate it manually.

Quick start

cd src
python run.py -m rp

Loads params.yaml from the repo root, runs a 120 s simulation with 10 neurons per population, and writes plots to src/output/figures/.

Repository layout

params.yaml               # default simulation parameters (Brian2 quantity strings)
requirements.txt          # brian2, brian2tools, matplotlib, scipy, numpy, pyyaml
branching.md              # git workflow conventions

condor/                   # HTCondor sweep submission
  README.md               # full sweep workflow
  setup_condor.sh         # generates condor.sub
  wrapper.sh              # activates venv, execs python

src/
  run.py                  # main entrypoint (CLI: -m rp / rpa / rpf)
  model.py                # Brian2 sim: HR + ML populations, synapses, plasticity
  param_loader.py         # YAML -> dict, resolving Brian2 expressions
  data_processing.py      # save/load output.pkl, spike histograms
  synch.py                # chi synchrony measure + Kuramoto order parameter
  plotting/               # LFP/raster, plasticity, signal-analysis, sweep heatmap plots
  ephys/                  # electrophysiology analysis and plotting
    ephys_util.py         # ephys processing helper methods
    sheet_parser.py       # parse master sheet ods file as Pandas DataFrame
    signal_processing.py  # main entrypoint for ephys tools
  sweep/                  # parameter-sweep machinery (drives Condor)
    generate_params.py    # writes params/param_N.yaml + params_list.txt
    run_single_sim.py     # one Condor job: run sim, save chi summary
    aggregate.py          # collate per-job results into heatmaps

Single-simulation workflow (run.py)

python run.py [-m MODE] [--params PATH] [--out-dir DIR] [--no-cb]

Mode flags are independent and stackable — e.g. -m rpa means run, plot, then analyze.

Flag Action
r Run the simulation, write output.pkl
p Generate the LFP+raster plot and (if cb is on) plasticity plot
f Combined with p, also draw HR (x,y,z,I_syn) and ML (x,n) traces
a Print chi/KOP stats and write autocorr+KOP plots

--no-cb keeps the Wpre dynamics evolving but drops Wpre from the synaptic current (so plasticity has no effect on the dynamics — useful as a control).

--params PATH points at any YAML matching the schema in params.yaml. All keys in run.REQUIRED_PARAMS must be present.

Configuration

params.yaml is a flat YAML where most values are Brian2 quantity strings (e.g. SIM_DURATION: "120*second", G_INTER: "1*uS"). The loader resolves them at load time, so any valid Brian2 expression is accepted.

The four *_VALS arrays (X_NAUGHT_VALS, COUPLING_VALS, G_INTER_VALS, G_INTRA_VALS) are present for time-varying schedules, but the model equations currently read the corresponding scalar constants (HR_X_NAUGHT, COUPLING_STRENGTH, G_INTER, G_INTRA); the sweep overrides both for safety.

Output

run.py writes:

out_dir/
  data/output.pkl    # {metadata, params, results} dict — see data_processing.save_data
  figures/           # PNGs (standard_plot, N1_to_1_wpre, kop, autocorr, ...)

Git

See branching.md for the team's branch-and-merge conventions.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages