import icon as icon import numpy import matplotlib.pyplot as plt rkind = 'property' sim = icon.sim(50,500,0.9,1,rkind) simHO = sim['ho'] simHE = sim['he'] ab_rv_HO = icon.revenue_by_ability(simHO['firms'],rkind) ab_rv_HE = icon.revenue_by_ability(simHE['firms'],rkind) nn_rv_HO = icon.revenue_by_nn(simHO['firms'],rkind) nn_rv_HE = icon.revenue_by_nn(simHE['firms'],rkind) ##### plot the sucka fig1, ((ax,cx),(bx,dx)) = plt.subplots(nrows=2, ncols=2) fig1.set_facecolor("#ffffff") ax.set_title("Homogeneous") ax.hist(icon.revenues(simHO['firms'],rkind)) ax.set_xlabel("revenue (knowledge uncovered)") ax.set_ylabel("frequency") bx.plot(range(0,len(simHO['progress'])),simHO['progress']) bx.set_xlabel("time") bx.set_ylabel("% discovered") cx.set_title("Heterogeneous") cx.hist(icon.revenues(simHE['firms'],rkind)) cx.set_xlabel("revenue (knowledge uncovered)") cx.set_ylabel("frequency") dx.plot(range(0,len(simHE['progress'])),simHE['progress']) dx.set_xlabel("time") dx.set_ylabel("% discovered")
if (len(simHE['progress']) > len(runs[name]['he']['progress'])): runs[name]['he']['progress'] = numpy.add(runs[name]['he']['progress'],simHE['progress'][0:len(runs[name]['he']['progress'])]) else: runs[name]['he']['progress'] = numpy.add(runs[name]['he']['progress'][0:len(simHE['progress'])],simHE['progress']) tmp = icon.revenue_by_ability(simHO['firms'],rkind) runs[name]['ho']['ab_rv']['lrevenues'] += tmp['lrevenues'] runs[name]['ho']['ab_rv']['labilities'] += tmp['labilities'] runs[name]['ho']['ab_rv']['revenues'] += tmp['revenues'] runs[name]['ho']['ab_rv']['abilities'] += tmp['abilities'] tmp = icon.revenue_by_ability(simHE['firms'],rkind) runs[name]['he']['ab_rv']['lrevenues'] += tmp['lrevenues'] runs[name]['he']['ab_rv']['labilities'] += tmp['labilities'] runs[name]['he']['ab_rv']['revenues'] += tmp['revenues'] runs[name]['he']['ab_rv']['abilities'] += tmp['abilities'] tmp = icon.revenue_by_nn(simHO['firms'],rkind) runs[name]['ho']['nn_rv']['lrevenues'] += tmp['lrevenues'] runs[name]['ho']['nn_rv']['ldistances'] += tmp['ldistances'] runs[name]['ho']['nn_rv']['lrevenues'] += tmp['lrevenues'] runs[name]['ho']['nn_rv']['ldistances'] += tmp['ldistances'] tmp = icon.revenue_by_nn(simHE['firms'],rkind) runs[name]['he']['nn_rv']['lrevenues'] += tmp['lrevenues'] runs[name]['he']['nn_rv']['ldistances'] += tmp['ldistances'] runs[name]['he']['nn_rv']['revenues'] += tmp['revenues'] runs[name]['he']['nn_rv']['distances'] += tmp['distances'] runs[name]['ho']['progress'] = _div(runs[name]['ho']['progress'],10) runs[name]['he']['progress'] = _div(runs[name]['he']['progress'],10) pickle.dump(runs, open( "runs.pickle", "wb" ) )