Show
Ignore:
Timestamp:
03/11/10 15:24:33 (2 years ago)
Author:
apdavison
Message:

Resumed implementation of the moose module. HH_cond_exp2.py example runs and gives the same results with moose as with neuron (nest is different - need to figure out why).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/moose/cells.py

    r601 r726  
    1 from pyNN import common, cells 
     1import moose 
     2from pyNN import standardmodels, cells 
     3 
     4mV = 1e-3 
     5ms = 1e-3 
     6nA = 1e-9 
     7 
     8class SingleCompHH(moose.Neutral): 
     9     
     10    def __init__(self, path, GbarNa=0.0, GbarK=0.0, GLeak=0.0, Cm=1.0, 
     11                 ENa=40*mV, EK=-90*mV, VLeak=-65*mV, Voff=-63*mV, ESynE=0*mV, 
     12                 ESynI=-70*mV, tauE=2*ms, tauI=5*ms, inject=0*nA, initVm=-65*mV): 
     13        moose.Neutral.__init__(self, path) 
     14        self.comp = moose.Compartment("compartment", self) 
     15        print "compartment is at %s" % self.comp.path 
     16        print locals() 
     17        self.comp.initVm = initVm 
     18        self.comp.Rm = 1/GLeak 
     19        self.comp.Cm = Cm 
     20        self.comp.Em = VLeak 
     21        self.comp.inject = inject 
     22        self.na = moose.HHChannel("na", self.comp) 
     23        self.na.Ek = ENa 
     24        self.na.Gbar = GbarNa 
     25        self.na.Xpower = 3 
     26        self.na.Ypower = 1 
     27        self.na.setupAlpha("X", 3.2e5 * (13*mV+Voff), -3.2e5, -1, -(13*mV+Voff), -4*mV, # alpha 
     28                               -2.8e5 * (40*mV+Voff),  2.8e5, -1, -(40*mV+Voff), 5*mV)  # beta 
     29        self.na.setupAlpha("Y", 128,                   0,      0, -(17*mV+Voff), 18*mV, # alpha 
     30                                4.0e3,                 0,      1, -(40*mV+Voff), -5*mV) # beta 
     31 
     32        self.k = moose.HHChannel("k", self.comp) 
     33        self.k.Ek = EK 
     34        self.k.Gbar = GbarK 
     35        self.k.Xpower = 4 
     36        self.k.setupAlpha("X", 3.2e4 * (15*mV+Voff), -3.2e4, -1, -(15*mV+Voff), -5*mV, 
     37                               500,                  0,       0, -(10*mV+Voff),  40*mV) 
     38 
     39        #self.synE = moose.SynChan("excitatory", self.comp) 
     40        #self.synE.Ek = ESynE 
     41        #self.synE.tau1 = 1e-6 
     42        #self.synE.tau2 = tauE 
     43        #self.synE.Gbar = 1e-9 
     44        #self.synI = moose.SynChan("inhibitory", self.comp) 
     45        #self.synI.Ek = ESynI 
     46        #self.synI.tau1 = 1e-6 
     47        #self.synI.tau2 = tauI 
     48        #self.synI.Gbar = 1e-9 
     49     
     50        #self.comp.connect("channel", self.synE, "channel") 
     51        #self.comp.connect("channel", self.synI, "channel") 
     52        self.comp.connect("channel", self.na, "channel") 
     53        self.comp.connect("channel", self.k , "channel") 
     54         
     55        self.comp.useClock(0) 
     56        self.comp.useClock(1, "init") 
     57 
     58    def record_v(self): 
     59        self.vmTable = moose.Table("Vm", self) 
     60        self.vmTable.stepMode = 3 
     61        self.vmTable.connect("inputRequest", self.comp, "Vm") 
     62        self.vmTable.useClock(2) 
     63        print "vmTable is at %s" % self.vmTable.path 
     64        #moose.PyMooseBase.getContext().useClock(0, self.comp.path+"/##") 
     65 
     66#a = SingleCompHH("/comp", 1e-9, 1e-9, 1e-9, 1e-12, -0.06, 0.08, -0.06, 0.001, 0.05, -0.05, 1e-2, 2e-2, 1e-9, -0.06) 
     67#print "Successfully setup SingleCompHH" 
     68 
     69 
    270 
    371class HH_cond_exp(cells.HH_cond_exp): 
    472    """Single compartment cell with an Na channel and a K channel""" 
    5     translations = common.build_translations( 
     73    translations = standardmodels.build_translations( 
    674        ('gbar_Na',    'GbarNa', 1e-9),    
    775        ('gbar_K',     'GbarK', 1e-9),     
     
    1179        ('e_rev_Na',   'ENa', 1e-3), 
    1280        ('e_rev_K',    'EK', 1e-3),  
    13         ('e_rev_leak', 'Vleak', 1e-3), 
     81        ('e_rev_leak', 'VLeak', 1e-3), 
    1482        ('e_rev_E',    'ESynE', 1e-3), 
    1583        ('e_rev_I',    'ESynI', 1e-3), 
     
    1987        ('v_init',     'initVm', 1e-3), 
    2088    ) 
    21     moose_name = "SingleCompHH" 
     89    model = SingleCompHH 
    2290 
    2391