Skip to content

Commit

Permalink
added run scripts for the various configurations used in the paper
Browse files Browse the repository at this point in the history
  • Loading branch information
iraikov committed Jun 6, 2024
1 parent 7d1a459 commit 1640224
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 20 deletions.
59 changes: 44 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@

This repository contains a biophysical computational model of a
simplified microcircuit of CA3, a hippocampal brain region associated
with memory formation. During online training, the pyramidal cells in
the model receive grid spatially-structured place and grid input and
form spatial receptive fields after several simulated laps on a
virtual linear track. A fraction of pyramidal cells receive sensory
cue input at a randomly selected location during each lap. During the
simulated offline period, the pyramidal cells in the model receive
random input and undergo epochs of spontaneously sequential activity
resembles, consistent with spontaneous memory replay. During these
replay-like events, cue cells are suppressed and overall place and cue
cell firing is significantly negatively correlated. This model shows
that inhibitory plasticity is both sufficient and necessary for cue
cell suppression during replay events, and suggests a possible
mechanism for spatial map formation that is robust to distractor
sensory inputs.
with memory formation. Results obtained with this model are reported in the paper:

> Inhibitory plasticity supports replay generalization in the
> hippocampus. Zhenrui Liao, Satoshi Terada, Ivan Georgiev Raikov,
> Darian Hadjiabadi, Ivan Soltesz, Attila Losonczy. Nat Neurosci 2024.
During online training, the pyramidal cells in the model receive grid
spatially-structured place and grid input and form spatial receptive
fields after several simulated laps on a virtual linear track. A
fraction of pyramidal cells receive sensory cue input at a randomly
selected location during each lap. During the simulated offline
period, the pyramidal cells in the model receive random input and
undergo epochs of spontaneously sequential activity resembles,
consistent with spontaneous memory replay. During these replay-like
events, cue cells are suppressed and overall place and cue cell firing
is significantly negatively correlated. This model shows that
inhibitory plasticity is both sufficient and necessary for cue cell
suppression during replay events, and suggests a possible mechanism
for spatial map formation that is robust to distractor sensory inputs.



## Prerequisites

Expand Down Expand Up @@ -81,7 +88,7 @@ The run_training script generates the following output files:

### Offline phase

Run the online phase simulation as follows:
Run the offline phase simulation as follows:

mpirun -n <nprocs> python3 run_ripple.py \
--model-home $PWD \
Expand All @@ -106,6 +113,28 @@ The run_ripple script generates the following output files:
- `ext_spikes_<config name>.npz`: spikes produces by the artificial spike sources in the model.
- `v_vecs_<config name>.npz`: somatic voltage traces of all biophysical neurons in the model.

## Model configurations associated with paper

The following model configurations were used to produce the results in
the paper. The exact command lines used to run simulations for each
configuration can be found in directory `scripts`.


### Circuit parameters

- `params/circuitparams_segs_eegrad_stdp_ee_ie_mf_mec_lec.yaml` : Baseline model configuration
- `params/circuitparams_grads_stdp_ee_ie_mf_mec_lec.yaml` : Mixed MEC and LEC inputs
- `params/circuitparams_segs_eegrad_stdp_ee_mf_mec_lec.yaml` : Alternate hypothesis: E->E plasticity
- `params/circuitparams_segs_eegrad_stdp_ee_ei_mf_mec_lec.yaml`: Alternate hypothesis: E->E and E->I plasticity
- `params/circuitparams_segs_eegrad_stdp_ee_ie_mf_mec_lec_ln.yaml`: Log-normal distribution of PYR firing rates

### Input parameters

- `params/arenaparams_uniform.yaml` : Input parameters for online phase
- `arenaparams_ripple_uniform_high.yaml` : Input parameters for offline phase



## Analysis

See notebook [analysis.ipynb](notebooks/analysis.ipynb)
Expand Down
22 changes: 22 additions & 0 deletions scripts/run_alternate_ee.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Alternate hypothesis: E -> E plasticity only

## Online phase (training)

mpirun python3 run_training.py \
--model-home $PWD \
--circuit-config circuitparams_segs_eegrad_stdp_ee_mf_mec.yaml \
--arena-config arenaparams_uniform.yaml \
-c 0110_segs_eegrad_stdp_ee_mf_mec_lec_input_uniform \
--data-prefix data \
--save-weights-every 5

## Offline phase

mpirun python3 run_ripple.py \
--model-home $PWD \
--circuit-config circuitparams_ripple.yaml \
--arena-config arenaparams_ripple_uniform_high.yaml \
-c ripple_0110_segs_eegrad_stdp_ee_mf_mec_lec_input_uniform \
--saved-weights-path data/0110_segs_eegrad_stdp_ee_mf_mec_lec_input_uniform-cue-ee-ei-nlaps-25-dt-zerodot1-scale-2-v1.npz
22 changes: 22 additions & 0 deletions scripts/run_alternate_ee_ei.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Alternate hypothesis: E -> E and E -> I plasticity only

## Online phase (training)

mpirun python3 run_training.py \
--model-home $PWD \
--circuit-config circuitparams_segs_eegrad_stdp_ee_ei_mf_mec.yaml \
--arena-config arenaparams_uniform.yaml \
-c 0110_segs_eegrad_stdp_ee_ei_mf_mec_lec_input_uniform \
--data-prefix data \
--save-weights-every 5

## Offline phase

mpirun python3 run_ripple.py \
--model-home $PWD \
--circuit-config circuitparams_ripple.yaml \
--arena-config arenaparams_ripple_uniform_high.yaml \
-c ripple_0110_segs_eegrad_stdp_ee_ei_mf_mec_lec_input_uniform \
--saved-weights-path data/0110_segs_eegrad_stdp_ee_ei_mf_mec_lec_input_uniform-cue-ee-ei-nlaps-25-dt-zerodot1-scale-2-v1.npz
24 changes: 24 additions & 0 deletions scripts/run_baseline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Baseline model configuration

## Online phase (training)

mpirun python3 run_training.py \
--model-home $PWD \
--circuit-config circuitparams_segs_eegrad_stdp_ee_ie_mf_mec_lec.yaml \
--arena-config arenaparams_uniform.yaml \
-c 0101_segs_eegrad_stdp_ee_ie_mf_mec_lec_input_uniform \
--data-prefix data \
--save-weights-every 5

## Offline phase

mpirun python3 run_ripple.py \
--model-home $PWD \
--circuit-config circuitparams_ripple.yaml \
--arena-config arenaparams_ripple_uniform_high.yaml \
-c ripple_0101_segs_eegrad_stdp_ee_ie_mf_mec_lec_input_uniform \
--saved-weights-path data/0101_segs_eegrad_stdp_ee_ie_mf_mec_lec_input_uniform-cue-ee-ei-nlaps-25-dt-zerodot1-scale-2-v1.npz


22 changes: 22 additions & 0 deletions scripts/run_lognormal_fr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Log-normal distribution of firing rates configuration

## Online phase (training)

mpirun python3 run_training.py \
--model-home $PWD \
--circuit-config circuitparams_grads_stdp_ee_ie_mf_mec_lec_ln.yaml \
--arena-config arenaparams_uniform.yaml \
-c 0117_grads_stdp_ee_ie_mf_mec_lec_ln_input_uniform \
--data-prefix data \
--save-weights-every 5

## Offline phase

mpirun python3 run_ripple.py \
--model-home $PWD \
--circuit-config circuitparams_ripple.yaml \
--arena-config arenaparams_ripple_uniform_high.yaml \
-c ripple_0117_grads_stdp_ee_ie_mf_mec_lec_ln_input_uniform \
--saved-weights-path data/0108_grads_stdp_ee_ie_mf_mec_lec_ln_input_uniform-cue-ee-ei-nlaps-25-dt-zerodot1-scale-2-v1.npz
22 changes: 22 additions & 0 deletions scripts/run_mixed_mec_lec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Mixed MEC/LEC input model configuration

## Online phase (training)

mpirun python3 run_training.py \
--model-home $PWD \
--circuit-config circuitparams_grads_stdp_ee_ie_mf_mec_lec.yaml \
--arena-config arenaparams_uniform.yaml \
-c 0108_grads_stdp_ee_ie_mf_mec_lec_input_uniform \
--data-prefix data \
--save-weights-every 5

## Offline phase

mpirun python3 run_ripple.py \
--model-home $PWD \
--circuit-config circuitparams_ripple.yaml \
--arena-config arenaparams_ripple_uniform_high.yaml \
-c ripple_0108_grads_stdp_ee_ie_mf_mec_lec_input_uniform \
--saved-weights-path data/0108_grads_stdp_ee_ie_mf_mec_lec_input_uniform-cue-ee-ei-nlaps-25-dt-zerodot1-scale-2-v1.npz
16 changes: 11 additions & 5 deletions utils/plot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ def plot_spikes(spike_times, title, start, finish, gids=None, figsize=(6,2), col
frs = []
plt.figure(dpi=600, figsize=figsize)
i = 0


sts_dict = {}
for gid in gids:
sts = spike_times[gid]
sts = np.asarray(sts) / 1000.
sts_dict[gid] = sts
plt.eventplot(np.asarray(sts).reshape((1,-1)), lineoffsets=i+0.5,
orientation='horizontal',
colors=colors)
Expand All @@ -40,7 +42,7 @@ def plot_spikes(spike_times, title, start, finish, gids=None, figsize=(6,2), col
if add_title:
plt.title('%s fr. mean: %0.3f. std: %0.3f' % (title, np.mean(frs), np.std(frs)))
plt.show()
return
return sts_dict


def plot_spikes_with_density(spike_times, title, start, finish, gids=None, color='k', binsize=150):
Expand Down Expand Up @@ -129,9 +131,9 @@ def plot_avg_peri_event_time_histogram(spike_times, event_time_ranges,
time_range = time_extent[1] - time_extent[0]
bin_range = (min(bin_range[0], -time_range/2.), max(bin_range[1], time_range/2))

avg_rate = np.mean(np.vstack(rates), axis=0)
std_rate = np.std(np.vstack(rates), axis=0)
rate_array = np.vstack(rates)
avg_rate = np.mean(rate_array, axis=0)
std_rate = np.std(rate_array, axis=0)

ax.plot(norm_bins, avg_rate,
color=color,
Expand All @@ -143,3 +145,7 @@ def plot_avg_peri_event_time_histogram(spike_times, event_time_ranges,

ax.axvline(0, color='black', linestyle=':')
ax.set_xlim(bin_range)

return norm_bins, rate_array


0 comments on commit 1640224

Please sign in to comment.