def plotJuricIvezicDiff(dir): #Plot difference for a few metallicities fehs= [0.,-0.1,-0.2,-0.3,-0.5,-1.,-1.5] colors= ['b','c','g','y','orange','m','r'] #Set up plot bovy_plot.bovy_print() bovy_plot.bovy_plot([-100.,-100.],[-100.,-100],'k,', xrange=[0.47,0.58], yrange=[-1.,1.], xlabel=r'$g-r\ [\mathrm{mag}]$', ylabel=r'$\mathrm{DM}_{\mathrm{Juri\acute{c}}}-\mathrm{DM}_{\mathrm{Ivezi\acute{c}}}\ [\mathrm{mag}]$') xlegend, ylegend, dy= 0.55, 0.8,-0.12 grs= numpy.linspace(0.48,0.55,1001) for ii in range(len(fehs)): ybright= -1.*(_mr_ri_bright(_ri_gr(grs))-_mr_gi(_gi_gr(grs),fehs[ii])) yfaint= -1.*(_mr_ri_faint(_ri_gr(grs))-_mr_gi(_gi_gr(grs),fehs[ii])) bovy_plot.bovy_plot(grs, ybright, '-',color=colors[ii], overplot=True) bovy_plot.bovy_plot(grs, yfaint, '--',color=colors[ii], overplot=True) bovy_plot.bovy_text(xlegend,ylegend+ii*dy, r'$[\mathrm{Fe/H]=%+4.1f}$' % fehs[ii], color=colors[ii]) bovy_plot.bovy_end_print(os.path.join(dir,'dm_juric_ivezic.'+_EXT))
def plotAnIvezicDiff(dir): #Load An isochrones a= isodist.AnIsochrone() #Plot difference for a few metallicities fehs= [0.,-0.1,-0.2,-0.3,-0.5,-1.,-1.5] colors= ['b','c','g','y','orange','m','r'] #Set up plot bovy_plot.bovy_print() bovy_plot.bovy_plot([-100.,-100.],[-100.,-100],'k,', #xrange=[0.47,0.58], xrange=[0.53,0.78], yrange=[-0.25,.25], xlabel=r'$g-r\ [\mathrm{mag}]$', ylabel=r'$\mathrm{DM}_{\mathrm{An}}-\mathrm{DM}_{\mathrm{Ivezi\acute{c}}}\ [\mathrm{mag}]$') xlegend, ylegend, dy= 0.545, 0.2,-0.03 for ii in range(len(fehs)): iso= a(numpy.log10(10.),feh=fehs[ii]) #Get G dwarfs indx= (iso['g']-iso['r'] <= 0.75)*(iso['g']-iso['r'] >= 0.55)\ *(iso['logg'] > 4.1) y= -1.*(iso['r'][indx]-_mr_gi(_gi_gr(iso['g'][indx] -iso['r'][indx]),fehs[ii])) bovy_plot.bovy_plot(iso['g'][indx]-iso['r'][indx], y, '-',color=colors[ii], overplot=True) bovy_plot.bovy_text(xlegend,ylegend+ii*dy, r'$[\mathrm{Fe/H]=%+4.1f}$' % fehs[ii], color=colors[ii]) bovy_plot.bovy_end_print(os.path.join(dir,'dm_an_ivezic.'+_EXT))
def plotDMMetallicityColor(options,args): """Make a density plot of DM vs FeH and g-r""" if options.png: ext= 'png' else: ext= 'ps' if options.metal.lower() == 'rich': yrange=[-0.55,0.5] fehrange= _APOORFEHRANGE elif options.metal.lower() == 'poor': yrange=[-1.6,0.3] fehrange= _ARICHFEHRANGE xrange=[0.46,0.57] grmin, grmax= 0.48, 0.55 colorrange=[0.48,0.55] #Set up arrays nfehs, ngrs= 201,201 grs= numpy.linspace(xrange[0],xrange[1],nfehs) fehs= numpy.linspace(yrange[0],yrange[1],ngrs) plotthis= numpy.zeros((ngrs,nfehs)) for ii in range(ngrs): for jj in range(nfehs): if grs[ii] < colorrange[0] \ or grs[ii] > colorrange[1] \ or fehs[jj] < fehrange[0] \ or fehs[jj] > fehrange[1]: plotthis[ii,jj]= numpy.nan continue plotthis[ii,jj]= segueSelect._mr_gi(segueSelect._gi_gr(grs[ii]),fehs[jj]) if options.sample.lower() == 'g': if options.metal.lower() == 'rich': levels= [4.5,4.75,5.,5.25,5.5] else: levels= [5.25,5.5,5.75,6.,6.25] cntrlabelcolors= ['w' for ii in range(3)] cntrlabelcolors.extend(['k' for ii in range(2)]) #nlevels= 6 #levelsstart= int(20.*numpy.nanmin(plotthis))/20. #levelsd= int(20.*(numpy.nanmax(plotthis)-numpy.nanmin(plotthis)))/20. #levels= [levelsstart+ii/float(nlevels)*levelsd for ii in range(nlevels)] #Plot it bovy_plot.bovy_print() bovy_plot.bovy_dens2d(plotthis.T,origin='lower', xlabel=r'$g-r\ [\mathrm{mag}]$', ylabel=r'$[\mathrm{Fe/H}]$', zlabel=r'$M_r\ [\mathrm{mag}]$', colorbar=True, cmap=pyplot.cm.gist_gray, contours=True, levels=levels, cntrcolors=cntrlabelcolors, cntrlabel=True, cntrlabelcolors=cntrlabelcolors, cntrinline=True, interpolation='nearest', extent=[xrange[0],xrange[1], yrange[0],yrange[1]], aspect=(xrange[1]-xrange[0])/\ (yrange[1]-yrange[0]), shrink=.78) bovy_plot.bovy_end_print(os.path.join(args[0],'dm_FeH_gr_'+options.sample+'_'+options.metal+'.'+ext))
def AnDistance(gr,feh,k=False): """Return the relative distance factor between An and Ivezic distances for a sample of stars""" #First find nearest feh with an isochrone mfeh= numpy.mean(feh) indx= numpy.argmin(numpy.fabs(mfeh-anfehs)) #Load the relevant isochrone iso= a(numpy.log10(10.),feh=anfehs[indx]) #Get dwarfs if not k: rindx= (iso['g']-iso['r'] <= 0.75)*(iso['g']-iso['r'] >= 0.55)\ *(iso['logg'] > 4.1) else: rindx= (iso['g']-iso['r'] > 0.75)*(iso['g']-iso['r'] <= 0.95)\ *(iso['logg'] > 4.1) y= -1.*(iso['r'][rindx]-_mr_gi(_gi_gr(iso['g'][rindx] -iso['r'][rindx]),anfehs[indx])) isogr= iso['g'][rindx]-iso['r'][rindx] out= 0. for ii in range(len(gr)): tindx= numpy.argmin(numpy.fabs(gr[ii]-isogr)) out+= y[tindx] return 10.**(out/5./len(gr))