-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathLIF.cpp
101 lines (90 loc) · 2.65 KB
/
LIF.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/**********************************************************************
** This program is part of 'MOOSE', the
** Messaging Object Oriented Simulation Environment.
** Copyright (C) 2003-2007 Upinder S. Bhalla. and NCBS
** It is made available under the terms of the
** GNU Lesser General Public License version 2.1
** See the file COPYING.LIB for the full notice.
**********************************************************************/
#include "../basecode/header.h"
#include "../basecode/ElementValueFinfo.h"
#include "../biophysics/CompartmentBase.h"
#include "../biophysics/Compartment.h"
#include "IntFireBase.h"
#include "LIF.h"
using namespace moose;
const Cinfo* LIF::initCinfo()
{
static string doc[] =
{
"Name", "LIF",
"Author", "Upi Bhalla",
"Description", "Leaky Integrate-and-Fire neuron"
};
static Dinfo< LIF > dinfo;
static Cinfo lifCinfo(
"LIF",
IntFireBase::initCinfo(),
0, 0,
&dinfo,
doc,
sizeof(doc)/sizeof(string)
);
return &lifCinfo;
}
static const Cinfo* lifCinfo = LIF::initCinfo();
//////////////////////////////////////////////////////////////////
// Here we put the Compartment class functions.
//////////////////////////////////////////////////////////////////
LIF::LIF()
{
;
}
LIF::~LIF()
{
;
}
//////////////////////////////////////////////////////////////////
// LIF::Dest function definitions.
//////////////////////////////////////////////////////////////////
void LIF::vProcess( const Eref& e, ProcPtr p )
{
fired_ = false;
if ( p->currTime < lastEvent_ + refractT_ )
{
Vm_ = vReset_;
A_ = 0.0;
B_ = 1.0 / Rm_;
sumInject_ = 0.0;
VmOut()->send( e, Vm_ );
}
else
{
// activation can be a continous variable (graded synapse).
// So integrate it at every time step, thus *dt.
// For a delta-fn synapse, SynHandler-s divide by dt and send activation.
// See: http://www.genesis-sim.org/GENESIS/Hyperdoc/Manual-26.html#synchan
// for this continuous definition of activation.
Vm_ += activation_ * p->dt;
activation_ = 0.0;
if ( Vm_ > threshold_ )
{
Vm_ = vReset_;
lastEvent_ = p->currTime;
fired_ = true;
spikeOut()->send( e, p->currTime );
VmOut()->send( e, Vm_ );
}
else
{
Compartment::vProcess( e, p );
}
}
}
void LIF::vReinit( const Eref& e, ProcPtr p )
{
activation_ = 0.0;
fired_ = false;
lastEvent_ = -refractT_; // Allow it to fire right away.
Compartment::vReinit( e, p );
}