Thank you for all of our previous interactions. II have been working with NEURON for the past couple of weeks and I fainlly feel I am now somewhat competent after reading and testing my understanding of what NEURON can do. My current goal is to successfully add X number of excitatory synapses to a pre-existing cell model of L5B pyramidal cells (modelDB: 139653). I want to then stimulate each of these synapses with an independently-generated Poisson train.
What I have boiled it down to is to add X unique number of EXP2SYN / NETSTIM and connect the pair (source, target) with X NETCONs to stimulate each. I have run the simulation: (1) with adding the excitatory synapses I have created and (2) without (by taking the proc out). I have not changed any of the original cell parameters, and have just loaded the cell for my stated purpose. Both produce identical graphs show below, respectively.
(1) graph:
(2) graph:
I will attach my code at the end, but I would love some guidance on why the graphs are identitcal. My three questions:
1. How can I easily check the connection of the cell? I have gone through the source code and have played around to determine where the cells are connected, but I feel there should be an easier way than this.
2. How can I check if my NetCon is working properly and connecting the source and target? I am recording idvec and seeing if the parameters are matching for NetStim (particularly the .number) and it seems to be working as expected.
3. Sometimes when I run my code again after loading my cell and mod files (without quitting NEURON) i get the line:
"initcode failed with 1 left." What does this mean? This usually goes away if I quit the opened graph window before I run my simulation a second time.
Code: Select all
//=================== creating cell object ==========================
objref cvode
cvode = new CVode()
cvode.active(1)
load_file("import3d.hoc")
objref L5PC
strdef morphology_file
morphology_file = "../morphologies/cell1.asc"
load_file("../models/L5PCbiophys3.hoc")
load_file("../models/L5PCtemplate.hoc")
L5PC = new L5PCtemplate(morphology_file)
load_file("stdlib.hoc")
load_file("nrngui.hoc")
load_file("ranstream.hoc")
//-------------------parameters-----------------------//
v_init = -80
eNSNUM = 150 // how many NetStims to create
MAXSTREAM = 1000
tstop = 300 // length of simulation
dendnseg = 1 // as determind by the original model
//-------------------parameters for NetStim-----------//
// this generates a presynaptic train of stimuli
spikeint = 10 // (ms) mean time between spikes, 1000(ms) to get 1 Hz
nspikes = 50 // average number of spikes, that NetStim will produce. how do i choose this number?
spikeonset = 1 // start time of first spike
noise = 1 // set to 1 for poisson mode
//-------------------parameters for Exp2Syn-----------//
// S = 1 / Ohms. G is in microOhms
// TAU1 and TAU2 parameters for L5PC in a paper
TAU1 = 0.20
TAU2 = 1.7
excite = 0
//-------------------parameters for NetCon------------//
// not sure what parameters to set for this setion. arbitrarily picked
THRESHOLD = 10
DELAY = 0.5
WEIGHT = 0.1
//-------------------MODEL SETUP-----------------------//
objref nslist, rslist, eslist, nclist
nslist = new List() // NetStim list
rslist = new List() // RandStream list
eslist = new List() // Exp2Syn list
//----- make_stims create excitatory synapses, all firing randomly-----//
proc syn_excite() { local i localobj ns, rs, es, r
nslist = new List()
rslist = new List()
eslist = new List()
random_stream_offset_ = MAXSTREAM
for i = 0, $1-1 {
ns = new NetStim()
nslist.append(ns)
rs = new RandomStream(i)
rslist.append(rs)
ns.noiseFromRandom(rs.r)
rs.r.negexp(1) // must specify negexp distribution with mean = 1
rs.start() // makes random noise and writes results in list
}
r = new Random()
for i = 0, $1-1 {
s1dend= 1 //s1 dendrite, in our case, we only have 1 dend
s1comp= r.uniform(0, dendnseg) //s1 compartment --- choose a random (discunif = discrete uniform) compartment of dendrites
s1coord= s1comp / dendnseg //s1 coordinate, remember dendnseg is 1 by original cell model
access L5PC.dend[s1dend]
es = new Exp2Syn(s1coord) //places Exp2Syn on dend in compartment with coordinate s1
eslist.append(es)
access L5PC.soma //replace pointer back onto soma (default)
}
}
syn_excite(eNSNUM)
proc setparams() {local i, j
for i = 0,nslist.count()-1 {
nslist.o(i).interval = spikeint
nslist.o(i).number = nspikes
nslist.o(i).start = spikeonset
nslist.o(i).noise = noise
}
for i = 0,eslist.count()-1 {
eslist.o(i).tau1 = TAU1 //rise time (ms)
eslist.o(i).tau2 = TAU2 //delay time (ms)
eslist.o(i).e = excite //reversal potential, change this to make it inhibitory
}
}
setparams() // default is deterministic spike times (NOISE = 0)
//-------------------instrumentation-----------------------//
// this is where NetCon is caled and connects the NetStim and EXP2SYN
objref tvec, idvec, i_tvec, i_idvec
idvec = new Vector()
tvec = new Vector()
i_idvec = new Vector()
i_tvec = new Vector()
proc instrumentation() { local i localobj nc, inc
for i = 0,nslist.count()-1 {
nc = new NetCon(nslist.o(i), eslist.o(i), THRESHOLD, DELAY, WEIGHT)
nc.record(tvec, idvec, i)
}
}
instrumentation()
proc restart(){ local i
for i = 0, rslist.count()-1{
rslist.o(i).start()
}
}
//check if nslist is being created and edited
proc check(){
print nslist.count, ": this is how big nslist is"
print nslist.o(23).number, ": this is .number of NetStim \n" //arbitrary i
print "this is idvec, being generated by NetCon: "
idvec.printf
}
proc myrun(){
finitialize(v_init)
fcurrent()
run()
restart() // restore each generator to the start of its stream
}
//======================= plot settings ============================
objref gV, tempVec
gV = new Graph()
gV.size(0,tstop,-80,40)
graphList[0].append(gV)
access L5PC.soma
gV.addvar("soma","v(0.5)",1,1)
//-------------------starting simulation-----------------------//
myrun()
check()
print "done!"