当前位置: 首页>>代码示例>>Python>>正文


Python utils.dump函数代码示例

本文整理汇总了Python中moose.utils.dump函数的典型用法代码示例。如果您正苦于以下问题:Python dump函数的具体用法?Python dump怎么用?Python dump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dump函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getCellPath

    def getCellPath(self, populationType, instanceId):
        ''' Given a population type and instanceId, return its path '''
        try:
            path = self.populationDict[populationType][1]
        except KeyError as e:
            utils.dump("ERROR"
                    , [ "Population type `{0}` not found".format(populationType)
                        , "Availale population in network are "
                        , self.populationDict.keys()
                    ]
                    )
            raise KeyError("Missing population type : {}".format(populationType))
        except Exception as e:
            raise e

        try:
            path = path[instanceId]
        except KeyError as e:
            msg = "Population type {} has no instance {}".format(
                    populationType
                    , instanceId
                    )
            utils.dump("ERROR"
                    , [msg , "Available instances are" , path.keys() ]
                    )
            raise KeyError(msg)

        # Now get the path from moose path
        path = path.path
        if not re.match(r'(\/\w+)+', path):
            raise UserWarning("{} is not a valid path".format(path))
        return path 
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:32,代码来源:NetworkML.py

示例2: simulate

    def simulate( self, simTime, simDt = 1e-3, plotDt = None ):
        '''Simulate the cable '''

        if plotDt is None:
            plotDt = simDt / 2
        self.simDt = simDt
        self.plotDt = plotDt
        self.setupDUT( )
 
        # Setup clocks 
        utils.dump("STEP", "Setting up the clocks ... ")
        moose.setClock( 0, self.simDt )
        moose.setClock( 1, self.simDt )
        moose.setClock( 2, self.simDt )

        ## Use clocksc
        moose.useClock( 0, '/cable/##'.format(self.cablePath), 'process' )
        moose.useClock( 1, '/cable/##'.format(self.cablePath), 'init' )
        moose.useClock( 2, '{}/##'.format(self.tablePath), 'process' )

        utils.dump("STEP"
                , [ "Simulating cable for {} sec".format(simTime)
                    , " simDt: %s, plotDt: %s" % ( self.simDt, self.plotDt )
                    ]
                )
        self.setupHSolve( )
        moose.reinit( )
        utils.verify( )
        moose.start( simTime )
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:29,代码来源:rallpacks_passive_cable.py

示例3: __init__

    def __init__(self, path, length, diameter, args):
        """ Initialize moose-compartment """
        self.mc_ = None
        self.path = path
        # Following values are taken from Upi's chapter on Rallpacks
        self.RM = args.get('RM', 4.0)
        self.RA = args.get('RA', 1.0)
        self.CM = args.get('CM', 0.01)
        self.Em = args.get('Em', -0.065)
        self.diameter = diameter
        self.compLength = length
        self.computeParams( )

        try:
            self.mc_ = moose.Compartment(self.path)
            self.mc_.length = self.compLength
            self.mc_.diameter = self.diameter
            self.mc_.Ra = self.Ra
            self.mc_.Rm = self.Rm
            self.mc_.Cm = self.Cm
            self.mc_.Em = self.Em
            self.mc_.initVm = self.Em

        except Exception as e:
            utils.dump("ERROR"
                    , [ "Can't create compartment with path %s " % path
                        , "Failed with error %s " % e
                        ]
                    )
            raise
开发者ID:hrani,项目名称:moose-core,代码行数:30,代码来源:moose_sim.py

示例4: addProperties

    def addProperties(self, pre_segment_path, post_segment_path, props, options):
        '''Add properties 
        '''
        synName = options['syn_name']
        source = options['source']
        target = options['target']
        weight = options['weight']
        threshold = options['threshold']
        propDelay = options['prop_delay']

        synapse = props.attrib.get('synapse_type', None)
        if not synapse: 
            utils.dump("WARN"
                    , "Synapse type {} not found.".format(synapse)
                    , frame = inspect.currentframe()
                    )
            raise UserWarning("Missing parameter synapse_type")

        synName = synapse
        weight_override = float(props.attrib['weight'])
        if 'internal_delay' in props.attrib:
            delay_override = float(props.attrib['internal_delay'])
        else: delay_override = propDelay
        if weight_override != 0.0:
            self.connectUsingSynChan(synName
                    , pre_segment_path
                    , post_segment_path
                    , weight_override
                    , threshold, delay_override
                    )
        else: pass
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:31,代码来源:NetworkML.py

示例5: createInputs

    def createInputs(self):

        """ createInputs

        Create inputs as given in NML file and attach them to moose.
        """

        for inputs in self.network.findall(".//{"+nmu.nml_ns+"}inputs"):
            units = inputs.attrib['units']

            # This dict is to be passed to function which attach an input
            # element to moose.
            factors = {}

            # see pg 219 (sec 13.2) of Book of Genesis
            if units == 'Physiological Units':
                factors['Vfactor'] = 1e-3 # V from mV
                factors['Tfactor'] = 1e-3 # s from ms
                factors['Ifactor'] = 1e-6 # A from microA
            else:
                utils.dump("NOTE", "We got {0}".format(units))
                factors['Vfactor'] = 1.0
                factors['Tfactor'] = 1.0
                factors['Ifactor'] = 1.0

            for inputElem in inputs.findall(".//{"+nmu.nml_ns+"}input"):
                self.attachInputToMoose(inputElem, factors) 
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:27,代码来源:NetworkML.py

示例6: plotVector

 def plotVector(self, vector, plotname):
     ''' Saving input vector to a file '''
     name = plotname.replace('/', '_')
     fileName = os.path.join(self.plotPaths, name)+'.eps'
     utils.dump("DEBUG"
             , "Saving vector to a file {}".format(fileName)
             )
     plt.vlines(vector, 0, 1)
     plt.savefig(fileName)
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:9,代码来源:NetworkML.py

示例7: createChannel

def createChannel(species, path, **kwargs):
    """Create a channel """
    if species == 'na':
        return sodiumChannel( path, **kwargs)
    elif species == 'ca':
        channel.Xpower = 4
    else:
        utils.dump("FATAL", "Unsupported channel type: {}".format(species))
        raise RuntimeError("Unsupported species of chanel")
开发者ID:pgleeson,项目名称:moose-core,代码行数:9,代码来源:rallpacks_cable_hhchannel.py

示例8: recordAt

 def recordAt(self, depth, index):
     """ Parameter index is python list-like index. Index -1 is the last
     elements in the list 
     """
     utils.dump("RECORD", "Adding probe at index {} and depth {}".format(index, depth))
     c = self.cable[depth][index]
     t = moose.Table("{}/output_at_{}".format(self.tablePath, index))
     moose.connect(t, "requestOut", c, "getVm")
     return t
开发者ID:neurord,项目名称:moose-core,代码行数:9,代码来源:rallpacks_tree_cable.py

示例9: makeCable

 def makeCable( self, args ):
     ''' Make a cable out of n compartments '''
     for i in range( self.ncomp ):
         compPath = '{}/comp{}'.format( self.cablePath, i)
         l = self.length / self.ncomp
         d = self.diameter
         c = comp.MooseCompartment( compPath, l, d, args )
         self.cable.append(c)
     self.connect( )
     utils.dump( "STEP"
             , "Passive cable is connected and ready for simulation." 
             )
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:12,代码来源:rallpacks_passive_cable.py

示例10: simulate

    def simulate( self, simTime):
        '''Simulate the cable '''

        self.setupDUT( )
        utils.dump("STEP"
                ,  "Simulating cable for {} sec".format(simTime)
                )
        moose.reinit( )
        self.setupHSolve( )
        t = time.time()
        moose.start( simTime )
        st = time.time()
        return st-t
开发者ID:BhallaLab,项目名称:benchmarks,代码行数:13,代码来源:moose_sim.py

示例11: createProjection

    def createProjection(self, projection):
        projectionName = projection.attrib["name"]
        utils.dump("INFO", "Projection {0}".format(projectionName))
        source = projection.attrib["source"]
        target = projection.attrib["target"]
        self.projectionDict[projectionName] = (source,target,[])

        # TODO: Assuming that only one element <synapse_props> under
        # <projection> element.
        synProps = projection.find(".//{"+nmu.nml_ns+"}synapse_props")
        options = self.addSyapseProperties(projection, synProps, source, target)

        connections = projection.findall(".//{"+nmu.nml_ns+"}connection")
        [self.addConnection(c, projection, options) for c in connections]
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:14,代码来源:NetworkML.py

示例12: buildCable

 def buildCable(self, args):
     """ Build binary cable """
     self.args = args
     self.buildParameterLists()
     # Cable is a list of lists.
     self.cable = list()
     for n, (l, d) in enumerate(zip(self.compLengthList, self.compDiamList)):
         utils.dump("STEP", "Binary tree level {}: length {}, diameter {}".format(n, l, d))
         noOfCompartments = pow(2, n)
         compartmentList = []
         for i in range(noOfCompartments):
             compPath = "{}/comp_{}_{}".format(self.cablePath, n, i)
             m = comp.MooseCompartment(compPath, l, d, args)
             compartmentList.append(m.mc_)
         self.cable.append(compartmentList)
     self.connectCable()
开发者ID:neurord,项目名称:moose-core,代码行数:16,代码来源:rallpacks_tree_cable.py

示例13: configureSynChan

    def configureSynChan(self, synObj, synParams={}):
        '''Configure synapse. If no parameters are given then use the default
        values. 

        '''
        assert(isinstance(synObj, moose.SynChan))
        utils.dump("SYNAPSE"
                , "Configuring SynChan"
                )
        synObj.tau1 = synParams.get('tau1', 5.0)
        synObj.tau2 = synParams.get('tau2', 1.0)
        synObj.Gk = synParams.get('Gk', 1.0)
        synObj.Ek = synParams.get('Ek', 0.0)
        synObj.synapse.num = synParams.get('synapse_num', 1)
        synObj.synapse.delay = synParams.get('delay', 1.0)
        synObj.synapse.weight = synParams.get('weight', 1.0)
        return synObj
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:17,代码来源:NetworkML.py

示例14: simulate

    def simulate(self, simTime, simDt, plotDt=None):
        """Simulate the cable 
        """
        self.simDt = simDt
        self.setupDUT()

        # Setup clocks
        moose.setClock(0, self.simDt)

        # Use clocks
        moose.useClock(0, "/##", "process")
        moose.useClock(0, "/##", "init")

        utils.dump("STEP", ["Simulating cable for {} sec".format(simTime), " simDt: %s" % self.simDt])
        utils.verify()
        moose.reinit()
        self.setupSolver()
        moose.start(simTime)
开发者ID:neurord,项目名称:moose-core,代码行数:18,代码来源:rallpacks_tree_cable.py

示例15: connectWrapper

 def connectWrapper(self, src, srcF, dest, destF, messageType='Single'):
     """
     Wrapper around moose.connect 
     """
     utils.dump("INFO"
             , "Connecting ({4})`\n\t{0},{1}`\n\t`{2},{3}".format(
                 src.path
                 , srcF
                 , dest.path
                 , destF
                 , messageType
                 )
             , frame = inspect.currentframe()
             )
     try:
         res = moose.connect(src, srcF, dest, destF, messageType)
         assert res, "Failed to connect"
     except Exception as e:
         utils.dump("ERROR", "Failed to connect.")
         raise e
开发者ID:2pysarthak,项目名称:moose-core-personal,代码行数:20,代码来源:NetworkML.py


注:本文中的moose.utils.dump函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。