Skip to content
Snippets Groups Projects
Commit fce2c76b authored by Sam Yates's avatar Sam Yates
Browse files

Adapt NEURON's standard exp2syn for use and validation

* Add a tweaked version of exp2syn.mod that is modparser compatible.
* Add option to simple_synapse.py to choose which syn type to use.
* Compatibility tweak for runinng nrn scripts with nrniv -python
parent 2f3f6ff4
No related branches found
No related tags found
No related merge requests found
set(mechanisms pas hh expsyn)
set(mechanisms pas hh expsyn exp2syn)
set(modcc "${CMAKE_BINARY_DIR}/external/bin/modcc")
......
NEURON {
POINT_PROCESS Exp2Syn
RANGE tau1, tau2, e
NONSPECIFIC_CURRENT i
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(uS) = (microsiemens)
}
PARAMETER {
tau1=.1 (ms) : <1e-9,1e9>
tau2 = 10 (ms) : <1e-9,1e9>
e=0 (mV)
}
ASSIGNED {
factor
}
STATE {
A : (uS)
B : (uS)
}
INITIAL {
LOCAL tp
A = 0
B = 0
tp = (tau1*tau2)/(tau2 - tau1) * log(tau2/tau1)
factor = -exp(-tp/tau1) + exp(-tp/tau2)
factor = 1/factor
}
BREAKPOINT {
SOLVE state METHOD cnexp
i = (B - A)*(v - e)
}
DERIVATIVE state {
A' = -A/tau1
B' = -B/tau2
}
NET_RECEIVE(weight) {
A = A + weight*factor
B = B + weight*factor
}
......@@ -8,7 +8,20 @@ from neuron import gui, h
parser = argparse.ArgumentParser(description='generate spike train ball and stick model with hh channels at soma and pas channels in dendrite')
parser.add_argument('--plot', action='store_true', dest='plot')
args = parser.parse_args()
parser.add_argument('--synapse', metavar='SYN', dest='synapse',
choices=['exp', 'exp2'],
default='exp',
help='use synapse type SYN (exp or exp2)')
# hack to make things work with nrniv ... -python:
# throw away args before -python foo.py if -python present.
if '-python' in sys.argv:
argv = sys.argv[sys.argv.index('-python')+2:]
else:
argv = sys.argv
args = parser.parse_args(argv)
soma = h.Section(name='soma')
dend = h.Section(name='dend')
......@@ -62,8 +75,16 @@ for nseg in [5, 11, 51, 101] :
dend.nseg=nseg
# add a synapse
syn_ = h.ExpSyn(dend(0.5))
syn_.tau = 2
if args.synapse == 'exp':
syn_ = h.ExpSyn(dend(0.5))
syn_.tau = 2
elif args.synapse == 'exp2':
syn_ = h.Exp2Syn(dend(0.5))
syn_.tau1 = 0.5 # artificially slow onset
syn_.tau2 = 2
else:
raise RuntimeError('unrecognized synapse type')
ncstim = h.NetCon(stim, syn_)
ncstim.delay = 1 # 1 ms delay (arrives at 10ms)
ncstim.weight[0] = 0.04 # NetCon weight is a vector
......@@ -127,7 +148,7 @@ end = timer()
print "took ", end-start, " seconds"
# save the spike info as in json format
fp = open('simple_synapse.json', 'w')
fp = open('simple_'+args.synapse+'_synapse.json', 'w')
json.dump(results, fp, indent=2)
if args.plot :
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment