I have constructed a network of 5 biophysical cells, each one of which is activated by a different NetStim. I included also three synapses on each of the cells (two excitatory and one inhibitory). Is it possible to change the weights of S0 -> M1.E2 (see below) at each time step?
Here is the source code of the network:
Code: Select all
// Artificial cells no longer need a default section.
//Network cell templates
// M_Cell
//Artificial cells
// S_NetStim
ns = 5
mc = 5
objref MC[mc]
begintemplate M_Cell
public is_art
public init, topol, basic_shape, subsets, geom, biophys, geom_nseg, biophys_inhomo
public synlist, connect2target
public soma, dend, axon
public all
objref synlist
proc init() {
topol()
subsets()
geom()
biophys()
geom_nseg()
synlist = new List()
synapses()
}
create soma, dend, axon
proc topol() { local i
connect dend(0), soma(1)
connect axon(0), soma(0)
basic_shape()
}
proc basic_shape() {
soma {pt3dclear() pt3dadd(0, 0, 0, 1) pt3dadd(15, 0, 0, 1)}
dend {pt3dclear() pt3dadd(15, 0, 0, 1) pt3dadd(75, 0, 0, 1)}
axon {pt3dclear() pt3dadd(0, 0, 0, 1) pt3dadd(-59, 0, 0, 1)}
}
objref all
proc subsets() { local i
objref all
all = new SectionList()
soma all.append()
dend all.append()
axon all.append()
}
proc geom() {
forsec all { }
soma { L = 100 diam = 1 }
dend { L = 100 diam = 1 }
axon { L = 100 diam = 1 }
}
external lambda_f
proc geom_nseg() {
forsec all { nseg = int((L/(0.1*lambda_f(100))+.9)/2)*2 + 1 }
}
proc biophys() {
forsec all {
Ra = 35.4
cm = 1
}
soma {
insert hh
gnabar_hh = 0.12
gkbar_hh = 0.036
gl_hh = 0.0003
el_hh = -54.3
}
dend {
insert hh
gnabar_hh = 0.12
gkbar_hh = 0.036
gl_hh = 0.0003
el_hh = -54.3
}
axon {
insert hh
gnabar_hh = 0.12
gkbar_hh = 0.036
gl_hh = 0.0003
el_hh = -54.3
}
}
proc biophys_inhomo(){}
proc connect2target() { //$o1 target point process, $o2 returned NetCon
soma $o2 = new NetCon(&v(1), $o1)
}
objref syn_
proc synapses() {
/* E0 */ soma syn_ = new ExpSyn(0.4) synlist.append(syn_)
syn_.tau = 10
/* I1 */ dend syn_ = new Exp2Syn(0.4) synlist.append(syn_)
syn_.tau1 = 0.5
syn_.tau2 = 1
/* E2 */ dend syn_ = new ExpSyn(0.8) synlist.append(syn_)
syn_.tau = 10
}
func is_art() { return 0 }
endtemplate M_Cell
objref NS[ns]
begintemplate S_NetStim
public pp, connect2target, x, y, z, position, is_art
objref pp
proc init() {
pp = new NetStim()
}
func is_art() { return 1 }
proc connect2target() { $o2 = new NetCon(pp, $o1) }
endtemplate S_NetStim
//Network specification interface
for i=0, ns-1 {NS[i] = new S_NetStim(i)}
for i=0, mc-1 {MC[i] = new M_Cell(i)}
objref cells, nclist, netcon
{cells = new List() nclist = new List()}
func cell_append() {cells.append($o1)
return cells.count - 1
}
func nc_append() {//srcindex, tarcelindex, synindex
if ($3 >= 0) {
cells.object($1).connect2target(cells.object($2).synlist.object($3),netcon)
netcon.weight = $4 netcon.delay = $5
}else{
cells.object($1).connect2target(cells.object($2).pp,netcon)
netcon.weight = $4 netcon.delay = $5
}
nclist.append(netcon)
return nclist.count - 1
}
//Network instantiation
/* S0 */ for i = 0, ns-1 {cell_append(NS[i])}
/* M1 */ for i = 0, mc-1 {cell_append(MC[i])}
objref r, a
double wts[ns][mc]
proc initNet() {
r = new Random()
r.uniform(0,0.02)
a = new Vector(ns*mc)
a.setrand(r)
i = 0
for j = 0, mc-1 {
wts[i][j] = a.x[j]
/* S0 -> M1.E0 */ nc_append(i, ns+j, 0, 0.02,0.5)
/* S0 -> M1.E2 */ nc_append(i, ns+j, 2, wts[i][j],0)
i = i + 1
}
}
/////// custom run() and init() /////////////
proc run() {
stdinit()
continuerun(tstop)
initNet()
}
proc init() {
finitialize(v_init)
if (cvode.active()) {
cvode.re_init()
} else {
fcurrent()
}
frecord_init()
}
///////// user interface ////////
{
xpanel("RunControl", 0)
v_init = -65
xvalue("Init","v_init", 1,"stdinit()", 1, 1 )
xbutton("Init & Run","run()")
xbutton("Stop","stoprun=1")
runStopAt = 5
xvalue("Continue til","runStopAt", 1,"{continuerun(runStopAt) stoprun=1}", 1, 1 )
runStopIn = 1
xvalue("Continue for","runStopIn", 1,"{continuerun(t + runStopIn) stoprun=1}", 1, 1 )
xbutton("Single Step","steprun()")
t = 0
xvalue("t","t", 2 )
tstop = 350
xvalue("Tstop","tstop", 1,"tstop_changed()", 0, 1 )
dt = 0.025
xvalue("dt","dt", 1,"setdt()", 0, 1 )
steps_per_ms = 40
xvalue("Points plotted/ms","steps_per_ms", 1,"setdt()", 0, 1 )
screen_update_invl = 0.05
xvalue("Scrn update invl","screen_update_invl", 1,"", 0, 1 )
realtime = 0
xvalue("Real Time","realtime", 0,"", 0, 1 )
xpanel(158,158)
}