IzhiNeuron.cpp

Go to the documentation of this file.
00001 
00005 #include "IzhiNeuron.h"
00006 
00007 #include <cmath>
00008 #include <iostream>
00009 using std::cout;
00010 using std::endl;
00011 
00012 
00014 // IzhiNeuronBase
00016 
00017 ThreadSpecificRandomDistribution< NormalDistribution > IzhiNeuronBase::white_noise;
00018 
00019 
00020 IzhiNeuronBase::IzhiNeuronBase(double a, double b, double c, double d, double Vpeak,
00021                                double Vinit, double Inoise, double Iinject, double factI)
00022     : Vpeak(Vpeak), Vinit(Vinit), Inoise(Inoise), Iinject(Iinject)
00023     , a(a), b(b), c(c), d(d), u(0.2*Vinit), Isyn(0.0)
00024     , factI(factI)
00025 {
00026 }
00027 
00028 IzhiNeuronBase::IzhiNeuronBase(string type, double Vinit,
00029                                double Inoise, double Iinject, double factI)
00030     : Vinit(Vinit), Inoise(Inoise), Iinject(Iinject), u(0.2*Vinit), Isyn(0.0)
00031     , factI(factI)
00032 {
00033     Vpeak = 35.0;
00034 
00035     // regular spiking
00036     a=0.02; b=0.2; c=-65.0; d=8.0;
00037 
00038     if(type=="IB"){                     // intrinsically bursting
00039         a=0.02; b=0.2; c=-55.0; d=4.0;
00040     }
00041     else if(type=="CH"){                // chattering
00042         a=0.02; b=0.2; c=-50.0; d=2.0;
00043     }
00044     else if(type=="LTS"){               // low threshold spiking
00045         a=0.02; b=0.25; c=-65.0; d=2.0;
00046     }
00047     else if(type=="TC"){                // thalamo-cortical
00048         a=0.02; b=0.25; c=-65.0; d=0.05;
00049     }
00050     else if(type=="RZ"){                // resonator
00051         a=0.1; b=0.26; c=-65.0; d=2.0;
00052     }
00053     else if(type=="FS"){                // fast spiking
00054         a=0.1; b=0.2; c=-65.0; d=2.0;
00055     }
00056 }
00057 
00058 
00059 int IzhiNeuronBase::advance(AdvanceInfo const &ai)
00060 {
00061     bool register hasFired = false;
00062 
00063     double V=Vm*1000;
00064 
00065     // all synapses have added the contributions to Isyn, we add Iinject    
00066     double Itot = Isyn + Iinject;
00067 
00068     if (Inoise > 0.0) {
00069         Itot += (white_noise() * Inoise);
00070 //        else if(noiseType == 1)
00071 //            Itot += (pink_noise() * Inoise);
00072     }
00073 
00074     Itot *= 1e3;        // mA
00075     Itot *= factI;      // to be tuned ;-)
00076 
00077     Vm = V + dt_msec*(0.04*V*V + 5*V + 140 - u + Itot);
00078 
00079     // numerical stability
00080 //    Vm = V + 0.5*dt_msec*(0.04*V*V + 5*V + 140 - u + Itot);
00081 //    Vm = Vm + 0.5*dt_msec*(0.04*Vm*Vm + 5*Vm + 140 - u + Itot);
00082 
00083     u = u + dt_msec*a*(b*V - u);
00084 
00085     if (Vm >= Vpeak) {         // Note that the neuron has fired!
00086         hasFired = true;
00087         u = u + d;
00088         Vm = c;
00089     }
00090     Vm = Vm/1000.0;
00091 
00092     // clear synaptic input for next time step
00093     clearSynapticInput();
00094 
00095     if (hasFired) {
00096         out_port.setSpike(ai);
00097         return ADVANCEFLAG_HASSPIKED;
00098     }
00099 
00100     return 0;
00101 }
00102 
00103 inline void IzhiNeuronBase::clearSynapticInput(void)
00104 {
00105     Isyn = 0.0;
00106 }
00107 
00108 
00109 int IzhiNeuronBase::adjust(double dt)
00110 {
00111     dt_msec = dt*1000;
00112 
00113 //    pink_noise.adjust(dt);
00114 
00115     return 0;
00116 }
00117 
00118 
00119 int IzhiNeuronBase::reset(double dt)
00120 {
00121     SingleOutputSpikeSender::reset();
00122 
00123     Vm = Vinit;     // set membrane voltage to its initial value
00124     u = 0.0;
00125     clearSynapticInput();
00126     adjust(dt);
00127 
00128     return 0;
00129 }
00130 
00131 
00132 
00134 // IzhiNeuron
00136 
00137 IzhiNeuron::IzhiNeuron(double a, double b, double c, double d, double Vpeak, double Vinit,
00138                        double Inoise, double Iinject, double factI)
00139     : IzhiNeuronBase(a, b, c, d, Vpeak, Vinit, Inoise, Iinject, factI)
00140 {
00141 }
00142 
00143 
00144 IzhiNeuron::IzhiNeuron(string type, double Vinit, double Inoise, double Iinject, double factI)
00145     : IzhiNeuronBase(type, Vinit, Inoise, Iinject, factI)
00146 {
00147 }
00148 
00149 
00150 inline void IzhiNeuron::currentInput(double i)
00151 {
00152     Isyn += i;
00153 }
00154 
00155 
00156 
00158 // CbIzhiNeuron
00160 
00161 CbIzhiNeuron::CbIzhiNeuron(double a, double b, double c, double d, double Vpeak, double Vinit,
00162     double Inoise, double Iinject, double factI)
00163     : IzhiNeuronBase(a, b, c, d, Vpeak, Vinit, Inoise, Iinject, factI)
00164 {
00165 }
00166 
00167 
00168 CbIzhiNeuron::CbIzhiNeuron(string type, double Vinit, double Inoise, double Iinject, double factI)
00169     : IzhiNeuronBase(type, Vinit, Inoise, Iinject, factI)
00170 {
00171 }
00172 
00173 
00174 inline void CbIzhiNeuron::currentInput(double i)
00175 {
00176     Isyn += i;
00177 }
00178 
00179 
00180 inline void CbIzhiNeuron::conductanceInput(double g, double Erev)
00181 {
00182     Isyn += g*(Erev-Vm);
00183 }
00184 
00185 
00187 // ExIzhiNeuronBase
00189 
00190 ExIzhiNeuronBase::ExIzhiNeuronBase(double a, double b, double c, double d,
00191                                    double k, double Vt, double Vr, double Cm,
00192                                    double Vpeak, double Vinit, double Inoise,
00193                                    double Iinject, double factI)
00194     : IzhiNeuronBase(a, b, c, d, Vpeak, Vinit, Inoise, Iinject, factI)
00195     , k(k), Vr(Vr), Vt(Vt), Cm(Cm)
00196 {
00197 }
00198 
00199 
00200 ExIzhiNeuronBase::ExIzhiNeuronBase(string type, double Vinit, double Inoise, double Iinject, double factI)
00201     : IzhiNeuronBase(type, Vinit, Inoise, Iinject, factI)
00202     , k(k), Vr(Vr), Vt(Vt), Cm(Cm)
00203 {
00204     // Cm in pF
00205 
00206     // RS regular spiking
00207     Vpeak=35.0;
00208     k=0.7; Cm=100; Vr=-60.0; Vt=-40.0;
00209     a=0.03; b=-2.0; c=-50.0; d=100.0;
00210 
00211     if(type=="IB"){               // intrinsically bursting
00212         Vpeak=50.0;
00213         k=1.2; Cm=150; Vr=-75.0; Vt=-45.0;
00214         a=0.01; b=5.0; c=-56.0; d=130.0;
00215     }
00216     else if(type=="CH"){          // chattering
00217         Vpeak=25.0;
00218         k=1.5; Cm=50; Vr=-60.0; Vt=-40.0;
00219         a=0.03; b=1.0; c=-40.0; d=150.0;
00220     }
00221     else if(type=="LTS"){         // low threshold spiking
00222         Vpeak=40.0;
00223         k=1; Cm=100; Vr=-56.0; Vt=-42.0;
00224         a=0.03; b=8.0; c=-53.0; d=20.67;
00225     }
00226     else if(type=="FS"){          // fast spiking
00227     // problem nonlinear function for u
00228         Vpeak=50.0;
00229         k=1.2; Cm=150; Vr=-75.0; Vt=-45.0;
00230         a=0.01; b=5.0; c=-56.0; d=130.0;
00231     }
00232 }
00233 
00234 
00235 
00236 int ExIzhiNeuronBase::advance(AdvanceInfo const &ai)
00237 {
00238     bool register hasFired = false;
00239 
00240     double V=Vm*1000;
00241     // all synapses have added the contributions to Isyn, we add Iinject    
00242     double Itot = Isyn + Iinject;
00243 
00244     if (Inoise > 0.0) {
00245         Itot += (white_noise() * Inoise);
00246 //      else if(noiseType == 1)
00247 //          Itot += (pink_noise() * Inoise);
00248     }
00249 
00250     Itot *= 1e12;       // pA
00251     Itot *= factI;      // to be tuned ;-)
00252 
00253     Vm = V + dt_msec*(k*(V-Vr)*(V-Vt) - u + Itot)/Cm;
00254 //    Vm = V + 0.5*dt_msec*(k*(V-Vr)*(V-Vt) - u + Itot)/C;
00255 //    Vm = Vm + 0.5*dt_msec*(k*(Vm-Vr)*(Vm-Vt) - u + Itot)/C;
00256 
00257     u = u + dt_msec*a*(b*(V-Vr) - u);
00258 
00259     if (Vm >= Vpeak) {       // Note that the neuron has fired!
00260         hasFired = true;
00261         u = u + d;
00262         Vm = c;
00263     }
00264     Vm = Vm/1000;
00265 
00266     // clear synaptic input for next time step
00267     clearSynapticInput();
00268 
00269     if (hasFired) {
00270         out_port.setSpike(ai);
00271         return ADVANCEFLAG_HASSPIKED;
00272     }
00273 
00274     return 0;
00275 }
00276 
00277 
00278 
00280 // ExIzhiNeuron
00282 
00283 ExIzhiNeuron::ExIzhiNeuron(double a, double b, double c, double d,
00284                            double k, double Vt, double Vr, double Cm,
00285                            double Vpeak, double Vinit, double Inoise,
00286                            double Iinject, double factI)
00287     : ExIzhiNeuronBase(a, b, c, d, k, Vt, Vr, Cm, Vpeak, Vinit, Inoise, Iinject, factI)
00288 {
00289 }
00290 
00291 
00292 ExIzhiNeuron::ExIzhiNeuron(string type, double Vinit, double Inoise, double Iinject, double factI)
00293     : ExIzhiNeuronBase(type, Vinit, Inoise, Iinject, factI)
00294 {
00295 }
00296 
00297 inline void ExIzhiNeuron::currentInput(double i)
00298 {
00299     Isyn += i;
00300 }
00301 
00302 
00304 // CbExIzhiNeuron
00306 
00307 CbExIzhiNeuron::CbExIzhiNeuron(double a, double b, double c, double d,
00308                                double k, double Vt, double Vr, double Cm,
00309                                double Vpeak, double Vinit, double Inoise,
00310                                double Iinject, double factI)
00311     : ExIzhiNeuronBase(a, b, c, d, k, Vt, Vr, Cm, Vpeak, Vinit, Inoise, Iinject, factI)
00312 {
00313 }
00314 
00315 
00316 CbExIzhiNeuron::CbExIzhiNeuron(string type, double Vinit, double Inoise, double Iinject, double factI)
00317     : ExIzhiNeuronBase(type, Vinit, Inoise, Iinject, factI)
00318 {
00319 }
00320 
00321 
00322 inline void CbExIzhiNeuron::currentInput(double i)
00323 {
00324     Isyn += i;
00325 }
00326 
00327 
00328 inline void CbExIzhiNeuron::conductanceInput(double g, double Erev)
00329 {
00330     Isyn += g*(Erev-Vm);
00331 }
00332 

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