This projects adds microstimulation to the Wang 2002 Biophysical Attractor Model of decision-making, fully coded in MATLAB R2021A. This work improves upon the original bam_microstim with more realistic extracellular microstimulation model and more detailed analyses. A pre-print describing this work can be found here.
Simply clone the repository and navigate MATLAB to the bam_microstim2 directory.
The project is generally run by 4 code scripts:
- sim_constants.m defines the simulation-level parameters such as the simulation name, current amplitudes, etc. and then calls
bam_constants
, which defines all the low level biophysical constants, generates connectivities, neuron locations, etc. for a given simulation type ('connected', 'disconnected', etc.). - main.m runs the main simulation program, which simulates leaky-integrate-and-fire dynamics, synaptic currents, task-related currents, background currents, and microstimulation currents for a variety of task conditions (coherences) and microstimulation inputs. Spike times for each neuron are stored in a containers.map variable called
recspikes
in .mat files. - analyze_main.m runs analysis of the raw spike time data to generate data of interest such as accuracy and decision time, and stores them in "decisions.mat" files.
- plot_results.m plots the data generated by analyze_main.m, in a variety of visualizations. each of which calls various functions.
- Note: bootstrap_decisions.m is an exception that generates bootstrapped decision-making plots separately from plot_results.m.
The data is stored in a different folder for each simulation ("Simulation X"), which is determined by the sim_name
variable defined in bam_constants.m.
- Define name of simulation with
sim_name
variable in bam_constants.m (ex. "X") - Adjust parameters as necessary
- Call sim_constants --> saves necessary constants
- Update
sim_name
in main.m - Call main.m --> for each brain/stimulation condition/coherence/trial, saves data in "Simulation X/brainY/data/
stim_amp
nA_stim_cond/c=coherence/trialZ.mat" - Update
sim_name
in analyze_main.m - Call analyze_main --> saves analyzed variables in "Simulation X/brainY/data/
stim_amp
nAstim_cond/decisions.mat" - Update
sim_name
in plot_results.m - Call sections in plot_results for each visualization and statistical analyses
Data is stored in an organized nested folder structure with the following levels
- Simulation name ("Simulation Test"), which contains
- conductances.mat, which stores matrices with connection conductances for ampa (
AMPA
), gaba (GABA
), nmda (NMDA
) synapses - bam_constants.mat, which stores a variety of useful constants
- adja.mat, which stores connection adjacency matrix
adja
- spikes, which contains the task-related and background input spikes for each trial/coherence under
- c=coherence (ex. "c=-1.000")
- trialX.mat (ex. "trial1.mat"), which contains a variable with all the input spikes called
spikes
- trialX.mat (ex. "trial1.mat"), which contains a variable with all the input spikes called
- c=coherence (ex. "c=-1.000")
- ustim, which contains
- r.mat, which stores the locations of each 'affected' P1 neuron (
ball_r
) stim_amp
uAstim_cond.mat (ex. "-1.40uA_galvanic.mat"), which stores the instantaneous microstimulation current for each neuron (I_ustim
)- data, which contains the data for each trial in a nested structure
stim_amp
uA_stim_cond (ex. "-1.40uA_galvanic") for each stimulation condition- decisions.mat, which stores all of the analyzed variables from analyze_main.m
- c=coherence ex. ("c=-1.000") for each coherence
- trialX.mat (ex. "trial1.mat"), which stores the spike times for each neuron in a containers.map variable (
recspikes
), in which the keys are the neuron number as a string (ex.'1'
) and the values are a vector containing the time indices when the neuron fired an action potential (ex.t(recspikes('1')) = [0.521, 1.001, 2.325, 2.9, 2.997, 3.053]
).
- trialX.mat (ex. "trial1.mat"), which stores the spike times for each neuron in a containers.map variable (
- r.mat, which stores the locations of each 'affected' P1 neuron (
- conductances.mat, which stores matrices with connection conductances for ampa (
The code used to validate LIF microstimulation approximations against a cable equation model is housed in a separate folder called CableModelValidation. The main script to run this code is called cable_validation.m
Paul Adkisson: [email protected]