123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732 |
- #ifndef _HPP_LAYER
- #define _HPP_LAYER
- #include <vector>
- #include "simelement.hpp"
- #include "libcsim.hpp"
- enum csimNeuronType {
- csimNType_Izhikevich5,
- csimNType_Izhikevich7,
- csimNType_Izhikevich8,
- csimNType_Izhikevich8_integrator,
- csimNType_Izhikevich9,
- csimNType_MMN02,
- csimNType_DecoLif,
- // add new layer types above here
- csimNumberNTypes
- };
- class SpikeTrain;
- /*! \brief Klasse layer
- * von layer stammen alle layer-Klassen ab
- *
- * Detailed description starts here.
- */
- class layer : public SimElement
- {
- protected:
- float *v, *u;
- std::string SpikeFileName, FileType, MemPotFileName;
- bool Binary;
- float RandomSpikeFrequency;
- int RestProb, nris;
- float NumRandomInputSpikes;
- float RandomInputStrength;
- float NoiseSigma;
- double PoissonLambda;
- float NoiseAmplitude;
- float BalancedInhibition;
- void ThrowTooManySpikes(int time);
- bool TooManySpikes;
- private:
- SpikeTrain* mSpikeTrain;
- public:
- T_NNeurons N;
- T_NNeurons Nx, Ny; // numbers of raws and collumns for 2d layer
- T_NNeurons NNeurons() {
- return N;
- };
- T_NNeurons NeuronsNx() {
- return Nx;
- };
- T_NNeurons NeuronsNy() {
- return Ny;
- };
- vector2d *Pos;
- vector<vector2d> mPositions;
- bool NormPos;
- int N_firings; // the number of fired neurons
- int last_N_firings;
- int **firings;
- int N_firings_max;
- int Dmax;
- float *Input; // input current
-
- layer (int n=1000);
- virtual ~layer();
- virtual void hallo();
- virtual int proceede(int);
- virtual int prepare(int =0);
- virtual int reset(int);
- virtual int SetupPositions();
- virtual int SetupPositions(int _nx, int ny, bool Normalize=false);
- virtual int SetupPositionsShift(int _nx, int ny, float xshift,float yshift, bool Normalize=false);
- virtual int SetupPositionsLinDiscrete(int NeuronsPerPatch);
- const vector<vector2d>& getPositions();
- bool isPositionNormalized() {return NormPos;}
- virtual void SetName(const char*);
- void SetSpikeFileName(char*);
- void SetRandomInputStrength(float);
- void SetRandomSpikeFrequency(float);
- void SetNoiseSigma(float);
- void SetBalancedInhibition(float);
- void SetNoiseAmplitude(float);
- int TuneNoiseAmplitude(float DesiredFrequency);
- int TuneBalancedInhibition(float DesiredFrequency);
- virtual float* GetInputPointer(csimInputChannel);
- virtual float* GetPspPointer(csimInputChannel);
- virtual int StartBinRec(int n, int StartNumber=0);
- virtual long calcMemoryConsumption();
-
- float GetDt();
- virtual int SaveSimInfo();
- virtual int WriteSimInfo(fstream &fw);
- virtual int WriteSimInfo(fstream &fw, const string &ChildInfo);
- virtual SpikeTrain* GetSpikeTrain();
- };
- struct LevyShuntingParas {
- LevyShuntingParas(float _k0, float _k1, float _k2, float _kffi, float _kfbi)
- : K0(_k0), K1(_k1), K2(_k2), Kffi(_kffi), Kfbi(_kfbi)
- {}
- float K0,K1, K2, Kffi, Kfbi;
- } ;
- static const LevyShuntingParas DefaultShunt (1,4,4,1,1);
- class liflayer : public layer
- {
- protected:
- float TauM; // membrane time constant
- float TauMfac;
- float Threshold;
- float K0,K1, K2, Kffi, Kfbi; // inhibition parameters
- float InputSaturation;
- float TauS; // synaptic time constant
- float TauSfac;
- int *LastSpike;
- float* mquer; // number of spikes in last ms
- float* squer;
- float RunAvgFac;
- float Iinh;
- int InhibitionDelay; // in timesteps =(ms/dt)
- int RefractoryPeriod;
- public:
- liflayer(
- int n,
- float tau=20, float thresh=0.0033, float k0=1,
- float k1=4, float k2=4, float kffi=1, float kfbi=1,
- float taus=2, float _InputSat=1.0, float _NoiseSigma=0);
- ~liflayer();
- virtual int proceede(int);
- virtual int prepare(int =0);
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- int InitInhibitionPot(float _mquer, float _squer);
- int SetKfbi(float);
- float *Input1;
- };
- // leaky integrate and fire neuron with theta rhythmic deactivation of recurrent input
- class thetaliflayer: public liflayer
- {
- protected:
- int ThetaPeriod; // in ms
- int ThetaPhase;
- bool ThetaOn;
- public:
- thetaliflayer(
- int n,
- float tau=20, float thresh=0.0033, float k0=1,
- float k1=4, float k2=4, float kffi=1, float kfbi=1,
- float taus=2, float _InputSat=1.0, float _NoiseSigma=0,
- int _ThetaPeriod=100);
- ~thetaliflayer();
- virtual int proceede(int);
- virtual int prepare(int =0);
- void SetThetaOn(bool status);
- };
- // leaky integrate and fire neuron with adaptive synapses to inhibitory interneuron
- class lif2layer: public liflayer
- {
- private:
- float *Dinh;
- float DesiredActivity;
- float *InhibitoryActivity;
- float PyrToInhLearningRate;
- bool learnpti;
- float TauInhLearn;
- float InhLearnFac;
- public:
- lif2layer(int, float =20, float =0.0033, float =1, float =4, float=4, float=1, float=1, float =2, float =0.012, float =0.1);
- ~lif2layer();
- virtual int proceede(int);
- virtual int prepare(int =0);
- int SetLearnPti(bool);
- };
- struct IzhParas {
- IzhParas(float a, float b, float c, float d, float e, float f, float sigma=0): A(a), B(b), C(c), D(d), E(e), F(f) {}
- float A, B, C, D, E, F, sigma;
- int print();
- };
- static const IzhParas IzhParaRegularSpiking (0.02, 0.2 , -65, 8. , 140, 5. , 0.0);
- static const IzhParas IzhParaIntrinsicallyBursting(0.02, 0.2 , -55, 4. , 140, 5. , 0.0);
- static const IzhParas IzhParaChattering (0.02, 0.2 , -50, 2. , 140, 5. , 0.0);
- static const IzhParas IzhParaFastSpiking (0.1 , 0.2 , -65, 2. , 140, 5. , 0.0);
- static const IzhParas IzhParaLowThreshold (0.02, 0.25, -65, 2. , 140, 5. , 0.0);
- static const IzhParas IzhParaThalamoCortical (0.02, 0.25, -65, 0.05, 140, 5. , 0.0);
- static const IzhParas IzhParaResonator (0.1 , 0.26, -65, 2. , 140, 5. , 0.0);
- static const IzhParas IzhParaIntegrator (0.02, -0.1, -55, 6. , 108, 4.1, 0.0);
- static const IzhParas IzhParaIntegrator2 (0.02, -0.1, -55, 6. , 110, 4.1, 0.0);
- static const IzhParas IzhParaClass2 (0.2 , 0.26, -65, 0. , 139, 5. , 0.0);
- static const IzhParas IzhLowDIntegrator (0.02, -0.1, -55, 2. , 108, 4.1, 0.0);
- enum IzhType {Integrator, FastSpiking};
- class izhlayer : public layer
- {
- protected:
- float A, B, C, D, E, F; //first version: uniform dynamics, same parameters for every neuron
- // of the layer; later a,b,c... have to be pointers
- float TauS; // synaptic time constant
- float TauSfac;
- float TauInh, TauInhFac; // inhibitory synaptic time constant
- float EquilibriumPot;
- int InitEquilibriumPotentials();
- float *ExSynPot; // excitatory synaptic potential
- // float *InhInput; // Inhibitory Input
- float *InhSynPot; // ShuntingInhibitionPotential
- float InputSaturation;
- float InhInputSaturation;
- int Init();
- public:
- izhlayer(int n=1000, float a=0.02, float b=-0.1, float c=-55, float d=4, float e=108, float f=4.1, float _InputSat=1, float _InhInputSat=1);
- izhlayer(int n=1000, IzhParas _paras=IzhParaIntegrator, float _InputSat=1, float _InhInputSat=1);
- izhlayer(IzhType type, int n=1000, float _InputSat=30, float _InhInputSat=1);
- ~izhlayer();
- virtual int proceede(int);
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- virtual int StartBinRec(int n, int StartNumber=0);
- virtual int SetTauInh(float _TauInh);
- virtual int SetTauEx(float _TauEx);
- virtual int WriteSimInfo(fstream &fw);
- virtual int WriteSimInfo(fstream &fw, const string &ChildInfo);
- };
- // inhibitory potential is also subtracted from membrane potential v
- class izh2layer : public izhlayer
- {
- protected:
- public:
- izh2layer(int n=1000, float a=0.02, float b=-0.1, float c=-55, float d=4, float e=108, float f=4.1, float _InputSat=1);
- izh2layer(int n=1000, IzhParas _paras=IzhParaIntegrator, float _InputSat=1);
- ~izh2layer();
- virtual int proceede(int);
- };
- // conductance based inhibition, noise is addet to excitatory input
- class izh3layer : public izhlayer
- {
- protected:
- float InhReversePot;
- public:
- float *InhInput; // inhibitory input current
- izh3layer(int n=1000, float a=0.02, float b=-0.1, float c=-55, float d=4, float e=108, float f=4.1, float _InputSat=1, float IRPotDiff=10, float _InhInputSaturation=1);
- izh3layer(int n=1000, IzhParas _paras=IzhParaIntegrator, float _InputSat=1, float IRPotDiff=10, float _InhInputSaturation=1);
- ~izh3layer();
- virtual int proceede(int);
- virtual float* GetInputPointer(csimInputChannel InputNumber=csimInputChannel_AMPA);
- };
- // conductance based inhibition, noise is addet to excitatory input
- // plus linking input
- class izh4layer : public izh3layer
- {
- protected:
- float TauLink, TauLinkFac;
- float *LinkSynPot; // LinkingInputPotential
- public:
- izh4layer(int n=1000, IzhParas _paras=IzhParaIntegrator, float _InputSat=1, float IRPotDiff=10, float _TauLink=10);
- ~izh4layer();
- virtual int proceede(int);
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- };
- // my currend STANDARD IZH-Neuron
- // conductance based inhibition, noise is addet to excitatory input
- // like izh3layer, but input saturation occurs before adding synaptic
- // input to the membrane potential and not before adding input to
- // synaptic potential.
- class izh5layer : public izhlayer
- {
- protected:
- float InhReversePot;
- public:
- izh5layer(int n=1000, float a=0.02, float b=-0.1, float c=-55, float d=4, float e=108, float f=4.1, float _InputSat=200, float IRPotDiff=10, float _InhInputSaturation=4.5);
- izh5layer(int n=1000, IzhParas _paras=IzhParaIntegrator, float _InputSat=200, float IRPotDiff=10, float _InhInputSaturation=4.5);
- ~izh5layer();
- virtual int proceede(int);
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- };
- // like izh5layer,
- // but with additionall NMDA conductance
- class izh6layer : public izhlayer
- {
- protected:
- float InhReversePot;
- float *NmdaSynPot; // NMDA synaptic potential
- float NmdaSaturation;
- float TauNmda, TauNmdaFac;
- float NmdaAmpaRatio;
- public:
- izh6layer(int n=1000, IzhParas _paras=IzhParaIntegrator, float _InputSat=200, float IRPotDiff=10, float _InhInputSaturation=4.5, float _NmdaInputSaturation=10);
- ~izh6layer();
- virtual int proceede(int);
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- virtual void SetNmdaAmpaRatio(float ratio);
- virtual void SetTauNmda(float value);
- virtual int WriteSimInfo(fstream &fw);
- virtual int StartBinRec(int n, int StartNumber=0);
- };
- inline double DoubleExpCorrectionFactor(double Tau1, double Tau2)
- {
- double PeakTime = log(Tau2/Tau1)/(1/Tau1 - 1/Tau2);
- return 1.0/(exp(-PeakTime/Tau2)-exp(-PeakTime/Tau1));
- }
- // like izh6layer,
- // but with double exponential PSPs (with rise and fall time constants)
- class izh7layer : public izhlayer
- {
- protected:
- float InhReversePot;
- float *NmdaRisePot; // NMDA synaptic potential
- float *NmdaFallPot; // NMDA synaptic potential
- float *AmpaRisePot; // AMPA synaptic potential
- float *AmpaFallPot; // AMPA synaptic potential
- float *GabaRisePot; // GABA synaptic potential
- float *GabaFallPot; // GABA synaptic potential
- float *InhInput;
- float *NmdaAmpaInput;
- float NmdaSaturation;
- float TauAmpaRise, TauAmpaFall, TauAmpaRiseFac, TauAmpaFallFac;
- float TauGabaRise, TauGabaFall, TauGabaRiseFac, TauGabaFallFac;
- float TauNmdaRise, TauNmdaFall, TauNmdaRiseFac, TauNmdaFallFac;
- float AmpaCorr, GabaCorr, NmdaCorr;
- float NmdaAmpaRatio;
- public:
- izh7layer(int n=1000, IzhParas _paras=IzhParaIntegrator, float _InputSat=200, float IRPotDiff=10, float _InhInputSaturation=4.5, float _NmdaInputSaturation=10);
- ~izh7layer();
- virtual int proceede(int);
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- virtual void SetNmdaAmpaRatio(float ratio);
- virtual void SetTauNmda(float rise, float fall);
- virtual void SetTauAmpa(float rise, float fall);
- virtual void SetTauGaba(float rise, float fall);
- virtual int WriteSimInfo(fstream &fw);
- virtual int StartBinRec(int n, int StartNumber=0);
- };
- // like izh6layer,
- // but with double exponential PSPs (with rise and fall time constants)
- // and NO input saturation
- class izh8layer : public izhlayer
- {
- protected:
- float InhReversePot;
- float *NmdaRisePot; // NMDA synaptic potential
- float *NmdaFallPot; // NMDA synaptic potential
- float *AmpaRisePot; // AMPA synaptic potential
- float *AmpaFallPot; // AMPA synaptic potential
- float *AmpaPot; // AMPA synaptic potential (fall-rise)
- float *GabaRisePot; // GABA synaptic potential
- float *GabaFallPot; // GABA synaptic potential
- float *InhInput;
- float *NmdaAmpaInput;
- float TauAmpaRise, TauAmpaFall, TauAmpaRiseFac, TauAmpaFallFac;
- float TauGabaRise, TauGabaFall, TauGabaRiseFac, TauGabaFallFac;
- float TauNmdaRise, TauNmdaFall, TauNmdaRiseFac, TauNmdaFallFac;
- float AmpaCorr, GabaCorr, NmdaCorr;
- float NmdaAmpaRatio;
- public:
- izh8layer(int n=1000, IzhParas _paras=IzhParaIntegrator, float IRPotDiff=10);
- ~izh8layer();
- virtual int proceede(int);
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- virtual float* GetPspPointer(csimInputChannel);
- virtual void SetNmdaAmpaRatio(float ratio);
- virtual void SetTauNmda(float rise, float fall);
- virtual void SetTauAmpa(float rise, float fall);
- virtual void SetTauGaba(float rise, float fall);
- virtual int WriteSimInfo(fstream &fw);
- virtual int StartBinRec(int n, int StartNumber=0);
- };
- // like izh8layer,
- // but with GabaA and GabaB inhibition
- class izh9layer : public izhlayer
- {
- protected:
- float InhReversePot;
- float *NmdaRisePot; // NMDA synaptic potential
- float *NmdaFallPot; // NMDA synaptic potential
- float *AmpaRisePot; // AMPA synaptic potential
- float *AmpaFallPot; // AMPA synaptic potential
- float *AmpaPot; // AMPA synaptic potential (fall-rise)
- float *GabaARisePot; // GABA synaptic potential
- float *GabaAFallPot; // GABA synaptic potential
- float *GabaBRisePot; // GABA synaptic potential
- float *GabaBFallPot; // GABA synaptic potential
- float *InhInput;
- float *NmdaAmpaInput;
- float NmdaSaturation;
- float TauAmpaRise, TauAmpaFall, TauAmpaRiseFac, TauAmpaFallFac;
- float TauGabaARise, TauGabaAFall, TauGabaARiseFac, TauGabaAFallFac;
- float TauGabaBRise, TauGabaBFall, TauGabaBRiseFac, TauGabaBFallFac;
- float TauNmdaRise, TauNmdaFall, TauNmdaRiseFac, TauNmdaFallFac;
- float AmpaCorr, GabaACorr, GabaBCorr, NmdaCorr;
- float NmdaAmpaRatio;
- float GabaABRatio;
- float GabaBReversePot;
- public:
- izh9layer(int n=1000, IzhParas _paras=IzhParaIntegrator, float GabaARPotDiff=0, float GabaBRPotDiff=30);
- ~izh9layer();
- virtual int proceede(int);
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- virtual float* GetPspPointer(csimInputChannel);
- virtual void SetNmdaAmpaRatio(float ratio);
- virtual void SetGabaABRatio(float ratio);
- virtual void SetTauNmda(float rise, float fall);
- virtual void SetTauAmpa(float rise, float fall);
- virtual void SetTauGabaA(float rise, float fall);
- virtual void SetTauGabaB(float rise, float fall);
- virtual int WriteSimInfo(fstream &fw);
- virtual int StartBinRec(int n, int StartNumber=0);
- };
- // izhikevich neuron layer with levy like global shunting inhibition
- class izhshuntlayer : public izhlayer
- {
- protected:
- LevyShuntingParas inh; // inhibition parameters
- /* float TauS; // synaptic time constant */
- /* float TauSfac; */
- // int *LastSpike;
- float* mquer; // running average of last spikes
- float* squer; // input running avarage
- float RunAvgFac;
- float Iinh;
- int InhibitionDelay; // in timesteps =(ms/dt)
- float NoiseSigma;
- float *Input1;
- public:
- izhshuntlayer(
- int n=1000, IzhParas _paras=IzhParaIntegrator,
- LevyShuntingParas _shuntparas= DefaultShunt,
- float _InputSat=60.0, float _NoiseSigma=0);
- ~izhshuntlayer();
- virtual int proceede(int);
- virtual int prepare(int step);
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- int SetKfbi(float);
- };
- // izhkevich neuron layer with levy like global shunting inhibition
- // and presynaptic inhibition of recurrent excitation
- class PresynIzhShuntLayer: public izhshuntlayer
- {
- protected:
- float *PresynInhInput; // input nr 2
- public:
- PresynIzhShuntLayer(
- int n=1000, IzhParas _paras=IzhParaIntegrator,
- LevyShuntingParas _shuntparas= DefaultShunt,
- float _InputSat=60.0, float _NoiseSigma=0);
- ~PresynIzhShuntLayer();
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- virtual int proceede(int TotalTime);
- };
- class MMN01Layer: public layer
- {
- protected:
- float TauFeeding, FeedingFac;
- float TauThreshold, ThresholdFac;
- float RestingThreshold, ThresInc;
- float *inh;
- public:
- MMN01Layer(int n=1000, float _TauThres=10,
- float _RestingThres=1, float _ThresInc=1,
- float _TauFeeding=10);
- ~MMN01Layer();
- virtual int proceede(int TotalTime);
- virtual float* GetInputPointer(csimInputChannel);
- virtual int StartBinRec(int n, int StartNumber=0);
- };
- // mit Inhibitorischem Potential
- class MMN02Layer: public MMN01Layer
- {
- protected:
- float TauInhibition, InhibitionFac;
- public:
- MMN02Layer(int n=1000, float _TauThres=10,
- float _RestingThres=1, float _ThresInc=1,
- float _TauFeeding=10, float _TauInhibition=10);
- ~MMN02Layer();
- virtual int proceede(int TotalTime);
- virtual float* GetInputPointer(csimInputChannel);
- virtual int StartBinRec(int n, int StartNumber=0);
- };
- // mit Linking-Potential
- class MMN03Layer: public MMN02Layer
- {
- protected:
- float TauLinking, LinkingFac;
- float *Linking;
- public:
- MMN03Layer(int n=1000, float _TauThres=10,
- float _RestingThres=1, float _ThresInc=1,
- float _TauFeeding=2.4, float _TauInhibition=7, float _TauLinking=10);
- ~MMN03Layer();
- virtual int proceede(int TotalTime);
- virtual float* GetInputPointer(csimInputChannel);
- virtual int StartBinRec(int n, int StartNumber=0);
- virtual int reset(int t);
- virtual int WriteSimInfo(fstream &fw);
- };
- class MMN04Layer: public MMN03Layer
- {
- protected:
- float TauEnduFeeding, EnduFeedingFac;
- float TauEnduLinking, EnduLinkingFac;
- float *endu;
- float *enduL;
- float *v_Self;
- public:
- MMN04Layer(int n=1000, float _TauThres=10,
- float _RestingThres=1, float _ThresInc=1,
- float _TauFeeding=2.4, float _TauInhibition=7, float _TauLinking=2.4, float _TauEnduFeeding=100, float _TauEnduLinking=100);
- ~MMN04Layer();
- virtual int proceede(int TotalTime);
- virtual float* GetInputPointer(csimInputChannel);
- virtual int StartBinRec(int n, int StartNumber=0);
- virtual int reset(int t);
- virtual int WriteSimInfo(fstream &fw);
- };
- class MMN05Layer: public MMN03Layer
- {
- protected:
- float TauEnduFeeding, EnduFeedingFac;
- float TauEnduLinking, EnduLinkingFac;
- float *endu;
- float *enduL;
- float *v_Self;
- public:
- MMN05Layer(int n=1000, float _TauThres=10,
- float _RestingThres=1, float _ThresInc=1,
- float _TauFeeding=2.4, float _TauInhibition=7, float _TauLinking=2.4, float _TauEnduFeeding=100, float _TauEnduLinking=100);
- ~MMN05Layer();
- virtual int proceede(int TotalTime);
- virtual float* GetInputPointer(csimInputChannel);
- virtual int StartBinRec(int n, int StartNumber=0);
- virtual int reset(int t);
- virtual int WriteSimInfo(fstream &fw);
- };
- /*! \brief Klasse AmpaNmdaGabaChannels
- * kuemmert sich um alle Arrays fuer NMDA, AMPA, GABAa und GABAb-Synapsen
- *
- * Detailed description starts here.
- */
- class AmpaNmdaGabaChannels
- {
- private:
- float DeltaT;
- SimLoop* MainSimLoop;
- int NNeurons;
- protected:
- float *NmdaRisePot; // NMDA synaptic potential
- float *NmdaFallPot; // NMDA synaptic potential
- float *AmpaRisePot; // AMPA synaptic potential
- float *AmpaFallPot; // AMPA synaptic potential
- float *AmpaPot; // AMPA synaptic potential (fall-rise)
- float *GabaARisePot; // GABAa synaptic potential
- float *GabaAFallPot; // GABAa synaptic potential
- float *GabaBRisePot; // GABAb synaptic potential
- float *GabaBFallPot; // GABAb synaptic potential
- float *InhInput;
- float *NmdaAmpaInput;
- float NmdaSaturation;
- float TauAmpaRise, TauAmpaFall, TauAmpaRiseFac, TauAmpaFallFac;
- float TauGabaARise, TauGabaAFall, TauGabaARiseFac, TauGabaAFallFac;
- float TauGabaBRise, TauGabaBFall, TauGabaBRiseFac, TauGabaBFallFac;
- float TauNmdaRise, TauNmdaFall, TauNmdaRiseFac, TauNmdaFallFac;
- float AmpaCorr, GabaACorr, GabaBCorr, NmdaCorr;
- float NmdaAmpaRatio;
- float NmdaAmpaEPSPRatio;
- float GabaABRatio;
- float NaReversePot;
- float GabaAReversePot;
- float GabaBReversePot;
- public:
- AmpaNmdaGabaChannels(int N,
- float TauAmpaRise=0.5,
- float TauAmpaFall=2.4,
- float TauNmdaRise=5.5,
- float TauNmdaFall=100,
- float TauGabaARise=1.0,
- float TauGabaAFall=7.0,
- float TauGabaBRise=13.5,
- float TauGabaBFall=140,
- float GabaABRatio=0.0,
- float NmdaAmpaRatio=0.0);
-
- ~AmpaNmdaGabaChannels();
- virtual void SetTauNmda(float rise, float fall);
- virtual void SetTauAmpa(float rise, float fall);
- virtual void SetTauGabaA(float rise, float fall);
- virtual void SetTauGabaB(float rise, float fall);
- virtual void SetNmdaAmpaRatio(float ratio);
- long calcMemConsumption();
- void WriteSimInfo(stringstream &sstr);
- virtual void reset();
- };
- struct DecoParas {
- DecoParas(float a, float b, float c, float d, float e, float f, float g):
- RestingPot(a),
- ResetPot(b),
- Threshold(c),
- CMembrane(d),
- GLeak(e),
- AbsoluteRefractoryPeriod(f),
- SpikePot (g) {}
- float RestingPot, ResetPot, Threshold, CMembrane, GLeak, AbsoluteRefractoryPeriod, SpikePot;
- int print();
- };
- static const DecoParas DecoParaExcitatory (-70,-55,-50,0.5,25,1,-40);
- static const DecoParas DecoParaInhibitory (-70,-55,-50,0.2,20,1,-40);
- /*! \brief Klasse DecoLifLayer
- * Implementation eines leaky integrate-and-fire neurons nach Deco und rolls 2005
- *
- * inspired by Deco and Rolls 2005,
- * "Neurodynamics of biased competition and cooperation for attention:
- * A model with spiking neurons., Journal of Neurophysiology, 94:295-331
- */
- //
- class DecoLifLayer: public layer, public AmpaNmdaGabaChannels
- {
- protected:
- float RestingPot; // etwa -60 bis -70 mV
- float ResetPot; // ==RestingPot
- float Threshold; // 40-50 mV
- float TauMembrane; // Membran-Zeitkonstante, meist 20 ms
- float CMembrane; // Membran-Kapazitaet, nach Deco/Rolls 2005: 0.5nF bzw. 0.2 nF fuer ex/inh Neuronen
- float CMembraneFac; //==dt/CMembrane;
- float GLeak; // leak conductance, Deco/Rolls 2005: 25nS/20nS for ex/inh neurons
- int* Refractory;
- float AbsoluteRefractoryPeriod;
- int arf;
- float SpikePot;
- int t;
- public:
- DecoLifLayer(int n, DecoParas Paras=DecoParaExcitatory);
- ~DecoLifLayer();
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- virtual float* GetPspPointer(csimInputChannel);
- virtual int proceede(int);
- virtual int WriteSimInfo(fstream &fw);
- virtual int StartBinRec(int n, int StartNumber=0);
- virtual int reset(int t);
- virtual long calcMemoryConsumption();
- int proceedeInThread(int TotalTime);
- int calculateInThread(int Start_Index, int Stop_Index);
- };
- //Hodgkin-Huxley-Model-Neuron
- enum HodgHuxGate {HodgHux_h,HodgHux_m,HodgHux_n};
- class HodgHuxLayer : public layer, public AmpaNmdaGabaChannels
- {
- protected:
- float *hAlphaArr,*mAlphaArr,*nAlphaArr,*hBetaArr,*mBetaArr,*nBetaArr;
- float VL,VNa,VK,gL,gNa,gK,CM,VShift,SpikeDetectionThreshold;
- float hParas[6],mParas[6],nParas[6];
- float *hNa,*mNa,*nK,*M;
- float Mmin,Mmax,Mstart;
- int MN;
- bool *alreadySpiked;
- public:
- HodgHuxLayer(int n,float vl=10.6,float vna=120.,float vk=-12.,float gl=0.3,float gna=120.,float gk=36.,float cm=1.,float vshift=70,float spikedetectionthreshold=50,float mmin=-100,float mmax=200,float mstart=-65, int mn=1000);
- ~HodgHuxLayer();
- virtual int proceede(int);
- void setxAlphaBeta(HodgHuxGate ,float [6]);
- int M2index(float );
- virtual float* GetInputPointer(csimInputChannel num=csimInputChannel_AMPA);
- virtual int WriteSimInfo(fstream &fw);
- virtual int StartBinRec(int n, int StartNumber=0);
- };
- /////////////////
- #endif /*_HPP_LAYER */
|