AlphaFunctionSpikeResponse.cpp

Go to the documentation of this file.
00001 
00002 #include "AlphaFunctionSpikeResponse.h"
00003 
00004 #include <iostream>
00005 using std::cerr;
00006 using std::endl;
00007 
00008 int AlphaFunctionSpikeResponse::adjust( double dt )
00009 {
00010     if ( tau > 0 ) {
00011         c1 = C1( dt );
00012         c2 = C2( dt );
00013     } else {
00014        throw( PCSIM::Exception( "AlphaFunctionSpikeResponse::adjust", "Time constant not a positive vlaue!" ) );
00015     }
00016     return 0;
00017 }
00018 
00019 int AlphaFunctionSpikeResponse::reset( double dt )
00020 {
00021     FiniteSpikeResponse::reset( dt );
00022     adjust( dt );
00023     psr = x = 0.0;
00024     return 0;
00025 }
00026 
00027 int AlphaFunctionSpikeResponse::advance(AdvanceInfo const &)
00028 {
00029     psr  = c2 * x + c1 * psr;
00030         x   *= c1;
00031     return advanceReturn();
00032 }
00033 
00034 int AlphaFunctionSpikeResponse::spikeHit( spikeport_t port, SpikeEvent const& spike )
00035 {
00036         double _c1_ = C1(spike.delta);
00037         double _c2_ = C2(spike.delta);
00038         double psr_tgt = _c2_ * x + _c1_ * psr;
00039         x   += spike.weight / _c1_;
00040     psr = (( psr_tgt - _c2_ * x ) / _c1_);
00041     return spikeHitReturn( AdvanceInfo( spike.dt ) );
00042 }
00043 
00044 int AlphaFunctionSpikeResponse::psrLength(double dt) const
00045 {
00046     return (int)( (double)PSR_MULTIPLE_TAU * 3 * tau / dt + 0.5 );
00047 }

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