00001
00005 #ifndef _LIFNEURON_H_
00006 #define _LIFNEURON_H_
00007
00008 #include "InputTargetTypes.h"
00009 #include "SpikeSender.h"
00010 #include "SimObject.h"
00011 #include "ThreadSpecificRandomDistribution.h"
00012 #include "PinkGenerator.h"
00013 #include "OUGenerator.h"
00014
00015
00017
00043 class LifNeuronBase : public SimObject, public SingleOutputSpikeSender
00044 {
00045 public:
00046 LifNeuronBase( float Rm = 1e6,
00047 float Cm = 3e-8,
00048 float Vresting =-0.06,
00049 float Vthresh =-0.045,
00050 float Vreset =-0.06,
00051 float Vinit =-0.06,
00052 float Trefract = 3e-3,
00053 float Inoise = 0.0,
00054 float Iinject = 0.0);
00055
00056 virtual ~LifNeuronBase()
00057 {
00058
00059 }
00060
00062 virtual int reset( double dt );
00063
00065 inline bool refractoryQ() { return (nStepsInRefr > 0); };
00066
00067 virtual void clearSynapticInput(void)=0;
00068
00070 float Rm;
00071
00073 float Cm;
00074
00076 float Vresting;
00077
00079 float Vthresh;
00080
00082 float Vreset;
00083
00085 float Vinit;
00086
00088 float Trefract;
00089
00091 float Inoise;
00092
00094 float Iinject;
00095
00096
00098 virtual double getVm()
00099 {
00100 return Vm;
00101 }
00102
00103 virtual double getManagedDelay() const { return 0; }
00104 virtual int nSpikeInputPorts() const { return 0; };
00105 virtual int nSpikeOutputPorts() const { return 1; };
00106 virtual int nAnalogInputPorts() const { return 0; };
00107 virtual int nAnalogOutputPorts() const { return 0; };
00108 virtual PortType outputPortType(port_t o) const
00109 {
00110 if( o==0) return spiking; else return undefined;
00111 };
00112 virtual PortType inputPortType(port_t i) const
00113 {
00114 return undefined;
00115 };
00116
00117
00118 virtual double currentNoiseInput()
00119 {
00120 return 0;
00121 }
00122
00123 protected:
00125 double Vm;
00126
00128 int nStepsInRefr;
00129
00131 double C1,C2,I0;
00132
00134 double _dt;
00135
00137 static ThreadSpecificRandomDistribution< NormalDistribution > noise_gen;
00138
00139 };
00140
00142
00169 class LifNeuron : public LifNeuronBase, public CurrentInputTarget
00170 {
00171 SIMOBJECT( LifNeuron, AdvancePhase::One )
00172
00173 public:
00174 LifNeuron( float Rm = 1e6,
00175 float Cm = 3e-8,
00176 float Vresting =-0.06,
00177 float Vthresh =-0.045,
00178 float Vreset =-0.06,
00179 float Vinit =-0.06,
00180 float Trefract = 3e-3,
00181 float Inoise = 0.0,
00182 float Iinject = 0.0);
00183
00184 virtual ~LifNeuron()
00185 {
00186
00187 }
00188
00190 virtual int adjust( double dt );
00191
00193 virtual int advance(AdvanceInfo const &);
00194
00195 virtual void clearSynapticInput(void);
00196
00197 virtual void currentInput( double Isyn );
00198
00199 private:
00201 double Isyn;
00202
00203 };
00204
00205 inline void LifNeuron::clearSynapticInput(void)
00206 {
00207 Isyn = 0;
00208 }
00209
00210 inline void LifNeuron::currentInput( double i )
00211 {
00212 Isyn += i;
00213 }
00214
00216
00243 class CbLifNeuron : public LifNeuronBase, public ConductanceInputTarget
00244 {
00245
00246 SIMOBJECT( CbLifNeuron, AdvancePhase::One )
00247
00248 public:
00249 CbLifNeuron( float Rm = 1e6,
00250 float Cm = 3e-8,
00251 float Vresting =-0.06,
00252 float Vthresh =-0.045,
00253 float Vreset =-0.06,
00254 float Vinit =-0.06,
00255 float Trefract = 3e-3,
00256 float Inoise = 0.0,
00257 float Iinject = 0.0);
00258
00259 virtual ~CbLifNeuron()
00260 {
00261
00262 }
00263
00265 virtual int adjust( double dt );
00266
00268 virtual int advance(AdvanceInfo const &);
00269
00270 virtual void clearSynapticInput(void);
00271 virtual void currentInput( double Isyn );
00272 virtual void conductanceInput( double g, double Erev );
00273
00275 virtual double getVm()
00276 {
00277 return Vm;
00278 }
00279
00280 virtual double conductanceNoiseInput()
00281 {
00282 return 0;
00283 }
00284
00285 private:
00287 double Isyn;
00289 double Gsyn;
00290
00291 };
00292
00293 inline void CbLifNeuron::clearSynapticInput(void)
00294 {
00295 Isyn = Gsyn = 0;
00296 }
00297
00298 inline void CbLifNeuron::currentInput( double i )
00299 {
00300 Isyn += i;
00301 }
00302
00303 inline void CbLifNeuron::conductanceInput( double g, double Erev )
00304 {
00305 Gsyn += g;
00306 Isyn += (g*Erev);
00307 }
00308
00309 #endif