def add_bovy_rix(axScatter,Rmin,Rmax,zmin,zmax): #Now calculate and plot our model fehs= numpy.linspace(-1.6,0.5,26) afes= numpy.linspace(-0.15,0.55,25) ourDist= numpy.zeros((len(fehs),len(afes))) for ii in range(len(fehs)): for jj in range(len(afes)): ourDist[ii,jj]= maps.abundanceDist(fehs[ii],afes[jj], z=[zmin*1000.,zmax*1000.], r=[Rmin,Rmax]) _ADJUSTABUNDANCES= True _ADJUSTFEH= True if _ADJUSTABUNDANCES: if _ADJUSTFEH: fehs+= 0.15 afes/= 1.5 afes-= 0.025 #Contour this in axScatter ourDist[numpy.isnan(ourDist)]= 0. sortindx= numpy.argsort(ourDist.flatten())[::-1] cumul= numpy.cumsum(numpy.sort(ourDist.flatten())[::-1])/numpy.sum(ourDist.flatten()) cntrThis= numpy.zeros(numpy.prod(ourDist.shape)) cntrThis[sortindx]= cumul cntrThis= numpy.reshape(cntrThis,ourDist.shape) pyplot.sca(axScatter) CS= pyplot.contour(fehs,afes, cntrThis.T,levels=[0.68,0.95], linewidths=3.,linestyles='dashed', colors='r',zorder=10)
colormap = matplotlib.cm.jet def _squeeze(o,omin,omax): return (o-omin)/(omax-omin) d = pickle.load(open('01024/g1536.01024.z0agedecomp.dat')) hz = d['hz']*1000 hzerr = d['hzerr']*1000 rexp = d['rexp'][(d['hzerr'] < 99)] rexperr = d['rexperr'][(d['hzerr'] < 99)] mass = d['mass'][(d['hzerr'] < 99)] #Bovy stuff bovyhz,bovyhzerr=zip(*[mam.hz(u[0],u[1],err=True) for u in zip(mam.fehs(),mam.afes())]) bovyrexp,bovyrexperr=zip(*[mam.hr(u[0],u[1],err=True) for u in zip(mam.fehs(),mam.afes())]) bovymass=np.array([mam.abundanceDist(u[0],u[1]) for u in zip(mam.fehs(),mam.afes())]) maxhr = 5 maxhz = 2000 bovyplotrexp = np.copy(bovyrexp) bighr = bovyrexp > maxhr bovyplotrexp[bighr] = maxhr-0.3 ax = plt.subplot(1,1,1) ages = [i['mean'] for i in d['age']] sizes = 10*(d['mass']/4e8) print sizes scat = plt.scatter(d['rexp'],hz,c=ages,s=sizes,edgecolors='none') plt.xlim(1,6.5) plt.ylim(0,2000)