Sorry that this reply has been so delayed.
My model has a synapse in the synaptic mechanism (STDP)
OK, that's synaptic mechanism number 1.
and a second synapse linked to netstim
and that is synaptic mechanism 2.
which occurs from two other synapses.
and those are synaptic mechanisms 3 and 4?
The example code you provide shows two synaptic mechanisms--an instance of the ExpSynSTDP class, and an instance of the ExpSyn class. And there is only one presynaptic spike source, which is an instance of the NetStim class.
Since I can't figure out quite what you want, here's an example of how to make one or more NetStims produce streams of spike events at intervals that are governed by the negative exponential distribution. This strategy pairs each NetStim with its own random number generator (RNG), and each RNG has its own "seed" (actually not really a "seed" but a unique sequence specifier--read the Programmer's Reference documentation of the Random class, especially the parts about Random123) so that each NetStim's event times are statistically independent of every other NetStim's event times.
Put the following code into a file called ran123stream.hoc
Code: Select all
// used to manage independent random streams generated by Random123
// based on RandomStream, which used MCellRan4
// syntax: foo = new Ran123Stream(id1,id2,id3)
// where id1..3 are the stream identifiers
begintemplate Ran123Stream
public r, id1, id2, id3
public repick, start
objref r
proc init() {
id1 = $1
id2 = $2
id3 = $3
r = new Random()
r.Random123(id1, id2, id3)
start()
}
// to get same stream of values on each run, call rs.start() just before run()
proc start() {
r.seq(0) // restart at position 0 in the sequence
}
func repick() {
return r.repick()
}
endtemplate Ran123Stream
To use the Ran123Stream class, make sure that your own program loads the definition of the Ran123Stream class
The following code assumes that your model setup code creates a List called nslist, whose elements are the NetStims whose spike times are to be statistically independent of each other. Furthermore, it assumes that you have already specified each NetStim's interval, number, and start parameter, and set its noise parameter to 1. It is to be executed after nslist is complete.
Code: Select all
obfunc newstream() { localobj tobj
tobj = new Ran123Stream($1, $2, $3)
tobj.r.negexp(1) // do not change this line!
tobj.start() // on the first run it will start at position 0 in the sequence
$o4.noiseFromRandom(tobj.r) // associate it with a particular NetStim
return tobj
}
rslist = new List()
ID1 = 0 // ID1 and ID2 should be whole numbers in the range 0..2^32-1
ID2 = 0
for i=0,nslist.count()-1 rslist.append(newstream(ID1, ID2, i, nslist.o(i)))