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


Python Simulator.Simulator类代码示例

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


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

示例1: runGaussianTest

def runGaussianTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'trunc-norm-v2',
                'bitsPerSymbol': 10,
                'precisionBits': 14,
                'numStandardDevs': 0.1},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4) % 4294967295,
                               100)
    print str(res)
开发者ID:baobao7766,项目名称:baos_Wireless_Lib,代码行数:30,代码来源:SanityTest.py

示例2: doT1pT2p

 def doT1pT2p(self):
     print Community_Coordinate
     nPnt=1000
     nLink=40
     nT1=40
     nT2=20
     tests=""
     s=Simulator(nPnt)
     s.genPoints()
     s.genRandomLinks(nLink*nPnt) 
     
     f2 = open('doT1pT2p2.txt', 'w')               
     for i in range(0,101):     
         for j in range(0,i+1):   
             nSteps=self.MutiTimesNoGen(s,1,nT1,nT2,0.01*i,0.01*j)
             print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
             f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
             tests=tests+str(nSteps)+"\t"
         for j in range(i,101):  
             tests=tests+"0\t"
         tests=tests+("\n")    
     f = open('doT1pT2p.txt', 'w')
     f.write(tests)
               
     return       
开发者ID:sagarjhaa,项目名称:Simulator_GUI,代码行数:25,代码来源:SimulatorExperimence.py

示例3: runTest

def runTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(2)
    logging.debug('runtest begin');
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().randint(0,4294967295,4), 
                               100)
    print str(res)
开发者ID:yptai,项目名称:wireless,代码行数:30,代码来源:SanityTest.py

示例4: runLDPCTest

def runLDPCTest():
    experimentSpec = {
            'packetGen': {'type': 'random',
                          'length': 648*5/6},
            'code': {'type': 'ldpc',
                     'n': 648,
                     'rate': (5,6),
                     'bitsPerSymbol': 3},
            'map': {'type': 'gray',
                    'bitsPerSymbol': 3,
                    'precisionBits': 14},
            'channel': {'type': 'AWGN',
                        'SNR_dB': 17.8},
            'demap': {'type': 'ml-gray',
                      'SNR_dB': 17.8},
            'decoder': {'type': 'ldpc-float-bp',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'one-try',
                         'numSymbols': 648/3},
            'statistics': {'type': 'errors'}
            }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().randint(0,4294967295,4), 
                               100)
    print str(res)
开发者ID:yptai,项目名称:wireless,代码行数:27,代码来源:SanityTest.py

示例5: runRaptorTest

def runRaptorTest():
    experimentSpec = {
            'packetGen': {'type': 'random',
                          'length': 9500},
            'code': {'type': 'raptor'},
            'map': {'type': 'QAM',
                    'bitsPerSymbol': 6},
            'channel': {'type': 'AWGN_c',
                        'SNR_dB': 20},
            'demap': {'type': 'QAM',
                      'useApprox': True},
            'decoder': {'type': 'raptor',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'rate-approx',
                         'maxSymbols': 11500,
                         'delta': 0.97,
                         'minSymbols':1280},
            'statistics': {'type': 'errors'}
            }
    runner = Simulator(2)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               3)
    print str(res)
开发者ID:Casperito,项目名称:wireless,代码行数:25,代码来源:SanityTest.py

示例6: runItppQamLDPCTest

def runItppQamLDPCTest():
    experimentSpec = {
            'packetGen': {'type': 'random',
                          'length': 648*5/6},
            'code': {'type': 'ldpc',
                     'n': 648,
                     'rate': (5,6),
                     'bitsPerSymbol': 1},
            'map': {'type': 'QAM',
                    'bitsPerSymbol': 6},
            'channel': {'type': 'AWGN_c',
                        'SNR_dB': 17.8},
            'demap': {'type': 'QAM'},
            'decoder': {'type': 'ldpc-float-bp',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'one-try',
                         'numSymbols': 648/6},
            'statistics': {'type': 'errors'}
            }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               100)
    print str(res)
开发者ID:Casperito,项目名称:wireless,代码行数:25,代码来源:SanityTest.py

示例7: runBscLDPCTest

def runBscLDPCTest():
    experimentSpec = {
           'packetGen': {'type': 'random',
                          'length': 648*2/3},
            'code': {'type': 'ldpc',
                     'n': 648,
                     'rate': (2,3),
                     'bitsPerSymbol': 1},
            'map': {'type': 'linear',
                    'bitsPerSymbol': 1,
                    'precisionBits': 1},
            'channel': {'type': 'BSC',
                        'flipProb': 0.04},
            'demap': {'type': 'BSC',
                      'flipProb': 0.04},
            'decoder': {'type': 'ldpc-float-bp',
                        'numIter': 40},
            'detector': {'type': 'oracle'},
            'protocol': {'type': 'one-try',
                         'numSymbols': 648},
            'statistics': {'type': 'errors'}
             }
    runner = Simulator(0)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               100)
    print str(res)
开发者ID:Casperito,项目名称:wireless,代码行数:27,代码来源:SanityTest.py

示例8: runParallelKTest

def runParallelKTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'parallel',
                    'alpha': 4,
                    'beta': 64,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               10)
    print str(res)
开发者ID:Casperito,项目名称:wireless,代码行数:30,代码来源:SanityTest.py

示例9: runFirstErrorStatisticsTest

def runFirstErrorStatisticsTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 256},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 4},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': -2},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 100,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'one-try',
                     'numSymbols': 256*2},
        'statistics': {'type': 'first-error'}
        }
    runner = Simulator(1)
    for i in xrange(10):
        res = runner.runExperiment(experimentSpec, 
                                   numpy.random.RandomState().tomaxint(4), 
                                   1)
        print str(res),
    print 
开发者ID:Casperito,项目名称:wireless,代码行数:31,代码来源:SanityTest.py

示例10: doT1nT2n

    def doT1nT2n(self,Community_Coordinate):
        nPnt= 10   #1000
        nLink= 11  #40
        
        tests=""
        s=Simulator(nPnt)
        s.genPoints(Community_Coordinate)
        #s.genRandomLinks(nLink*nPnt)

        return s.pAll
        
        
##        f2=    open('doT1nT2n2.txt', 'w')
##        for i in range(0,100):
##            for j in range(0,i+1):   
##                nSteps=self.MutiTimesNoGen(s,1,i,j,0.5,0.2)
##                print str(i)+"\t"+ str(j) +"\t"+str(nSteps)
##                f2.write(str(i)+"\t"+ str(j) +"\t"+str(nSteps)+"\n")
##                tests=tests+str(nSteps)+"\t"
##            for j in range(i,101):  
##                tests=tests+"0\t"
##            tests=tests+("\n")    
##        f = open('doT1nT2n.txt', 'w')
##        f.write(tests)
                  
        return    
开发者ID:sagarjhaa,项目名称:Simulator_GUI,代码行数:26,代码来源:SimulatorExperimence.py

示例11: runRateApproxProtocolTest

def runRateApproxProtocolTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 24},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 4},
        'map': {'type': 'linear',
                'bitsPerSymbol': 10,
                'precisionBits': 14},
        'channel': {'type': 'AWGN',
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'rate-approx',
                     'maxSymbols': 48*7,
                     'delta': 0.99},
        'statistics': {'type': 'errors'}
        }
    if 1==0:
        experimentSpec['protocol'] = {'type': 'sequential', 'maxPasses':48*8}
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               500)
    print str(res)
开发者ID:Casperito,项目名称:wireless,代码行数:32,代码来源:SanityTest.py

示例12: runCoherenceFadingTest

def runCoherenceFadingTest():
    experimentSpec = {
        'packetGen': {'type': 'random',
                      'length': 300},
        'code': {'type': 'spinal',
                 'puncturing': {'type': '8-way-v2',
                                'numLastCodeStep': 2},
                 'hash': 'one-at-a-time',
                 'bitsPerSymbol': 10,
                 'k': 3},
        'map': {'type': 'soft',
                'bitsPerSymbol': 10},
        'channel': {'type': 'coherence-fading',
                    'interval': 10,
                    'SNR_dB': 10},
        'demap': {'type': 'null'},
        'decoder': {'type': 'regular',
                   'beamWidth': 16,
                   'maxPasses': 48*8},
        'detector': {'type': 'oracle'},
        'protocol': {'type': 'sequential',
                     'maxPasses': 48*8},
        'statistics': {'type': 'errors'}
        }
    runner = Simulator(1)
    res = runner.runExperiment(experimentSpec, 
                               numpy.random.RandomState().tomaxint(4), 
                               100)
    print str(res)
开发者ID:Casperito,项目名称:wireless,代码行数:29,代码来源:SanityTest.py

示例13: _run_simulation

	def _run_simulation(self, num_investments):
		'''Run a single simulation with a given number of investments

		For each position, the number of investments is the number of rows.
		For each investment, we run num_trial trials, where each trial is
		a column in that row.

		We multiply all the trials for each investment by the value of that
		investment, which is simply the intial budget divided by the number
		of investments.

		For each trial (column), we sum up the returns from all the investments
		(rows), producing a 1xnum_trials array with the cumulative returns from 
		each day.'''

		position_value = self.initial_budget / num_investments

		# Create the simulator object
		simulator = Simulator({(0, .51): 1.0, (.51, 1): -1.0}, 
								nrows=num_investments, 
								ncols=self.num_trials) 

		# Run the simulator, and multiply each of the results by the value
		# of a share for this position
		trial_returns = simulator.run() * position_value

		# Collapse all investments on each day into cumulative return
		cumu_ret = self.initial_budget + trial_returns.sum(axis=0)

		# The daily rate of return, which is the final result
		daily_ret = (cumu_ret / float(self.initial_budget)) - 1.

		return daily_ret
开发者ID:whirlkick,项目名称:assignment8,代码行数:33,代码来源:Investor.py

示例14: main

def main():
    logging.basicConfig(level = logging.DEBUG,
                        format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
    simulator = Simulator()
    manager = Manager(simulator)
    ticker = Ticker(1.0, manager)
    xmlrpcserver = XMLRPCServer(manager)
    pbrpcserver = PBRPCServer(manager)

    # Add some random tanks
    for team in range(4):
        for tank in range(100):
            retry = True
            while retry:
                pos = (random.randint(-100, 100), random.randint(-100, 100))
                if pos not in simulator.position:
                    simulator.create_tank(Tank(team, pos))
                    retry = False

    logging.info("Starting main threads")
    ticker.start()
    # The XML-RPC server isn't maintained at the moment
    #xmlrpcserver.start()
    pbrpcserver.start()

    # To stop the system with Ctrl-C
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        ticker.self_destruct()
开发者ID:giomasce,项目名称:codebots,代码行数:31,代码来源:Main.py

示例15: __init__

class Game:
    
    def __init__ (self, complexity = 8, width=1000, height=800, margin=100):
        world = Landscape (terrain = [ground(margin, margin, width-margin, height-margin) for i in range(complexity)])
        self.board = Simulator(world, width=width, height=height)

    def play(self):
        self.board.interactive()
开发者ID:AndySze,项目名称:RoboticCar,代码行数:8,代码来源:game.py


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