Example #1
0
 def __init__(self, *args):
     TraubCell.__init__(self, *args)
     moose.CaConc(self.soma.path + '/CaPool').tau = 100e-3
     # Special case: individually specified beta_cad's in level  2
     moose.CaConc(self.comp[2].path + '/CaPool').tau  =   1e-3/0.02
     moose.CaConc(self.comp[5].path + '/CaPool' ).tau = 1e-3 /  0.02
     moose.CaConc(self.comp[6].path + '/CaPool' ).tau = 1e-3 /  0.02
Example #2
0
def loadGran98NeuroML_L123(filename):
    neuromlR = NeuroML()
    populationDict, projectionDict = \
        neuromlR.readNeuroMLFromFile(filename)
    soma_path = populationDict['Gran'][1][0].path+'/Soma_0'
    somaVm = setupTable('somaVm',moose.Compartment(soma_path),'Vm')
    somaCa = setupTable('somaCa',moose.CaConc(soma_path+'/Gran_CaPool_98'),'Ca')
    somaIKCa = setupTable('somaIKCa',moose.HHChannel(soma_path+'/Gran_KCa_98'),'Gk')
    ## Am not able to plot KDr gating variable X when running under hsolve
    #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')

    print "Reinit MOOSE ... "
    resetSim(['/elec',cells_path], simdt, plotdt, simmethod='hsolve')

    print "Running ... "
    moose.start(runtime)
    tvec = arange(0.0,runtime*2.0,plotdt)
    tvec = tvec[ : somaVm.vector.size ]
    plot(tvec,somaVm.vector)
    title('Soma Vm')
    xlabel('time (s)')
    ylabel('Voltage (V)')
    figure()
    plot(tvec,somaCa.vector)
    title('Soma Ca')
    xlabel('time (s)')
    ylabel('Ca conc (mol/m^3)')
    figure()
    plot(tvec,somaIKCa.vector)
    title('soma KCa current')
    xlabel('time (s)')
    ylabel('KCa current (A)')
    print "Showing plots ..."
    show()
def createSynapseOnCompartment(compt):
    FaradayConst = 96485.3415  # s A / mol
    length = compt.length
    dia = compt.diameter

    gluR = moose.SynChan(compt.path + '/gluR')
    gluR.tau1 = 4e-3
    gluR.tau2 = 4e-3
    gluR.Gbar = 1e-6
    gluR.Ek = 10.0e-3
    moose.connect(compt, 'channel', gluR, 'channel', 'Single')
    gluSyn = moose.SimpleSynHandler(compt.path + '/gluR/sh')
    moose.connect(gluSyn, 'activationOut', gluR, 'activation')
    gluSyn.synapse.num = 1
    # Ca comes in through this channel, at least for this example.
    caPool = moose.CaConc(compt.path + '/ca')
    caPool.CaBasal = 1e-4  # 0.1 micromolar
    caPool.tau = 0.01
    B = 1.0 / (FaradayConst * length * dia * dia * math.pi / 4)
    B = B / 20.0  # scaling factor for Ca buffering
    caPool.B = B
    moose.connect(gluR, 'IkOut', caPool, 'current', 'Single')
    # Provide a regular synaptic input.
    synInput = moose.SpikeGen('/n/elec/compt/synInput')
    synInput.refractT = 47e-3
    synInput.threshold = -1.0
    synInput.edgeTriggered = 0
    synInput.Vm(0)
    syn = moose.element(gluSyn.path + '/synapse')
    moose.connect(synInput, 'spikeOut', syn, 'addSpike', 'Single')
    syn.weight = 0.2
    syn.delay = 1.0e-3
    return gluR
Example #4
0
def loadGran98NeuroML_L123(filename):
    neuromlR = NeuroML()
    populationDict, projectionDict = \
        neuromlR.readNeuroMLFromFile(filename)
    soma_path = populationDict['Gran'][1][0].path + '/Soma_0'
    somaVm = setupTable('somaVm', moose.Compartment(soma_path), 'Vm')
    somaCa = setupTable('somaCa', moose.CaConc(soma_path + '/Gran_CaPool_98'),
                        'Ca')
    somaIKCa = setupTable('somaIKCa',
                          moose.HHChannel(soma_path + '/Gran_KCa_98'), 'Gk')
    #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')
    soma = moose.Compartment(soma_path)
    print("Reinit MOOSE ... ")
    resetSim(['/elec', '/cells'], simdt, plotdt,
             simmethod='ee')  # from moose.utils
    print("Running ... ")
    moose.start(runtime)
    tvec = arange(0.0, runtime, plotdt)
    plot(tvec, somaVm.vector[1:])
    title('Soma Vm')
    xlabel('time (s)')
    ylabel('Voltage (V)')
    figure()
    plot(tvec, somaCa.vector[1:])
    title('Soma Ca')
    xlabel('time (s)')
    ylabel('Ca conc (mol/m^3)')
    figure()
    plot(tvec, somaIKCa.vector[1:])
    title('KCa current (A)')
    xlabel('time (s)')
    ylabel('')
    print("Showing plots ...")
    show()
Example #5
0
def make_Ca_conc():
    if moose.exists('Ca_conc'):
        return
    conc = moose.CaConc('Ca_conc')
    conc.tau = 0.013333  # sec
    conc.B = 17.402e12  # Curr to conc conversion for soma
    conc.Ca_base = 0.0
Example #6
0
def CaConc(name):
    conc = moose.CaConc('/library/' + name)
    conc.tau = 0.013333
    conc.Ca_base = 0.00000
    conc.thick = 1.79483818751e-10  #Changed from conc.B  = 17.402e12
    #conc length set up same as the length of the compartment
    return conc
Example #7
0
def create_spine_with_receptor(compt, cell, index, frac):
    FaradayConst = 96485.3415  # s A / mol
    spineLength = 5.0e-6
    spineDia = 4.0e-6
    head = create_spine(compt, cell, index, frac, spineLength, spineDia, 0.0)
    gluR = moose.SynChan(head.path + '/gluR')
    gluR.tau1 = 4e-3
    gluR.tau2 = 4e-3
    gluR.Gbar = 1e-6
    gluR.Ek = 10.0e-3
    moose.connect(head, 'channel', gluR, 'channel', 'Single')

    caPool = moose.CaConc(head.path + '/ca')
    caPool.CaBasal = 1e-4  # 0.1 micromolar
    caPool.tau = 0.01
    B = 1.0 / (FaradayConst * spineLength * spineDia * spineDia * math.pi / 4)
    B = B / 20.0  # scaling factor for Ca buffering
    caPool.B = B
    moose.connect(gluR, 'IkOut', caPool, 'current', 'Single')

    synHandler = moose.SimpleSynHandler(head.path + '/gluR/handler')
    synHandler.synapse.num = 1
    moose.connect(synHandler, 'activationOut', gluR, 'activation', 'Single')

    return gluR
Example #8
0
def make_NMDA_Ca_conc():
    if moose.exists('NMDA_Ca_conc'):
        return
    NMDA_Ca_conc = moose.CaConc('NMDA_Ca_conc')
    NMDA_Ca_conc.tau = 0.004  # sec. Faster in spine than dend
    NMDA_Ca_conc.B = 17.402e12  # overridden by cellreader.
    NMDA_Ca_conc.Ca_base = 0.0
Example #9
0
def make_Ca_conc( name ):
    if moose.exists( '/library/' + name ):
        return
    conc = moose.CaConc( '/library/tempName' )
    conc.name = name
    conc.tau = 0.013333  # sec
    conc.B  = 17.402e12 # Curr to conc conversion for soma
    conc.Ca_base = 0.00000
Example #10
0
 def dump_cell(self, file_path):
     """Dump the cell information compartment by compartment for
     comparison with NEURON in csv format. All parameters are
     converted to SI units."""
     with open(file_path, 'w') as dump_file:
         fieldnames = [
             "comp", "len", "dia", "sarea", "xarea", "Em", "Cm", "Rm", "Ra"
         ]
         for chtype in channel_types:
             if chtype != 'cad':
                 fieldnames += ['e_' + chtype, 'gbar_' + chtype]
             else:
                 fieldnames += ['tau_' + chtype, 'beta_' + chtype]
         # print fieldnames
         writer = csv.DictWriter(dump_file,
                                 fieldnames=fieldnames,
                                 delimiter=',')
         writer.writeheader()
         comps = moose.wildcardFind('%s/##[TYPE=Compartment]' % (self.path))
         comps = sorted(comps,
                        key=lambda x: int(x.name[0].rpartition('_')[-1]))
         for comp_e in comps:
             comp = moose.element(comp_e)
             row = {}
             row['comp'] = comp.name
             row['len'] = comp.length
             row['dia'] = comp.diameter
             row['sarea'] = comp.length * comp.diameter * np.pi
             row['xarea'] = comp.diameter * comp.diameter * np.pi / 4
             row['Em'] = comp.Em
             row['Cm'] = comp.Cm
             row['Rm'] = comp.Rm
             row['Ra'] = comp.Ra
             if moose.exists(comp.path + '/CaPool'):
                 ca_pool = moose.CaConc(comp.path + '/CaPool')
             for chtype in channel_types:
                 found = False
                 for chname in channel_type_dict[chtype]:
                     chpath = comp.path + '/' + chname
                     if moose.exists(chpath):
                         found = True
                         channel = moose.element(chpath)
                         if channel.className == 'HHChannel':
                             row['e_' + chtype] = channel.Ek
                             row['gbar_' + chtype] = channel.Gbar
                         elif channel.className == 'CaConc':
                             row['tau_cad'] = channel.tau
                             row['beta_cad'] = channel.B
                         break
                 if not found:
                     if chtype != 'cad':
                         row['e_' + chtype] = 0.0
                         row['gbar_' + chtype] = 0.0
                     else:
                         row['tau_cad'] = 0.0
                         row['beta_cad'] = 0.0
             writer.writerow(row)
Example #11
0
    def _setup_channels(self):
        """Set up connections between compartment and channels, and Ca pool"""
        unblock = ['KDR_FS', 'NaF2', 'CaL', 'KA', 'KC_FAST']
        for comp in self.comp[1:]:
            ca_pool = None
            ca_dep_chans = []
            ca_chans = []
            for child in comp.children():
                obj = moose.Neutral(child)
                if obj.name == 'CaPool':
                    ca_pool = moose.CaConc(child)
                    ca_pool.tau = 20e-3
                else:
                    obj_class = obj.className
                    if obj_class == 'HHChannel':
                        obj = moose.HHChannel(child)
                        if obj.name not in unblock:
                            obj.Gbar = 0.0
                        pyclass = eval(obj.name)
                        if issubclass(pyclass, KChannel):
                            obj.Ek = -100e-3
                            if issubclass(pyclass, KCaChannel):
                                ca_dep_chans.append(obj)
                        elif issubclass(pyclass, NaChannel):
                            obj.Ek = 50e-3
                        elif issubclass(pyclass, CaChannel):
                            obj.Ek = 125e-3
                            if issubclass(pyclass, CaL):
                                ca_chans.append(obj)
                        elif issubclass(pyclass, AR):
                            obj.Ek = -40e-3
            if ca_pool:
                for channel in ca_chans:
                    channel.connect('IkSrc', ca_pool, 'current')
                    config.LOGGER.debug(comp.name + ' : ' + channel.name +
                                        ' connected to ' + ca_pool.name)
                for channel in ca_dep_chans:
                    channel.useConcentration = 1
                    ca_pool.connect("concSrc", channel, "concen")
                    config.LOGGER.debug(comp.name + ' : ' + ca_pool.name +
                                        ' connected to ' + channel.name)

        obj = moose.CaConc(self.soma.path + '/CaPool')
        obj.tau = 50e-3
Example #12
0
class CaPool(moose.CaConc):
    annotation = {'cno': 'cno_0000056'}
    prototype = moose.CaConc(config.modelSettings.libpath + '/CaPool')
    prototype.CaBasal = 0.0
    prototype.ceiling = 1e6
    prototype.floor = 0.0
    prototypes = {}

    def __init__(self, path):
        moose.CaConc.__init__(self, path)
Example #13
0
def create_ca_conc_pool(params):
    lib =  moose.Neutral('/library') if not moose.exists('/library') else moose.element('/library')
    ca_pool = moose.CaConc(lib.path+'/'+params.caName)
    ca_pool.CaBasal = params.caBasal
    ca_pool.ceiling = 1
    ca_pool.floor = 0
    ca_pool.thick = params.caThick
    ca_pool.tau = params.caTau
    ca_pool.B = params.bufCapacity
    return ca_pool
Example #14
0
def create_ca_pool_proto(poolSettings):
    if (not (moose.exists("/library"))):
        moose.Neutral('/library')
    pool = moose.CaConc('/library/' + poolSettings.name)
    pool.CaBasal = poolSettings.CaBasal
    pool.ceiling = 1
    pool.floor = 0
    pool.thick = poolSettings.CaThick
    pool.tau = poolSettings.CaTau
    return pool
Example #15
0
def CaProto(caparams):
    if not moose.exists('/library'):
        lib = moose.Neutral('/library')
    poolproto = moose.CaConc('/library' + caparams.caName)
    poolproto.CaBasal = caparams.CaBasal
    poolproto.ceiling = 1
    poolproto.floor = 0
    poolproto.thick = caparams.CaThick
    poolproto.tau = caparams.CaTau
    return poolproto
Example #16
0
def create_ca_conc_pool(ntype, params):
    lib = moose.Neutral('/library') if not moose.exists(
        '/library') else moose.element('/library')
    typelib = moose.Neutral(lib.path + '/' + ntype) if not moose.exists(
        lib.path + '/' + ntype) else moose.element(lib.path + '/' + ntype)
    ca_pool = moose.CaConc(typelib.path + '/' + params.caName)
    ca_pool.CaBasal = params.caBasal
    ca_pool.ceiling = 1
    ca_pool.floor = 0
    ca_pool.thick = params.caThick
    ca_pool.tau = params.caTau * 0.6  # As per paper Tp/buf
    return ca_pool
Example #17
0
def Ca_Conc(name):
    Ca = moose.CaConc('/library/' + name)
    depth = 0.5e-6
    taur = 1400e-3
    cainf = 100e-6
    # B = 28789637.7
    Ca.tau = taur
    Ca.Ca_base = cainf
    Ca.diameter = 100e-6
    Ca.length = 100e-6
    Ca.thick = 100e-6
    return Ca
Example #18
0
    def readIonConcML(self, ionConcElement, units="SI units"):
        if units == 'Physiological Units':
            # see pg 219 (sec 13.2) of Book of Genesis
            Vfactor = 1e-3  # V from mV
            Tfactor = 1e-3  # s from ms
            Gfactor = 1e1  # S/m^2 from mS/cm^2
            concfactor = 1e6  # mol/m^3 from mol/cm^3
            Lfactor = 1e-2  # m from cm
            Ifactor = 1e-6  # A from microA
        else:
            Vfactor = 1.0
            Tfactor = 1.0
            Gfactor = 1.0
            concfactor = 1.0
            Lfactor = 1.0
            Ifactor = 1.0
        # creates /library in MOOSE tree; elif present, wraps
        moose.Neutral(self.libraryPath + '')
        ionSpecies = ionConcElement.find('./{' + self.cml + '}ion_species')
        if ionSpecies is not None:
            if not 'ca' in ionSpecies.attrib['name']:
                msg = "Sorry, I cannot handle non-Ca-ion pools. Exiting..."
                debug.printDebug("ERR", msg, frame=inspect.currentframe())
                sys.exit(1)

        capoolName = ionConcElement.attrib['name']
        debug.printDebug(
            "INFO",
            "Loading Ca pool {} into {}".format(capoolName, self.libraryPath))
        caPool = moose.CaConc(self.libraryPath + '/' + capoolName)
        poolModel = ionConcElement.find('./{' + self.cml +
                                        '}decaying_pool_model')
        caPool.CaBasal = float(poolModel.attrib['resting_conc']) * concfactor
        caPool.Ca_base = float(poolModel.attrib['resting_conc']) * concfactor

        if 'decay_constant' in poolModel.attrib:
            caPool.tau = float(poolModel.attrib['decay_constant']) * Tfactor
        elif 'inv_decay_constant' in poolModel.attrib:
            caPool.tau = 1.0 / float(poolModel.attrib['inv_decay_constant']) \
                    * Tfactor

        # Only one of pool_volume_info or fixed_pool_info should be present, but
        # not checking
        volInfo = poolModel.find('./{' + self.cml + '}pool_volume_info')
        if volInfo is not None:
            caPool.thick = float(volInfo.attrib['shell_thickness']) * Lfactor
        fixedPoolInfo = poolModel.find('./{' + self.cml + '}fixed_pool_info')
        if fixedPoolInfo is not None:
            # Put in phi under the caPool, so that it can be used instead of
            # thickness to set B (see section 19.2 in Book of Genesis)
            caPool_phi = moose.Mstring(caPool.path + '/phi')
            caPool_phi.value = str( float(fixedPoolInfo.attrib['phi']) \
                    * concfactor/Ifactor/Tfactor )
Example #19
0
def CaPoolProto(libraryName, CaPoolParams):
    if not moose.exists(libraryName):
        lib = moose.Neutral(libraryName)
    else:
        lib = moose.element(libraryName)
    poolproto = moose.CaConc(lib.path + '/' + CaPoolParams.caName)
    poolproto.CaBasal = CaPoolParams.CaBasal
    poolproto.ceiling = 1
    poolproto.floor = 0
    poolproto.thick = CaPoolParams.CaThick
    poolproto.tau = CaPoolParams.CaTau
    return poolproto
Example #20
0
    def _setup_channels(self):
        raise Exception, 'Deprecated'
        for ii in range(SupLTS.num_comp):
            comp = self.comp[1 + ii]
	    ca_pool = None
	    ca_dep_chans = []
	    ca_chans = []
	    for child in comp.children():
		obj = moose.Neutral(child)
		if obj.name == 'CaPool':
		    ca_pool = moose.CaConc(child)
		    ca_pool.tau = 20e-3
		else:
		    obj_class = obj.className
		    if obj_class == 'HHChannel':
			obj = moose.HHChannel(child)
			pyclass = eval(obj.name)
			if issubclass(pyclass, KChannel):
			    obj.Ek = -100e-3
			    if issubclass(pyclass, KCaChannel):
				ca_dep_chans.append(obj)
			elif issubclass(pyclass, NaChannel):
			    obj.Ek = 50e-3
			elif issubclass(pyclass, CaChannel):
			    obj.Ek = 125e-3
			    if issubclass(pyclass, CaL):
				ca_chans.append(obj)
			elif issubclass(pyclass, AR):
			    obj.Ek = -40e-3
	    if ca_pool:
		for channel in ca_chans:
		    channel.connect('IkSrc', ca_pool, 'current')
		    print comp.name, ':', channel.name, 'connected to', ca_pool.name
		for channel in ca_dep_chans:
		    channel.useConcentration = 1
		    ca_pool.connect("concSrc", channel, "concen")
		    print comp.name, ':', ca_pool.name, 'connected to', channel.name

	obj = moose.CaConc(self.soma.path + '/CaPool')
        obj.tau = 50e-3
Example #21
0
def Ca_Conc(name):
    Ca = moose.CaConc('/library/' + name)
    depth = 0.1e-6  #Doesnt' matter
    taur = 80e-3
    cainf = 0.1e-3  #Higher than the standard 0.05e-3
    #B = 252/sm_area

    Ca.tau = taur
    Ca.Ca_base = cainf
    Ca.diameter = 20e-6  #Doesn't matter
    Ca.length = 20e-6  #Doesn't matter
    Ca.thick = 0.1e-6  #Doesn't matter
    return Ca
Example #22
0
def addSpineProto(name='spine',
                  parent='/library',
                  RM=1.0,
                  RA=1.0,
                  CM=0.01,
                  shaftLen=1.e-6,
                  shaftDia=0.2e-6,
                  headLen=0.5e-6,
                  headDia=0.5e-6,
                  synList=(),
                  chanList=(),
                  caTau=0.0):
    assert (moose.exists(parent)), "%s must exist" % parent
    spine = moose.Neutral(parent + '/' + name)
    shaft = buildComptWrapper(spine, 'shaft', shaftLen, shaftDia, 0.0, RM, RA,
                              CM)
    head = buildComptWrapper(spine, 'head', headLen, headDia, shaftLen, RM, RA,
                             CM)
    moose.connect(shaft, 'axial', head, 'raxial')

    if caTau > 0.0:
        conc = moose.CaConc(head.path + '/Ca_conc')
        conc.tau = caTau
        conc.length = head.length
        conc.diameter = head.diameter
        conc.thick = 0.0
        # The 'B' field is deprecated.
        # B = 1/(ion_charge * Faraday * volume)
        #vol = head.length * head.diameter * head.diameter * PI / 4.0
        #conc.B = 1.0 / ( 2.0 * FaradayConst * vol )
        conc.Ca_base = 0.0
    for i in synList:
        syn = buildSyn(i[0], head, i[1], i[2], i[3], i[4], CM)
        if i[5] and caTau > 0.0:
            moose.connect(syn, 'IkOut', conc, 'current')
    for i in chanList:
        if (moose.exists(parent + '/' + i[0])):
            chan = moose.copy(parent + '/' + i[0], head)
        else:
            moose.setCwe(head)
            chan = make_LCa()
            chan.name = i[0]
            moose.setCwe('/')
        chan.Gbar = i[1] * head.Cm / CM
        #print "CHAN = ", chan, chan.tick, chan.Gbar
        moose.connect(head, 'channel', chan, 'channel')
        if i[2] and caTau > 0.0:
            moose.connect(chan, 'IkOut', conc, 'current')
    transformNMDAR(parent + '/' + name)
    return spine
Example #23
0
    def insertCaRecorder(self, object_name, data_container):
        """Creates a table for recording [Ca2+] under data_container"""
        ca_table = None
        ca_table_path = data_container.path + '/' + object_name
        if config.context.exists(ca_table_path):
            return moose.Table(ca_table_path)
        ca_conc_path = self.path + '/CaPool'
        if config.context.exists(ca_conc_path):
            ca_conc = moose.CaConc(ca_conc_path)
            ca_table = moose.Table(ca_table_path)
            ca_table.stepMode = 3
            if not ca_conc.connect('Ca', ca_table, 'inputRequest'):
                print 'Error connecting [Ca2+] on', ca_conc.path, 'to', ca_table.path

        return ca_table
Example #24
0
    def readIonConcML(self, ionConcElement, units="SI units"):
        if units == "Physiological Units":  # see pg 219 (sec 13.2) of Book of Genesis
            Vfactor = 1e-3  # V from mV
            Tfactor = 1e-3  # s from ms
            Gfactor = 1e1  # S/m^2 from mS/cm^2
            concfactor = 1e6  # mol/m^3 from mol/cm^3
            Lfactor = 1e-2  # m from cm
            Ifactor = 1e-6  # A from microA
        else:
            Vfactor = 1.0
            Tfactor = 1.0
            Gfactor = 1.0
            concfactor = 1.0
            Lfactor = 1.0
            Ifactor = 1.0
        moose.Neutral(
            "/library")  # creates /library in MOOSE tree; elif present, wraps
        ionSpecies = ionConcElement.find("./{" + self.cml + "}ion_species")
        if ionSpecies is not None:
            if not "ca" in ionSpecies.attrib["name"]:
                pu.fatal(
                    "Sorry, I cannot handle non-Ca-ion pools. Exiting ...")
                sys.exit(1)
        capoolName = ionConcElement.attrib["name"]

        pu.info("Loading Ca pool %s into /library ." % capoolName)
        caPool = moose.CaConc("/library/" + capoolName)
        poolModel = ionConcElement.find("./{" + self.cml +
                                        "}decaying_pool_model")
        caPool.CaBasal = float(poolModel.attrib["resting_conc"]) * concfactor
        caPool.Ca_base = float(poolModel.attrib["resting_conc"]) * concfactor
        if "decay_constant" in poolModel.attrib:
            caPool.tau = float(poolModel.attrib["decay_constant"]) * Tfactor
        elif "inv_decay_constant" in poolModel.attrib:
            caPool.tau = 1.0 / float(
                poolModel.attrib["inv_decay_constant"]) * Tfactor
        ## Only one of pool_volume_info or fixed_pool_info should be present, but not checking
        volInfo = poolModel.find("./{" + self.cml + "}pool_volume_info")
        if volInfo is not None:
            caPool.thick = float(volInfo.attrib["shell_thickness"]) * Lfactor
        fixedPoolInfo = poolModel.find("./{" + self.cml + "}fixed_pool_info")
        if fixedPoolInfo is not None:
            ## Put in phi under the caPool, so that it can
            ## be used instead of thickness to set B (see section 19.2 in Book of Genesis)
            caPool_phi = moose.Mstring(caPool.path + "/phi")
            caPool_phi.value = str(
                float(fixedPoolInfo.attrib["phi"]) * concfactor / Ifactor /
                Tfactor)
Example #25
0
 def test_Ca_connections(self):
     for comp_no in range(SupLTS.num_comp):
         ca_path = self.cell.comp[comp_no + 1].path + '/CaPool'
         if not config.context.exists(ca_path):
             continue
         caPool = moose.CaConc(ca_path)
         for chan in SupLTS.ca_dep_chans:
             chan_path = self.cell.comp[comp_no + 1].path + '/' + chan
             if not config.context.exists(chan_path):
                 continue
             chan_obj = moose.HHChannel(chan_path)
             self.assertTrue(len(chan_obj.neighbours('concen')) > 0)
         sources = caPool.neighbours('current')
         self.failIfEqual(len(sources), 0)
         for chan in sources:
             self.assertTrue(chan.path().endswith('CaL'))
Example #26
0
 def loadCell(self):
     self.context.readCell('mit_aditya_davison_reduced.p', self.path)
     self._mitral = moose.Cell(self.path)
     self._mitralSoma = moose.Compartment(self.path + '/soma')
     self._mitralGlom = moose.Compartment(self.path + '/glom')
     self._mitralDend = moose.Compartment(self.path + '/dend')
     self._mitralDendNa = moose.HHChannel(self.path + '/dend/Na_mit_usb')
     self._mitralSomaNa = moose.HHChannel(self.path + '/soma/Na_mit_usb')
     self._mitralSomaCaPool = moose.CaConc(self.path + '/soma/Ca_mit_conc')
     self._mitralSomaLCa = moose.HHChannel(self.path + '/soma/LCa3_mit_usb')
     self._mitralSomaKCa = moose.HHChannel(self.path + '/soma/Kca_mit_usb')
     # Connect the LCa current to the Ca Pool
     self._mitralSomaLCa.connect('IkSrc', self._mitralSomaCaPool, 'current')
     # Connect the KCa channel to the Ca concentration of Ca Pool
     self._mitralSomaCaPool.connect('concSrc', self._mitralSomaKCa,
                                    'concen')
Example #27
0
def addSpineProto( name = 'spine', \
        RM = 1.0, RA = 1.0, CM = 0.01, \
        shaftLen = 1.e-6 , shaftDia = 0.2e-6, \
        headLen = 0.5e-6, headDia = 0.5e-6, \
        synList = ( ['glu', 0.0, 2e-3, 9e-3, 200.0, False],
                    ['NMDA', 0.0, 20e-3, 20e-3, 80.0, True] ),
        chanList = ( ['Ca', 1.0, True ], ),
        caTau = 13.333e-3
        ):
    if not moose.exists( '/library' ):
        library = moose.Neutral( '/library' )
    spine = moose.Neutral( '/library/spine' )
    shaft = buildCompt( spine, 'shaft', shaftLen, shaftDia, 0.0, RM, RA, CM )
    head = buildCompt( spine, 'head', headLen, headDia, shaftLen, RM, RA, CM )
    moose.connect( shaft, 'axial', head, 'raxial' )

    if caTau > 0.0:
        conc = moose.CaConc( head.path + '/Ca_conc' )
        conc.tau = caTau
        conc.length = head.length
        conc.diameter = head.diameter
        conc.thick = 0.0
        # The 'B' field is deprecated.
        # B = 1/(ion_charge * Faraday * volume)
        #vol = head.length * head.diameter * head.diameter * PI / 4.0
        #conc.B = 1.0 / ( 2.0 * FaradayConst * vol )
        conc.Ca_base = 0.0
    for i in synList:
        syn = buildSyn( i[0], head, i[1], i[2], i[3], i[4], CM )
        if i[5] and caTau > 0.0:
            moose.connect( syn, 'IkOut', conc, 'current' )
    for i in chanList:
        if ( moose.exists( '/library/' + i[0] ) ):
            chan = moose.copy( '/library/' + i[0], head )
        else:
            moose.setCwe( head )
            chan = make_LCa()
            chan.name = i[0]
            moose.setCwe( '/' )
        chan.Gbar = i[1] * head.Cm / CM
        print "CHAN = ", chan, chan.tick, chan.Gbar
        moose.connect( head, 'channel', chan, 'channel' )
        if i[2] and caTau > 0.0:
            moose.connect( chan, 'IkOut', conc, 'current' )
    transformNMDAR( '/library/spine' )
    return spine
Example #28
0
    def test_single_cell(cls):
        """Simulates a single superficial LTS cell and plots the Vm and [Ca2+]"""

        config.LOGGER.info("/**************************************************************************")
        config.LOGGER.info(" *")
        config.LOGGER.info(" * Simulating a single cell: %s" % (cls.__name__))
        config.LOGGER.info(" *")
        config.LOGGER.info(" **************************************************************************/")
        sim = Simulation(cls.__name__)
        mycell = SupLTS(SupLTS.prototype, sim.model.path + "/SupLTS")
        print 'Created cell:', mycell.path
        vm_table = mycell.comp[mycell.presyn].insertRecorder('Vm_supLTS', 'Vm', sim.data)
        ca_conc_path = mycell.soma.path + '/CaPool'
        ca_table = None
        if config.context.exists(ca_conc_path):
            ca_conc = moose.CaConc(ca_conc_path)
            ca_table = moose.Table('Ca_supLTS', sim.data)
            ca_table.stepMode = 3
            ca_conc.connect('Ca', ca_table, 'inputRequest')
        pulsegen = mycell.soma.insertPulseGen('pulsegen', sim.model, firstLevel=3e-10, firstDelay=100e-3, firstWidth=200e-3)
        sim.schedule()
        if mycell.has_cycle():
            print "WARNING!! CYCLE PRESENT IN CICRUIT."
        t1 = datetime.now()
        sim.run(500e-3)
        t2 = datetime.now()
        delta = t2 - t1
        print 'simulation time: ', delta.seconds + 1e-6 * delta.microseconds
        sim.dump_data('data')
        mycell.dump_cell('supLTS.txt')
        if config.has_pylab:
            mus_vm = config.pylab.array(vm_table) * 1e3
            nrn_vm = config.pylab.loadtxt('../nrn/mydata/Vm_supLTS.plot')
            nrn_t = nrn_vm[:, 0]
            mus_t = linspace(0, sim.simtime*1e3, len(mus_vm))
            nrn_vm = nrn_vm[:, 1]
            nrn_ca = config.pylab.loadtxt('../nrn/mydata/Ca_supLTS.plot')
            nrn_ca = nrn_ca[:,1]
            title = 'SupLTS:'
            config.pylab.title(title)
            config.pylab.plot(nrn_t, nrn_vm, 'y-', label='nrn vm')
            config.pylab.plot(mus_t, mus_vm, 'g-.', label='mus vm')
            config.pylab.legend()
            config.pylab.title('supLTS')
            config.pylab.show()
Example #29
0
def loadGran98NeuroML_L123(filename):
    neuromlR = NeuroML()
    populationDict, projectionDict = \
        neuromlR.readNeuroMLFromFile(filename)
    soma_path = populationDict['Gran'][1][0].path + '/Soma_0'
    somaVm = setupTable('somaVm', moose.Compartment(soma_path), 'Vm')
    somaCa = setupTable('somaCa', moose.CaConc(soma_path + '/Gran_CaPool_98'),
                        'Ca')
    somaIKCa = setupTable('somaIKCa',
                          moose.HHChannel(soma_path + '/Gran_KCa_98'), 'Gk')
    #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')
    soma = moose.Compartment(soma_path)
    print "Reinit MOOSE ... "
    resetSim(['/elec', '/cells'], simdt, plotdt,
             simmethod='ee')  # from moose.utils
    print "Running ... "
    moose.start(runtime)
    print 'Finished simulation for', runtime, 'seconds'
Example #30
0
def CaProto(model):
    if not model.calYN:
        return

    capar = model.CaPlasticityParams.CalciumParams

    if not moose.exists('/library'):
        lib = moose.Neutral('/library')

    if not moose.exists('/library/' + capar.CaName):
        concproto = moose.CaConc('/library/' + capar.CaName)
        concproto.tau = capar.tau
        concproto.CaBasal = capar.Ceq
        concproto.ceiling = 1.
        concproto.floor = 0.0
        concproto.tick = -1

    return moose.element('/library/' + capar.CaName)