I am trying to connect instances of a very simple cell class SimpCell() with NetCons. I am working in python but the cell class SimpCell() is defined in a hoc file and I would like to keep the cell template in hoc.
I am able to create NetCon with a NONE source using "netcon = h.NetCon(None, celllist[jj].synI)". However I can't manage to create NetCons connected to the source cell. I think the problem is the "sec=section" argument for the h.NetCon() function. I have imported the gui to make sure the CVode object exists. I have also tried to retrieve pointers for the section with h.SectionRef() but this doesn't work either..
Here is the python code that I am using:
Code: Select all
import numpy as np
from neuron import h, gui
# Check if CVode exists
h.allobjects("CVode") # Does it work ???
print h.CVode # I assume it exists..
# ----------------------------------------DEFINE NETWORK TOPOLOGY------------------------------------------------------------------
# ----------------------------------- define Example network to try out connections----------------
A = np.matrix('0 -1 0 1;1 0 0 0;1 0 0 0;0 0 0 0')# A is directed adjacency matrix
#
# 2
# | (excitatory connection downwards)
# |
# 0 <--| 1 (excitatory connection to the left and an inhibitory to the right)
# |
# | (excitatory connection downwards)
# 3
#
#-------------------------CREATE INSTANCES OF CELL CLASS "Simpcell"------------------------------------------------------
# very simple cell consisting of one soma and one dendrite with the pointprocesses ExpSyn attached
h.xopen('simpcell.hoc') # load hoc class definition
celllist= h.List() # list object that contains cell instances
#celllist=[] #List that contains instances of cells
N = A.shape[0] # number of nodes in network
for ii in range(N):
celllist.append(h.SimpCell())
# Trying to see the topology to figure out the right section name or pointers
h.topology() # Doesn't give any output
# ------------------------CONNECT CELLS WITH EXCITATORY SYNAPSES---------------------------------------------------------
for ii in range(N): # outer loop should iterate over target cells/columns
for jj in range(N): # inner loop iterates over source cells/rows
if (A[ii,jj]==1): #decide whether there should be a connection from this target to this source
netcon = h.NetCon(celllist[ii].soma(1)._ref_v, celllist[jj].synE, [-20, 0, 0.05], sec=celllist[ii].soma)
# netcon = h.NetCon(None, celllist[jj].synE) # NetCon without source. This works. Yeah..
#------------------------CONNECT CELLS WITH INHIBITORY SYNAPSES---------------------------------------------------------
elif (A[ii,jj]==-1): #decide whether there should be a connection from this target to this source')
## sref = h.SectionRef(sec=celllist[ii].soma) # sref should be a pointer to the specified section???
# sref = h.SectionRef() # should be a pointer to the currently accessed section
# netcon = h.NetCon(celllist[ii].soma(1)._ref_v, celllist[jj].synI, [-20, 0, 0.01], sec=sref) # does not accept sec=sref as a section
netcon = h.NetCon(celllist[ii].soma(1)._ref_v, celllist[jj].synE, [-20, 0, 0.05], sec=celllist[ii].soma) # I think it accepts sec=.. as a section
# netcon = h.NetCon(None, celllist[jj].synI) # NetCon without source. This works. Yeah..
Code: Select all
begintemplate SimpCell
public soma, dend, synE, synI, nc
public connect2target
create soma , dend
proc init() {
create soma , dend
soma {
nseg=1
L=30
diam=30
insert hh
}
dend {
nseg=11
L=1000
diam=2
insert pas
g_pas=0.0001
e_pas=-65
}
connect dend(0), soma(1)
synapses()
}
objref synE, synI
proc synapses() {
/* E0 */ dend synE = new ExpSyn(0.8) // excitatory synapse
synE.tau = 2
synE.e = 0
/* I1 */ dend synI = new ExpSyn(0.1) // inhibitory synapse
synI.tau = 50
synI.e = -80
}
endtemplate SimpCell
I think there is something important that I am missing at this point and I can't seem to figure it out on my own. It would be very helpful if someone could help me with this.
Greetings, Catharina