File: test2.py

package info (click to toggle)
neuron 8.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,760 kB
  • sloc: cpp: 149,571; python: 58,465; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (64 lines) | stat: -rw-r--r-- 1,320 bytes parent folder | download | duplicates (3)
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)