00001 /*!@file ModelNeuron/Synapse.H Class to represent a synapse */ 00002 00003 // //////////////////////////////////////////////////////////////////// // 00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00005 // University of Southern California (USC) and the iLab at USC. // 00006 // See http://iLab.usc.edu for information about this project. // 00007 // //////////////////////////////////////////////////////////////////// // 00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00010 // in Visual Environments, and Applications'' by Christof Koch and // 00011 // Laurent Itti, California Institute of Technology, 2001 (patent // 00012 // pending; application number 09/912,225 filed July 23, 2001; see // 00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00014 // //////////////////////////////////////////////////////////////////// // 00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00016 // // 00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00018 // redistribute it and/or modify it under the terms of the GNU General // 00019 // Public License as published by the Free Software Foundation; either // 00020 // version 2 of the License, or (at your option) any later version. // 00021 // // 00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00025 // PURPOSE. See the GNU General Public License for more details. // 00026 // // 00027 // You should have received a copy of the GNU General Public License // 00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00030 // Boston, MA 02111-1307 USA. // 00031 // //////////////////////////////////////////////////////////////////// // 00032 // 00033 // Primary maintainer for this file: David Berg <dberg@usc.edu> 00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/ModelNeuron/Synapse.H $ 00035 00036 #ifndef MODELNEURON_SYNAPSE_H_DEFINED 00037 #define MODELNEURON_SYNAPSE_H_DEFINED 00038 00039 #include "ModelNeuron/LowPass.H" 00040 #include<cmath> 00041 00042 #define GMAX 40.0 00043 // ###################################################################### 00044 //! A collection of functors to compute current (pA) across a 00045 //! synapse given the conductance (millisiemens) and membrane voltage 00046 //! (mV). Functors should define the following functions and data: 00047 //! 00048 //! static const double tau = <time constant> 00049 //! static const Type name = <type name (integer)> 00050 //! static const char* name(); 00051 //! const double operator()(const double& conductance, 00052 //! const double& voltage) const; 00053 //! void setVoltage(const double& voltage); 00054 //! 00055 //! from Izhikevich (2008, 2004), Dayan and abbot (2001). 00056 // ###################################################################### 00057 namespace Receptor 00058 { 00059 //integer names for our types 00060 enum Type {AMPAR, NMDAR, GABAAR, GABABR}; 00061 00062 // ###################################################################### 00063 //!return current from AMPA receptor 00064 // ###################################################################### 00065 struct AMPA 00066 { 00067 constexpr static double tau = 5.0; 00068 constexpr static Type id = AMPAR; 00069 constexpr static const char* name() { return "AMPA"; }; 00070 00071 AMPA() : membrane_voltage(0.0) { }; 00072 00073 const double operator()(const double& g) const 00074 { return g * (membrane_voltage - 0.0); }; 00075 00076 void setVoltage(const double& v) { membrane_voltage = v; }; 00077 00078 double membrane_voltage; //the last external voltage (mV) 00079 }; 00080 00081 // ###################################################################### 00082 //!return current from NMDA receptor 00083 // ###################################################################### 00084 struct NMDA 00085 { 00086 constexpr static double tau = 150.0; 00087 constexpr static Type id = NMDAR; 00088 constexpr static const char* name() { return "NMDA"; }; 00089 00090 NMDA() : membrane_voltage(0.0) { }; 00091 00092 const double operator()(const double& g) const 00093 { 00094 double temp = ((membrane_voltage+80.0)/60.0) * 00095 ((membrane_voltage+80.0)/60.0); 00096 return g * ( temp / (1.0 + temp) ) * (membrane_voltage - 0.0); 00097 } 00098 00099 void setVoltage(const double& v) { membrane_voltage = v; }; 00100 00101 double membrane_voltage; //the last external voltage (mV) 00102 }; 00103 00104 // ###################################################################### 00105 //!return current from GABAA receptor 00106 // ###################################################################### 00107 struct GABAA 00108 { 00109 constexpr static double tau = 6.0; 00110 constexpr static Type id = GABAAR; 00111 constexpr static const char* name() { return "GABAA"; }; 00112 00113 GABAA() : membrane_voltage(0.0) { }; 00114 00115 const double operator()(const double& g) const 00116 { return g * (membrane_voltage + 70.0); }; 00117 00118 void setVoltage(const double& v) { membrane_voltage = v; }; 00119 00120 double membrane_voltage; //the last external voltage (mV) 00121 }; 00122 00123 // ###################################################################### 00124 //!return current from GABAB receptor 00125 // ###################################################################### 00126 struct GABAB 00127 { 00128 constexpr static double tau = 150.0; 00129 constexpr static Type id = GABABR; 00130 constexpr static const char* name() { return "GABAB"; }; 00131 00132 GABAB() : membrane_voltage(0.0) { }; 00133 00134 const double operator()(const double& g) const 00135 { return g * (membrane_voltage + 90.0); }; 00136 00137 void setVoltage(const double& v) { membrane_voltage = v; }; 00138 00139 double membrane_voltage; //the last external voltage (mV) 00140 }; 00141 } 00142 // ###################################################################### 00143 //! A class to represent the overall effect of a large number of 00144 //! synapses of a particular type, which is modeled by a simple first 00145 //! order differential: 00146 //! 00147 //! dg/dt = -g/tau + I, where tau is the decay constant in 00148 //! milliseconds, I is the number of spikes received and g is the 00149 //! conductance in millisiemens. 00150 //! 00151 //! The first template argument should be a functor that descibes the 00152 //! synapses current-voltage relationship.Several suitable functors 00153 //! for standard channel types are defined in class Receptor, given 00154 //! above. The second template paramter should be the integration 00155 //! method as descibed in LowPass.H. 00156 //! ###################################################################### 00157 template <class SynType, class IntType = LowPassExpEuler> 00158 class Synapse: public SimUnit, public IntType 00159 { 00160 public: 00161 //! Constructor with default params 00162 Synapse(const SimTime& timestep = SimTime::MSECS(1.0)); 00163 00164 //! destructor 00165 ~Synapse(); 00166 00167 //! set current voltage 00168 void setV(const double& v); 00169 00170 //! get the display output 00171 const double getDisplayOutput() const; 00172 00173 //! set current maximum conductance 00174 void setGmax(const double& gmax); 00175 00176 private: 00177 //! integrate our internals 00178 const double doIntegrate(const SimTime& dt, 00179 const double& inpe, const double& inh); 00180 00181 //!initialize 00182 void doInit(); 00183 00184 //!return a copy of this object 00185 Synapse<SynType, IntType>* doClone() const; 00186 00187 double itsGmax; //maximum conductance (mS) 00188 double itsG; // internal state 00189 SynType getCurrent; // our current (pA) 00190 }; 00191 00192 typedef Synapse<Receptor::AMPA, LowPassExpEuler> AMPASynapse; 00193 typedef Synapse<Receptor::NMDA, LowPassExpEuler> NMDASynapse; 00194 typedef Synapse<Receptor::GABAA, LowPassExpEuler> GABAASynapse; 00195 typedef Synapse<Receptor::GABAB, LowPassExpEuler> GABABSynapse; 00196 00197 // ###################################################################### 00198 // ##### implementation for Synapse 00199 // ###################################################################### 00200 template <class SynType, class IntType> inline 00201 Synapse<SynType, IntType>::Synapse(const SimTime& timestep) : 00202 SimUnit(timestep, IntType::RateType, std::string(SynType::name()) + " Synapse", "pA"), 00203 IntType(timestep.msecs(), 0.0, SynType::tau), itsGmax(GMAX), itsG(0.0), getCurrent() { }; 00204 00205 // ###################################################################### 00206 template <class SynType, class IntType> inline 00207 Synapse<SynType, IntType>::~Synapse() 00208 { } 00209 00210 // ###################################################################### 00211 template <class SynType, class IntType> inline 00212 void Synapse<SynType, IntType>::setV(const double& v) 00213 { 00214 getCurrent.setVoltage(v); 00215 } 00216 00217 // ###################################################################### 00218 template <class SynType, class IntType> inline 00219 const double Synapse<SynType, IntType>::getDisplayOutput() const 00220 { 00221 return itsG; 00222 } 00223 00224 // ###################################################################### 00225 template <class SynType, class IntType> inline 00226 void Synapse<SynType, IntType>::setGmax(const double& gmax) 00227 { 00228 itsGmax = gmax; 00229 } 00230 00231 // ###################################################################### 00232 template <class SynType, class IntType> inline 00233 const double 00234 Synapse<SynType, IntType>::doIntegrate(const SimTime& dt, 00235 const double& inpe, const double& inpinh) 00236 { 00237 //update_nodecay_input inherited from template parameter 00238 IntType::update_nodecay_input(inpe, itsG); 00239 if (itsG > itsGmax) 00240 itsG = itsGmax; 00241 return getCurrent(itsG); 00242 } 00243 00244 // ###################################################################### 00245 template <class SynType, class IntType> inline 00246 void Synapse<SynType, IntType>::doInit() 00247 { 00248 itsGmax = GMAX; 00249 itsG = 0.0; 00250 getCurrent = SynType(); 00251 } 00252 00253 // ###################################################################### 00254 template <class SynType, class IntType> inline 00255 Synapse<SynType, IntType>* Synapse<SynType, IntType>::doClone() const 00256 { 00257 return new Synapse<SynType, IntType>(*this); 00258 } 00259 00260 #endif 00261 00262 // ###################################################################### 00263 /* So things look consistent in everyone's emacs... */ 00264 /* Local Variables: */ 00265 /* indent-tabs-mode: nil */ 00266 /* End: */