18#include "Spike/SpikeTrain/SpikeTrain.h"
19#include "Spike/TimeFrame/TimeFrame.h"
30 std::random_device
rd;
32 std::normal_distribution<double>
dist;
39 explicit IF(
const std::string &input_file);
46 IF(
double mu,
double D);
53 [[nodiscard]]
virtual double drift(
double v)
const = 0;
87 void set_mu(
double mu_new) { this->mu = mu_new; };
93 void set_D(
double D_new) { this->D = D_new; };
99 [[nodiscard]]
double get_D()
const {
return D; };
105 virtual void print(std::ostream &out)
const = 0;
113 friend std::ostream &
operator<<(std::ostream &out,
const IF &neuron);
133 explicit PIF(
const std::string &input_file);
140 [[nodiscard]]
double drift(
double v)
const override;
146 void print(std::ostream &out)
const override {
147 out <<
"PIF(mu: " <<
mu <<
", D: " <<
D <<
")";
167 explicit LIF(
const std::string &input_file);
174 [[nodiscard]]
double drift(
double v)
const override;
180 void print(std::ostream &out)
const override {
181 out <<
"LIF(mu: " <<
mu <<
", D: " <<
D <<
")";
Abstract base class for integrate-and-fire (IF) neurons.
Definition IF.h:26
void set_mu(double mu_new)
Set new mean input current.
Definition IF.h:87
double diffusion() const
Calculates the diffusion of the IF neurons, i.e. sqrt(2D).
Definition IF.cpp:30
IF(const std::string &input_file)
Constructs an IF neuron from a .ini file.
Definition IF.cpp:18
double D
diffusion coefficient
Definition IF.h:29
virtual void print(std::ostream &out) const =0
Prints the IF neuron to the outstream.
std::random_device rd
random device (seeding)
Definition IF.h:30
double mu
mean input current
Definition IF.h:28
void get_voltage_curve(const TimeFrame &time, std::vector< double > &v)
Calculates the trajectory, i.e. v(t) for a given time frame.
Definition IF.cpp:73
double get_D() const
Returns the diffusion coefficient.
Definition IF.h:99
virtual double drift(double v) const =0
Calculates the drift of the IF neuron.
std::mt19937 generator
random number generator
Definition IF.h:31
void set_D(double D_new)
Set new diffusion coefficient.
Definition IF.h:93
void get_spikes(SpikeTrain &spike_train) override
Obtains spikes by integrating the Langevin equation using an Euler-Maruyama scheme.
Definition IF.cpp:32
friend std::ostream & operator<<(std::ostream &out, const IF &neuron)
Overloads the << operator, so we can print the neuron.
Definition IF.cpp:92
std::normal_distribution< double > dist
normal distribution
Definition IF.h:32
A leaky integrate-and-fire (LIF) neuron.
Definition IF.h:154
double drift(double v) const override
Calculates drift of the LIF, i.e. mu - v.
Definition IF.cpp:123
LIF(double mu, double D)
Constructs an LIF from given parameters.
Definition IF.cpp:111
void print(std::ostream &out) const override
Prints the LIF neuron to out stream.
Definition IF.h:180
Abstract base class for Neurons.
Definition Neuron.h:18
Implements a perfect integrate-and-fire (PIF) neuron.
Definition IF.h:120
PIF(double mu, double D)
Construct PIF from parameters.
Definition IF.cpp:97
double drift(double v) const override
Returns drift of the PIF neuron, i.e. mu.
Definition IF.cpp:109
void print(std::ostream &out) const override
Prints the PIF neuron to out stream.
Definition IF.h:146
An abstract base class for signals.
Definition Signal.h:20
A spike train for discretized times. For a given time discretization with time step dt,...
Definition SpikeTrain.h:18
A time frame with discrete time steps.
Definition TimeFrame.h:13