def getBurstSizeGenerator(conf, verbose): if conf.get("Burst Size Distribution", "method") == "analytical": if verbose: print "-> Generating burst sizes from analytical function (powerlaw)" mina = conf.get("Burst Size Distribution", "llimit") maxa = conf.get("Burst Size Distribution", "ulimit") bstable = genPowerlawTable(mina, maxa, conf.get("Burst Size Distribution", "lambda")) burstGenerator = lambda:getAcceptRejectBurst(bstable, mina, maxa) elif conf.get("Burst Size Distribution", "method") == "file": if verbose: print "-> Using burst sizes from file", conf.get("Burst Size Distribution", "bsdfile") if conf.get("Burst Size Distribution", "apply") == "corrected": bsizes = readBurstSizes(conf.get("Burst Size Distribution", "bsdfile")) else: bsizes = readBurstSizes(conf.get("Burst Size Distribution", "bsdfile"), corrected = False) burstGenerator = lambda:pyrand.choice(bsizes) return burstGenerator
def getExpBurstgen(bsdfile): print "Using experimental BSD from", bsdfile bsizes = readBurstSizes(bsdfile) burstGenerator = lambda : random.choice(bsizes) return burstGenerator
def getExpBurstgen(bsdfile): print "Using experimental BSD from", bsdfile bsizes = readBurstSizes(bsdfile) burstGenerator = lambda: random.choice(bsizes) return burstGenerator