The (neurolib) code for the paper:

Cakan C, Obermayer K (2020) Biophysically grounded mean-field models of neural populations under electrical stimulation. PLoS Comput Biol 16:e1007822
doi: 10.1371/journal.pcbi.1007822

is available at the author's GitHub repository with the latest updates and instructions on how to install at https://github.com/neurolib-dev/neurolib

# Introduction

neurolib is a Python framework for easy whole-brain neural mass modeling. It allows you to build, simulate, and optimize your own state-of-the-art whole-brain models. To simulate the neural activity of each brain area, the main implementation provides an advanced neural mass mean-field model of spiking adaptive exponential integrate-and-fire neurons (AdEx) in the form of a linear-nonlinear cascade model called aln.

For a thorough analysis of the aln model, please refer to our paper "Biophysically grounded mean-field models of neural populations under electrical stimulation. Cakan et al. (2020). PLOS Computational Biology"

The adaptive linear-nonlinear (aln) cascade model is a low-dimensional population model of spiking neural networks. Mathematically, it is a dynamical system of non-linear ordinary differential equations (ODEs). The dynamical variables of the system simulated in the aln model describe the average firing rate and other macroscopic variables of a randomly connected, delay-coupled network of excitatory and inhibitory adaptive exponential integrate-and-fire neurons (AdEx) with non-linear synaptic currents.

Ultimately, the model is a result of various steps of model reduction starting from the Fokker-Planck equation of the AdEx neuron subject to white noise input with different mean µ and variance s. The resulting steady-state firing rates r and the linear response function of the neural population are then stored in a lookup table. When we finally simulate the system, these precomputed quantities serve as the linear filter and the nonlinear firing rate transfer function r = F(µ,s) as a system of ODEs with an adaptive timescale t, hence the name adaptive linear-nonlinear (aln) cascade.

# Simulating a single node

The following Python code is a brief demonstration on how to simulate a single aln node. A introductory tutorial on how to use the framework can be found at https://caglorithm.github.io/notebooks/neurolib-intro/

To create a single node, we instantiate the model without any arguments.

```
# Let's import the aln model
from neurolib.models.aln import ALNModel

# Create the model
aln = ALNModel()

# Each model comes with a set of default parameters which are a dictionary. # Let's change the parameter that controls the duration of a simulation to 10s. aln.params['duration'] = 10.0 * 1000

# For convenience, we could also use:
aln.params.duration = 10.0 * 1000

# In the aln model an Ornstein-Uhlenbeck process is simulated in parallel # as the source of input noise fluctuations. Here we can set the variance # of the process.
# Let's add some noise.
aln.params['sigma_ou'] = 0.1

# Finally, we run the model
aln.run()