-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cff3691
commit 15a9b92
Showing
2 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
begintemplate B_BallStick | ||
|
||
// define public val and func | ||
public init, connect2target | ||
public soma, dend | ||
public synlist | ||
|
||
// use external function | ||
external lambda_f | ||
|
||
create soma, dend | ||
|
||
objref synlist | ||
|
||
// constructor | ||
proc init(){ local x, y, z localobj syn | ||
// initialize args | ||
x=$1 y=$2 z=$3 | ||
|
||
// set position | ||
connect dend(0), soma(1) | ||
soma { pt3dclear() pt3dadd(0+x, 0+y, 0+z, 12) pt3dadd(15+x, 0+y, 0+z, 12) } | ||
dend { pt3dclear() pt3dadd(15+x, 0+y, 0+z, 1) pt3dadd(175+x, 0+y, 0+z, 1) } | ||
|
||
// set geom ( L and diam are automaticaly set by pt3d func ) | ||
forall { nseg = int((L/(0.1*lambda_f(100))+0.9)/2)*2 + 1 } | ||
|
||
// set biophys | ||
forall { Ra = 100 cm = 1 } | ||
soma { | ||
insert hh | ||
gnabar_hh = 0.12 | ||
gkbar_hh = 0.036 | ||
gl_hh = 0.0003 | ||
el_hh = -54.3 | ||
} | ||
dend { | ||
insert pas | ||
g_pas = 0.001 | ||
e_pas = -65 | ||
} | ||
|
||
// set synapse | ||
synlist = new List() | ||
dend { syn = new ExpSyn(0.8) } | ||
syn.tau = 2 | ||
synlist.append(syn) | ||
} | ||
|
||
obfunc connect2target() { localobj nc | ||
// $o1 target point process | ||
soma nc = new NetCon(&v(1), $o1) | ||
nc.threshold = 10 | ||
//if(numarg() == 2){ $o2 = nc } | ||
return nc | ||
} | ||
|
||
endtemplate B_BallStick | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
load_file("nrngui.hoc") | ||
|
||
// load my cell template | ||
load_file("ball_and_stick.hoc") | ||
|
||
// simulation setting | ||
NCELL = 20 | ||
tstop = 200 | ||
dt = 0.0005 | ||
|
||
objref cells, nclist | ||
objref stim, ncstim | ||
objref tvec, idvec | ||
objref myplot | ||
|
||
proc makeCells() { local i, num_cell localobj cell | ||
num_cell = $1 | ||
cells = new List() | ||
for i=0, num_cell-1 { | ||
cell = new B_BallStick(0, 20*i, 0) | ||
cells.append(cell) | ||
} | ||
} | ||
|
||
proc connectCells() { local i localobj src, target, syn, nc | ||
nclist = new List() | ||
for i=0, cells.count-1 { | ||
src = cells.object(i) | ||
target = cells.object((i+1)%cells.count) | ||
syn = target.synlist.object(0) | ||
|
||
nc = src.connect2target(syn) | ||
nclist.append(nc) | ||
nc.delay = 1 | ||
nc.weight = 0.01 | ||
} | ||
} | ||
|
||
proc setStim() { | ||
stim = new NetStim() | ||
stim.number = 1 | ||
stim.start = 0 | ||
ncstim = new NetCon(stim, cells.object(0).synlist.object(0)) | ||
ncstim.delay = 0 | ||
ncstim.weight = 0.01 | ||
} | ||
|
||
proc setSpikeRecorder() { local i localobj nc, nil | ||
tvec = new Vector() | ||
idvec = new Vector() | ||
for i=0, nclist.count-1 { | ||
nc = cells.object(i).connect2target(nil) | ||
nc.record(tvec, idvec, i) | ||
} | ||
} | ||
|
||
proc printSpike() { local i | ||
printf("\ntime\t cell\n") | ||
for i=0, tvec.size-1 { | ||
printf("%g\t %d\n", tvec.x[i], idvec.x[i]) | ||
} | ||
} | ||
|
||
proc setPlot() { | ||
myplot = new PlotShape() | ||
myplot.show(0) | ||
myplot.exec_menu("Shape Plot") | ||
flush_list.append(myplot) | ||
} | ||
|
||
proc start(){ | ||
run() | ||
printSpike() | ||
} | ||
|
||
makeCells(NCELL) | ||
connectCells() | ||
setStim() | ||
|
||
setSpikeRecorder() | ||
setPlot() | ||
|
||
//quit() |