def profileSimulate(self): startDate, endDate, recordStep, printStep, M, targetGraph = HIVModelUtils.realSimulationParams() meanTheta, sigmaTheta = HIVModelUtils.estimatedRealTheta() meanTheta = numpy.array([337, 1.4319, 0.211, 0.0048, 0.0032, 0.5229, 0.042, 0.0281, 0.0076, 0.0293]) undirected = True graph = HIVGraph(M, undirected) logging.info("Created graph: " + str(graph)) alpha = 2 zeroVal = 0.9 p = Util.powerLawProbs(alpha, zeroVal) hiddenDegSeq = Util.randomChoice(p, graph.getNumVertices()) rates = HIVRates(graph, hiddenDegSeq) model = HIVEpidemicModel(graph, rates) model.setT0(startDate) model.setT(startDate+100) model.setRecordStep(recordStep) model.setPrintStep(printStep) model.setParams(meanTheta) logging.debug("MeanTheta=" + str(meanTheta)) ProfileUtils.profile('model.simulate()', globals(), locals())
from exp.viroscopy.model.HIVModelUtils import HIVModelUtils import matplotlib.pyplot as plt """ This is the epidemic model for the HIV spread in cuba. We try to get more bisexual contacts """ assert False, "Must run with -O flag" logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) numpy.seterr(all='raise') numpy.random.seed(24) numpy.set_printoptions(suppress=True, precision=4, linewidth=100) startDate, endDate, recordStep, M, targetGraph = HIVModelUtils.realSimulationParams() endDate = startDate + 10000 meanTheta, sigmaTheta = HIVModelUtils.estimatedRealTheta() meanTheta = numpy.array([ 50, 0.5131, 0.3242, 0.1, 0.0001, 0.0, 325, 0.34, 0.001, 0.1, 0.1, 0.1]) outputDir = PathDefaults.getOutputDir() + "viroscopy/" undirected = True graph = HIVGraph(M, undirected) logging.info("Created graph: " + str(graph)) alpha = 2 zeroVal = 0.9 p = Util.powerLawProbs(alpha, zeroVal) hiddenDegSeq = Util.randomChoice(p, graph.getNumVertices()) rates = HIVRates(graph, hiddenDegSeq)