示例#1
0
'''
Created on 26 sep. 2011

@author: jhkwakkel
'''
import matplotlib.pyplot as plt

from expWorkbench.util import load_results
from analysis.plotting import envelopes

data = load_results(r'./data/2000 flu cases no policy.bz2')
fig, axes_dict = envelopes(data, group_by='policy')
plt.savefig("./pictures/basic_envelope.png", dpi=75)
    figure = plt.figure()
    outcomes = result.keys()
    
    for i, field in enumerate(outcomes):
        number = str(len(outcomes))+'1'+str(i+1)
        ax = figure.add_subplot(number)
        ax.plot(result.get(field))
        ax.text(1, 0.05, 
                field, 
                ha = 'right',
                transform = ax.transAxes)
    plt.show()


def perform_experiments():
    ema_logging.log_to_stderr(level=ema_logging.INFO)
    model = SalinizationModel(r"C:\workspace\EMA-workbench\models\salinization", "verzilting")
    model.step = 4
    
    ensemble = ModelEnsemble()
    ensemble.set_model_structure(model)
    
    ensemble.parallel = True
    nr_of_experiments = 10000
    results = ensemble.perform_experiments(nr_of_experiments)
    return results
        
if __name__ == "__main__":
    results = perform_experiments()
    plotting.envelopes(results)
    plt.show()       
示例#3
0
'''
Created on Jul 8, 2014

@author: [email protected]
'''
import matplotlib.pyplot as plt

from util import ema_logging
from util.util import load_results

from analysis.plotting import envelopes 
from analysis.plotting_util import KDE


ema_logging.log_to_stderr(ema_logging.INFO)

file_name = r'./data/1000 flu cases.tar.gz'
results = load_results(file_name)

# the plotting functions return the figure and a dict of axes
fig, axes = envelopes(results, group_by='policy', density=KDE, fill=True)

# we can access each of the axes and make changes
for key, value in axes.iteritems():
    # the key is the name of the outcome for the normal plot
    # and the name plus '_density' for the endstate distribution
    if key.endswith('_density'):
        value.set_xscale('log')

plt.show()
示例#4
0
'''
Created on 26 sep. 2011

@author: jhkwakkel
'''
import matplotlib.pyplot as plt

from expWorkbench import load_results
from analysis.plotting import envelopes

data = load_results(r'../../../src/analysis/1000 flu cases.cPickle',
                    zipped=False)
fig = envelopes(data, group_by='policy')
plt.show()
'''

import matplotlib.pyplot as plt

from expWorkbench import load_results
from analysis.plotting import envelopes
import analysis.plotting_util as plottingUtil

# force matplotlib to use tight layout
# see http://matplotlib.sourceforge.net/users/tight_layout_guide.html 
# for details
plottingUtil.TIGHT= True

#get the data
results = load_results(r'.\data\TFSC_corrected.bz2')

# make an envelope
fig, axesdict = envelopes(results, 
                outcomes_to_show=['total fraction new technologies'], 
                group_by='policy', 
                grouping_specifiers=['No Policy',
                                     'Basic Policy',
                                     'Optimized Adaptive Policy'],
                legend=False,
                density='kde', fill=True,titles=None)

# set the size of the figure to look reasonable nice
fig.set_size_inches(8,5)

# save figure
plt.savefig("./pictures/policy_comparison.png", dpi=75)
示例#6
0
'''
Created on 26 sep. 2011

@author: jhkwakkel
'''
import matplotlib.pyplot as plt

from expWorkbench import load_results
from analysis.plotting import envelopes

data = load_results(r'../../../src/analysis/1000 flu cases.cPickle',
                    zipped=False)
fig = envelopes(data,
                group_by='policy',
                grouping_specifiers=['static policy', 'adaptive policy'])
plt.show()
'''
Created on 26 sep. 2011

@author: jhkwakkel
'''
import matplotlib.pyplot as plt

from expWorkbench import load_results
from analysis.plotting import envelopes

data = load_results(r'../../../src/analysis/1000 flu cases.cPickle', zipped=False)
fig = envelopes(data, 
                group_by='policy', 
                grouping_specifiers=['static policy', 'adaptive policy'])
plt.show()
'''
Created on 26 sep. 2011

@author: jhkwakkel
'''
import matplotlib.pyplot as plt

from expWorkbench import load_results
from analysis.plotting import envelopes

data = load_results(r'../../../src/analysis/1000 flu cases.cPickle', zipped=False)
fig = envelopes(data, group_by='policy')
plt.show()

    model = EnergyTrans(r'..\..\models\EnergyTrans', "ESDMAElecTrans")
    model.step = 4 #reduce data to be stored
    ensemble = ModelEnsemble()
    ensemble.set_model_structure(model)
    
    policies = [{'name': 'no policy',
                 'file': r'\ESDMAElecTrans_NoPolicy.vpm'},
                {'name': 'basic policy',
                 'file': r'\ESDMAElecTrans_basic_policy.vpm'},
                {'name': 'tech2',
                 'file': r'\ESDMAElecTrans_tech2.vpm'},
                {'name': 'econ',
                 'file': r'\ESDMAElecTrans_econ.vpm'},
                {'name': 'adaptive policy',
                 'file': r'\ESDMAElecTrans_adaptive_policy.vpm'},
                {'name': 'ap with op',
                 'file': r'\ESDMAElecTrans_ap_with_op.vpm'},
                ]
    ensemble.add_policies(policies)

    #turn on parallel
    ensemble.parallel = True
    
    #run policy with old cases
    results = ensemble.perform_experiments(10)

    envelopes(results, column='policy')
    plt.show()


示例#10
0
'''

import matplotlib.pyplot as plt

from expWorkbench import load_results
from analysis.plotting import envelopes
import analysis.plotting_util as plottingUtil

# force matplotlib to use tight layout
# see http://matplotlib.sourceforge.net/users/tight_layout_guide.html 
# for details
plottingUtil.TIGHT= True

#get the data
results = load_results(r'.\data\TFSC_corrected.bz2')

# make an envelope
fig, axesdict = envelopes(results, 
                outcomes_to_show=['total fraction new technologies'], 
                group_by='policy', 
                grouping_specifiers=['No Policy',
                                     'Basic Policy',
                                     'Optimized Adaptive Policy'],
                legend=False,
                density='kde', fill=True,titles=None)

# set the size of the figure to look reasonable nice
fig.set_size_inches(8,5)

# save figure
plt.savefig("./pictures/policy_comparison.png", dpi=75)