DoubleExponentialSpikeResponse.cpp

Go to the documentation of this file.
00001 
00002 #include "DoubleExponentialSpikeResponse.h"
00003 
00004 int DoubleExponentialSpikeResponse::adjust( double dt )
00005 {
00006     if ( tau1 <= 0 )
00007         throw( PCSIM::Exception( "ExponentialDecaySpikeResponse::adjust", "Time constant tau1 not a positive vlaue!" ) );
00008 
00009     if ( tau2 <= 0 )
00010         throw( PCSIM::Exception( "ExponentialDecaySpikeResponse::adjust", "Time constant tau2 not a positive vlaue!" ) );
00011 
00012     if( tau1 == tau2 )
00013         throw( PCSIM::Exception( "ExponentialDecaySpikeResponse::adjust", "Time constants tau1 and tau2 must differ. Use AlphaSpikeResponse instead!" ) );
00014 
00015     c1 = C1( dt  );
00016     c2 = C2( dt  );
00017     c3 = C3( dt  );
00018 
00019     return 0;
00020 }
00021 
00022 int DoubleExponentialSpikeResponse::reset( double dt )
00023 {
00024     FiniteSpikeResponse::reset( dt );
00025     adjust( dt );
00026     psr = x = 0.0;
00027     return 0;
00028 }
00029 
00030 int DoubleExponentialSpikeResponse::advance(AdvanceInfo const &)
00031 {
00032     // Do the exponantial decay
00033         psr = c2 * x + c3 * psr;
00034         x *= c1;
00035     return advanceReturn();
00036 }
00037 
00038 int DoubleExponentialSpikeResponse::spikeHit( spikeport_t port, SpikeEvent const& spike )
00039 {
00040         double _c1_ = C1(spike.delta);
00041         double _c2_ = C2(spike.delta);
00042         double _c3_ = C3(spike.delta);
00043         double psr_tgt = _c2_ * x + _c3_ * psr;
00044         x   += spike.weight / _c1_;
00045     psr = (( psr_tgt - _c2_ * x ) / _c3_);
00046      return spikeHitReturn( AdvanceInfo( spike.dt ) );
00047 }
00048 
00049 int DoubleExponentialSpikeResponse::psrLength(double dt) const
00050 {
00051     return (int)( (double)PSR_MULTIPLE_TAU * 2 * (tau1+tau2) / dt + 0.5 );
00052 }

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