adamimos wrote:i want the point processes to be uniformly distributed over the total length (ie. a section that is 9 times longer should have 9 times more probability of getting any one synapse)

The empirical basis for assuming constant density per unit length is what? The evidence with which I am familiar dates to anatomical studies in the early 1990s on neocortical and/or hippocampal pyramidal cells, and suggests that density per unit area is closer to being constant than is density per unit length.

For the sake of this discussion, assume a constant density per unit length which is called syndens, and that the synaptic mechanism class is called SynMech. Then you could proceed as follows:

1. Make a SectionList that contains all the neurites that you want to innervate. Call it "innervated".

2. Calculate the total length of all the neurites in that set.

Code: Select all

```
totalL = 0
forsec innervated totalL += L // iterate over all members of innervated
```

3. Attach the appropriate number of synapses to each segment of each neurite in the set.

Code: Select all

```
objref synlist, tobj
synlist = new List()
forsec innervated {
seglength = L/nseg
for (x,0) { // iterate over all segments of the currently accessed section
calculate the number of synapses that should be attached to this segment
create and attach them and append them to synlist
}
objref tobj // to prevent careless reuse of tobj from damaging the last synaptic mechanism
}
```

4. Set the parameters of the synaptic mechanisms.

Several devilish details are contained in these three lines:

calculate the number of synapses that should be attached to this segment

create and attach them

4. Set the parameters of the synaptic mechanisms.

Consider the first two:

calculate the number of synapses that should be attached to this segment

create and attach them and append them to synlist

Why "calculate the number of synapses that should be attached to this segment"? What's wrong with just calculating syndens*L/nseg, rounding to the nearest integer, and attaching that many synapses?

Because "synaptic density is syndens/um" does not mean that a compartment of length L/nseg is guaranteed to have syndens*L/nseg synapses. Ideally you should derive a discrete distribution that, given syndens and compartment length, tells you the probability that there will be 0, 1, 2 . . . synapses. The synaptic densities that I have seen are on the order of 1/um, and most compartments will be significantly longer than 10 um--indeed, probably 30 um or longer, for any reasonable spatial discretization strategy. Hint: you might be able to take advantage of the "law of large numbers" and the Gaussian distribution . . . (details left as an exercise to the reader)

So I will assume that you will have a function called numsyn that takes two arguments (synaptic density, and neurite length) and returns a whole number drawn from an appropriate distribution. The inner for loop then becomes

Code: Select all

```
for (x,0) { // iterate over all segments of the currently accessed section
nsyn = numsyn(syndens, L/nseg)
for i = 1,nsyn {
tobj = new SynMech(x)
synlist.append(tobj)
}
}
```

Why use a List to manage the synaptic mechanisms? Because Lists are far and away the most convenient way to deal with collections of things, and because you have no idea, in advance, of how many instances of SynMech you are going to create.

When you have created all of your synapses, you can specify their properties by iterating over the contents of synlist.

Code: Select all

```
for i=0, synlist.count()-1 {
synlist.o(i).param1 = whatever1
synlist.o(i).param2 = whatever2
synlist.o(i).onset = some_function()
. . . etc. . . .
}
```

where some_function() is a func that returns the time at which you want this particular SynMech to be activated.