1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
from neuron import h
h.load_file("stdrun.hoc")
class Cell(object):
def __init__(self):
self.topology()
self.subsets()
self.geometry()
self.biophys()
self.synapses()
def topology(self):
self.soma = h.Section(cell=self)
self.dend = h.Section(cell=self)
self.dend.connect(self.soma)
self.nseg = 5
def subsets(self):
self.all = h.SectionList()
self.all.wholetree(sec=self.soma)
def geometry(self):
self.soma.L = 10
self.soma.diam = 10
self.dend.L = 500
self.dend.diam = 1
def biophys(self):
for sec in self.all:
sec.Ra = 100
sec.cm = 1
self.soma.insert("hh")
def synapses(self):
self.syn = h.ExpSyn(0.5, sec=self.dend)
self.syn.e = 0
self.syn.tau = 1
def connectToTarget(self, syn):
nc = h.NetCon(self.soma(0.5)._ref_v, syn, sec=self.soma)
nc.threshold = -10
return nc
pc = h.ParallelContext()
pc.set_gid2node(1, pc.id())
cell = Cell()
pc.cell(1, cell.connectToTarget(None))
stim = h.IClamp(cell.soma(0.5))
stim.delay = 0
stim.dur = 15
stim.amp = 0.1
from neuronmusic import *
out = publishEventOutput("out")
out.gid2index(1, 0)
pc.set_maxstep(1)
h.stdinit()
pc.psolve(20)
|