# 2. Leaky-integrate-and-fire model¶

Book chapters

See Chapter 1 Section 3 on general information about leaky-integrate-and-fire models.

Python classes

The leaky_integrate_and_fire.LIF module contains all code required for this exercise. At the beginning of your exercise solutions, import the contained functions by running

from neurodynex.leaky_integrate_and_fire.LIF import *


You can then simply run the exercise functions by executing

LIF_Step()  # example Step
LIF_Sinus()  # example Sinus


## 2.1. Exercise¶

Use the function LIF_Step() to simulate a Leaky Integrate-And-Fire neuron stimulated by a current step of a given amplitude. The goal of this exercise is to modify the provided python functions and use the numpy and matplotlib packages to answer the following questions.

### 2.1.1. Question¶

What is the minimum current step amplitude I_amp to elicit a spike with model parameters as given in LIF_Step()? Plot the injected values of current step amplitude against the frequency of the spiking response (you can use the inter-spike interval to calculate this – let the frequency be $$0Hz$$ if the model does not spike, or emits only a single spike) during a $$500ms$$ current step.

## 2.2. Exercise¶

Use the function LIF_Sinus() to simulate a Leaky Integrate-And-Fire neuron stimulated by a sinusoidal current of a given frequency. The goal of this exercise is to modify the provided python functions and use the numpy and matplotlib packages to plot the amplitude and frequency gain and phase of the voltage oscillations as a function of the input current frequency.

### 2.2.1. Question¶

For input frequencies between $$0.1kHz$$ and $$1.kHz$$, plot the input frequency against the resulting amplitude of subthreshold oscillations of the membrane potential. If your neuron emits spikes at high stimulation frequencies, decrease the amplitude of the input current.

### 2.2.2. Question¶

For input frequencies between $$0.1kHz$$ and $$1.kHz$$, plot the input frequency against the resulting frequency and phase of subthreshold oscillations of the membrane potential. Again, keep your input amplitude in a regime, where the neuron does not fire action potentials.