runs[name]['ho'] = {} runs[name]['ho']['hist'] = [] runs[name]['ho']['progress'] = [0]*9999 runs[name]['ho']['ab_rv'] = {'revenues':[],'lrevenues':[],'abilities':[],'labilities':[]} runs[name]['ho']['nn_rv'] = {'revenues':[],'lrevenues':[],'distances':[],'ldistances':[]} runs[name]['he'] = {} runs[name]['he']['hist'] = [] runs[name]['he']['progress'] = [0]*9999 runs[name]['he']['ab_rv'] = {'revenues':[],'lrevenues':[],'abilities':[],'labilities':[]} runs[name]['he']['nn_rv'] = {'revenues':[],'lrevenues':[],'distances':[],'ldistances':[]} for i in range(0,10): sim = pickle.load(open("runs/"+name+"i"+str(i)+".pickle", "rb")) simHO = sim['ho'] simHE = sim['he'] runs[name]['ho']['hist'] += icon.revenues(simHO['firms'], rkind) runs[name]['he']['hist'] += icon.revenues(simHE['firms'], rkind) if (len(simHO['progress']) > len(runs[name]['ho']['progress'])): runs[name]['ho']['progress'] = numpy.add(runs[name]['ho']['progress'],simHO['progress'][0:len(runs[name]['ho']['progress'])]) else: runs[name]['ho']['progress'] = numpy.add(runs[name]['ho']['progress'][0:len(simHO['progress'])],simHO['progress']) 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']
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") fig2, ((ex,fx),(gx,hx)) = plt.subplots(nrows=2, ncols=2)
import icon as icon import matplotlib.pyplot as plt rkind = 'property' sim = icon.sim(25,250,0.9,-1,rkind) fig, (ax,bx) = plt.subplots(nrows=1, ncols=2) fig.set_facecolor("#ffffff") ax.set_title("Homogeneous") ax.set_xlabel("Revenues") ax.hist(icon.revenues(sim['ho']['firms'],rkind)) bx.set_title("Heterogeneous") bx.set_xlabel("Revenues") bx.hist(icon.revenues(sim['he']['firms'],rkind)) plt.show()