コード例 #1
0
        modelX.moveOneTimeStep()
        modelXList.append(dcp(modelX))

    plotData.append({})
    plotData[run]["modelList"] = modelXList
    plotData[run]["tag"] = nametag
    plotData[run]["color"] = plotcolor
    run += 1

#------------------------------------------------------------------------

filenamePrefix = '%s_%s_addInvest' % (country, version)

output.getCombinedPlots(run,
                        plotData,
                        startYear=startYear - 1,
                        filenamePrefix=filenamePrefix,
                        save=True)
output.getCompareDeathsAverted(run,
                               plotData,
                               scalePercent=0.1,
                               filenamePrefix=filenamePrefix,
                               title=title,
                               save=True)
output.getU5StuntingCasesAverted(run,
                                 plotData,
                                 scalePercent=0.5,
                                 filenamePrefix=filenamePrefix,
                                 title=title,
                                 save=True)
output.getA5StuntingCasesAverted(run,
コード例 #2
0
    try:
        modelList.append(pickle.load(infile))
    except (EOFError):
        break
infile.close()

plotData.append({})
plotData[run]["modelList"] = modelList
plotData[run]["tag"] = nametag
plotData[run]["color"] = plotcolor
run += 1

# ------------------------------------------------------------------------
numRuns = run

output.getCombinedPlots(run, plotData, startYear=startYear, filenamePrefix=filenamePrefix, save=True)

# ------------------------------------------------------------------------

import numpy as np
from matplotlib import pyplot as plt
from matplotlib.ticker import FuncFormatter
from matplotlib import rcParams

# set up
modelList = plotData[0]["modelList"]
ageList = modelList[0].ages
numAges = len(ageList)
numMonths = len(modelList)
# numYears = int(len(modelList)/12)
totalPopU5 = {}
コード例 #3
0
for t in range(numsteps-2):
    modelZ.moveOneTimeStep()
    pickle.dump(modelZ, outfile)
outfile.close()    

# collect output, make graphs etc.
infile = open(pickleFilename, 'rb')
newModelList = []
while 1:
    try:
        newModelList.append(pickle.load(infile))
    except (EOFError):
        break
infile.close()

plotData.append({})
plotData[run]["modelList"] = newModelList
plotData[run]["tag"] = nametag
plotData[run]["color"] = plotcolor
run += 1


#------------------------------------------------------------------------    


output.getCombinedPlots(run, plotData)
output.getDeathsAverted(modelList, newModelList, 'test')



コード例 #4
0
    pickleFilename = '%s_Intervention%i_P%i.pkl' % (country, ichoose,
                                                    percentageIncrease)
    nametag = chosenIntervention
    print "\n" + nametag

    fileX = open(pickleFilename, 'rb')
    # read the model output with simple intervention
    modelXList = []
    while 1:
        try:
            modelXList.append(pickle.load(fileX))
        except (EOFError):
            break
    fileX.close()
    plotData.append({})
    plotData[run]["modelList"] = modelXList
    plotData[run]["tag"] = nametag
    plotData[run]["color"] = (1.0 - colorStep * run, 1.0 - 0.23 * abs(run - 4),
                              0.0 + colorStep * run)
    run += 1

output.getCombinedPlots(run,
                        plotData,
                        filenamePrefix=filenamePrefix,
                        save=True)
output.getCompareDeathsAverted(run,
                               plotData,
                               filenamePrefix=filenamePrefix,
                               title=title,
                               save=True)
コード例 #5
0
                                     inputData.coverage[intervention])
    newCoverages[intervention] = max(newCoverages[intervention], 0.0)
modelZ.updateCoverages(newCoverages)

# Run model
for t in range(numsteps - 2):
    modelZ.moveOneTimeStep()
    pickle.dump(modelZ, outfile)
outfile.close()

# collect output, make graphs etc.
infile = open(pickleFilename, 'rb')
newModelList = []
while 1:
    try:
        newModelList.append(pickle.load(infile))
    except (EOFError):
        break
infile.close()

plotData.append({})
plotData[run]["modelList"] = newModelList
plotData[run]["tag"] = nametag
plotData[run]["color"] = plotcolor
run += 1

#------------------------------------------------------------------------

output.getCombinedPlots(run, plotData)
output.getDeathsAverted(modelList, newModelList, 'test')