ted wrote: ↑Mon Sep 14, 2020 1:46 pm
gladonias wrote: ↑Mon Sep 14, 2020 7:36 am
Let's say you instantiated a model of a neuron into a variable named

*cell*, you can get the total number of dendritic compartments with

*len(cell.dend)*.

Interesting. Can you provide a working example?

Here's a snippet of one of my scripts where

*preSyn* is the pre-synaptic neuron, and

*postSyn* is the post-synaptic one:

Code: Select all

```
def establishSynapses(preSyn, postSyn, thres=10, w=.04):
# Calculate the number of connections between preSyn and postSyn.
numConnections = int(round((getConnectionProbability(preSyn, postSyn) / 100) * len(postSyn.dend), 0))
for i in range(numConnections):
syn = neuron.h.ExpSyn(0.5, sec = postSyn.dend[i])
syns.append(syn)
nc = neuron.h.NetCon(preSyn.soma[0](0.5)._ref_v, syn, sec=preSyn.soma[0])
nc.weight[0] = w
nc.delay = 0
nc.threshold = thres
nclist.append(nc)
```

The Blue Brain Project's

NMC Portal also provides information on connection probabilities between different combinations of models of neurons. Because I was trying to create a network of one hundred-ish neurons, I didn't want to scrape their website to get each pair of connection probability, so I got every pair I needed and saved to a local file. Then, I use the function

*getConnectionProbability* only to get the specific probability value from the file.

Then I divided it by 100 because, in the website, the probability is given in percentage, and I multiple it by the number of dendritic compartments, which I round it to zero decimal places and convert it to integer so I can use it in the

*for* loop, one for the number of connection and other for the number of synapses per connection.

The variable

*numConnections* is the fraction of dendritic compartments based on the connection probability of that specific pair of neurons. Thus, my

*for* loop will run for

*numConnections* times and in each time, it is going to establish one synapse per connection. NMC Portal provides the number of synapses per connection as well, in this case I'd say the best approach would be to code a nested

*for* loop.

The variables for h.ExpSyn and h.NetStim follow the same nomenclature as the ones in the

NEURON+Python Tutorial.