aEIFNeuron.cpp

Go to the documentation of this file.
00001 
00005 #include "aEIFNeuron.h"
00006 
00007 #include <cmath>
00008 #include <iostream>
00009 using std::cout;
00010 using std::endl;
00011 
00012 
00014 // aEIFNeuronBase
00016 
00017 ThreadSpecificRandomDistribution< NormalDistribution > aEIFNeuronBase::white_noise;
00018 
00019 
00020 aEIFNeuronBase::aEIFNeuronBase(double a, double b, double Vt, double Vr,  double El, double gl,
00021     double Cm, double tau_w, double slope, double Vpeak, double Vinit, double Inoise, double Iinject)
00022     : a(a), b(b), Vt(Vt), Vr(Vr), El(El), gl(gl), Cm(Cm), tau_w(tau_w), slope(slope)
00023     , Vpeak(Vpeak), Vinit(Vinit), Inoise(Inoise), Iinject(Iinject), w(0.0), Isyn(0.0)
00024 {
00025 }
00026 
00027 
00028 int aEIFNeuronBase::advance(AdvanceInfo const &ai)
00029 {
00030     bool register hasFired = false;
00031 
00032     if (Vm >= Vpeak)
00033         Vm = Vr;
00034 
00035     double V=Vm;
00036 
00037     // all synapses have added the contributions to Isyn, we add Iinject    
00038     double Itot = Isyn + Iinject;
00039 
00040     if (Inoise > 0.0) {
00041         Itot += (white_noise() * Inoise);
00042 //      else if(noiseType == 1)
00043 //          Itot += (pink_noise() * Inoise);
00044     }
00045 
00046     Vm = V + _dt*1/Cm*(-gl*(V-El) + gl*slope*exp((V-Vt)/slope) - w + Itot);
00047     w = w + _dt*1/tau_w*(a*(V-El) - w);
00048 
00049     if (Vm >= Vpeak) {         // Note that the neuron has fired!
00050         Vm = 50e-3;
00051         w = w + b;
00052         hasFired = true;
00053     }
00054 
00055     // clear synaptic input for next time step
00056     clearSynapticInput();
00057 
00058     if (hasFired) {
00059         out_port.setSpike(ai);
00060         return ADVANCEFLAG_HASSPIKED;
00061     }
00062 
00063     return 0;
00064 }
00065 
00066 
00067 inline void aEIFNeuronBase::clearSynapticInput(void)
00068 {
00069     Isyn = 0.0;
00070 }
00071 
00072 
00073 int aEIFNeuronBase::adjust(double dt)
00074 {
00075     _dt = dt;
00076 
00077 //    pink_noise.adjust(dt);
00078     clearSynapticInput();
00079 
00080     return 0;
00081 }
00082 
00083 
00084 int aEIFNeuronBase::reset(double dt)
00085 {
00086     SingleOutputSpikeSender::reset();
00087 
00088     Vm = Vinit;     // set membrane voltage to its initial value
00089     w = 0.0;
00090     clearSynapticInput();
00091     adjust(dt);
00092 
00093     return 0;
00094 }
00095 
00096 
00097 
00099 // aEIFNeuron
00101 
00102 aEIFNeuron::aEIFNeuron(double a, double b, double Vt, double Vr, double El, double gl, 
00103     double Cm, double tau_w, double slope, double Vpeak, double Vinit, double Inoise, double Iinject)
00104     : aEIFNeuronBase(a, b, Vt, Vr, El, gl, Cm, tau_w, slope, Vpeak, Vinit, Inoise, Iinject)
00105 {
00106 }
00107 
00108 
00109 inline void aEIFNeuron::currentInput(double i)
00110 {
00111     Isyn += i;
00112 }
00113 
00114 
00115 
00117 // CbaEIFNeuron
00119 
00120 CbaEIFNeuron::CbaEIFNeuron(double a, double b, double Vt, double Vr, double El, double gl, 
00121     double Cm, double tau_w, double slope, double Vpeak, double Vinit, double Inoise, double Iinject)
00122     : aEIFNeuronBase(a, b, Vt, Vr, El, gl, Cm, tau_w, slope, Vpeak, Vinit, Inoise, Iinject)
00123 {
00124 }
00125 
00126 inline void CbaEIFNeuron::currentInput(double i)
00127 {
00128     Isyn += i;
00129 }
00130 
00131 
00132 inline void CbaEIFNeuron::conductanceInput(double g, double Erev)
00133 {
00134     Isyn += g*(Erev-Vm);
00135 }

Generated on Wed Jul 9 16:34:38 2008 for PCSIM by  doxygen 1.5.5