Sinusoidal gamma generator example

This script demonstrates the use of the sinusoidal_gamma_generator and its different parameters and modes. The source code of the model can be found in models/sinusoidal_gamma_generator.h.

The script is structured into two parts, each of which generates its own figure. In part 1A, two generators are created with different orders of the underlying gamma process and their resulting PST (Peristiumulus time) and ISI (Inter-spike interval) histograms are plotted. Part 1B illustrates the effect of the individual_spike_trains switch. In Part 2, the effects of different settings for rate, phase and frequency are demonstrated.

First, we import all necessary modules for simulation, analysis and plotting.

import nest
import matplotlib.pyplot as plt
import numpy as np
nest.ResetKernel() # in case we run the script multiple times from iPython

We first create a figure for the plot and set the resolution of NEST.

plt.figure()
nest.SetKernelStatus({'resolution': 0.01})

Then we create two instances of the sinusoidal_gamma_generator with two different orders of the underlying gamma process using Create. Moreover, we create devices to record firing rates (multimeter) and spikes (spike_detector) and connect them to the generators using Connect.

First, a sinusoidal_gamma_generator with individual_spike_trains set to True is created and connected to 20 parrot neurons whose spikes are recorded by a spike detector. After simulating, a raster plot of the spikes is created.

The kernel is reset again and the whole procedure is repeated for a sinusoidal_gamma_generator with individual_spike_trains set to False. The plot shows that in this case, all neurons receive the same spike train from the sinusoidal_gamma_generator.

In part 2, multiple generators are created with different settings for rate, phase and frequency. First, we define an auxiliary function which simulates n generators for t ms. After t/2, the parameter dictionary of the generators is changed from initial to after.