Note

Click here to download the full example code

# 2.2. Theta Neuron Mean-Field Model¶

Here, we will introduce the mean-field model of a network of all-to-all coupled theta neurons. The theta neuron model is also known as the Ermentrout-Kopell model and takes the form

with neural phase and mean-field input 1. The phase variable lies on the unit circle and when a spike is counted. Considering an all-to-all coupled network of theta neurons in the continuum limit , the evolution equations for the Kuramoto order parameter can be derived 2. For with being a pulse-like synaptic current centered around , these mean-field equations take the form

- They are governed by 3 parameters:
–> the mean of a Lorenzian distribution over the neural excitability in the population

–> the half-width at half maximum of the Lorenzian distribution over the neural excitability

–> the strength of the recurrent coupling inside the population

Also, represents the complex conjugate of . This mean-field model is an exact representation of the macroscopic synchronization dynamics of a spiking neural network consisting of theta neurons with Lorentzian distributed background excitabilities.

Below, we will demonstrate ow to load the mhodel template into pyrates, perform simulations with it and visualize the results.

## 2.2.1. References¶

- 1
G.B. Ermentrout and N. Kopell (1986)

*Parabolic bursting in an excitable system coupled with a slow oscillation.*SIAM-J.-Appl.-Math 46: 233-253.- 2
T.B. Luke, E. Barreto and P. So (2013)

*Complete Classification of the Macroscopic Behavior of a Heterogeneous Network of Theta Neurons*Neural Computation 25: 3207-3234.

### 2.2.1.1. Step 1: Numerical simulation of a the model behavior in time¶

Here, we use the `integrate`

function imported from PyRates. As a first argument to this function, either a path
to a YAML-based model definition or a `CircuitTemplate`

instance can be provided. The function will then compile
the model and solve the initial value problem of the above defined differential equations for a time interval from
0 to the given simulation time. This solution will be calculated numerically by a differential equation solver in
the backend, starting with a defined step-size. Here, we use the default backend and scipy solver. Furthermore,
we provide a step-function extrinsic input that excites all theta neurons in a time window from `start`

to
`stop`

. This input is defined on a time vector with fixed time steps of size `step_size`

.
Check out the arguments of the code:CircuitTemplate.run() method for a detailed explanation of the
arguments that you can use to adjust this numerical procedure.

```
from pyrates import integrate
import numpy as np
# define simulation time and input start and stop
T = 100.0
step_size = 5e-4
start = 20.0
stop = 80.0
# extrinsic input definition
steps = int(np.round(T/step_size))
I_ext = np.zeros((steps,))
I_ext[int(start/step_size):int(stop/step_size)] = 3.0
# perform simulation
results = integrate("model_templates.neural_mass_models.theta.kmo_theta", step_size=step_size, simulation_time=T,
outputs={'z': 'p/theta_op/z'}, inputs={'p/theta_op/I_ext': I_ext}, clear=True, solver='scipy')
```

### 2.2.1.2. Step 2: Visualization of the solution¶

The output of the `simulate()`

function is a `pandas.Dataframe`

, which allows for direct plotting of the
timeseries it contains.
This timeseries represents the numerical solution of the initial value problem solved in step 1 with respect to the
state variable of the model. Since it is a complex-valued variable, we plot the absolute value of it here.

```
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot(np.abs(results))
ax.set_xlabel('time')
ax.set_ylabel(r'|z|')
plt.show()
```

**Total running time of the script:** ( 0 minutes 0.000 seconds)