def GMRrichness(ra=None,dec=None,photoz=None,cat=None,plot=True,err=True,rw=True,bcg=True,radius=1.): fra=cat.field('ra') fdec=cat.field('dec') imag=cat.field('model_counts')[:,3] gmr=cat.field('gmr') gmrerr=cat.field('gmr_err') depth=12 h=es.htm.HTM(depth) srad=np.rad2deg(radius/Da(0,photoz)) m1,m2,d12 = h.match(ra,dec,fra,fdec,srad,maxmatch=5000) cimag=imag[m2[0]] cgmr=gmr[m2[0]] r12=np.deg2rad(d12)*Da(0,photoz) if bcg is True: indices=(imag[m2]<=limi(photoz))*(imag[m2]>cimag) else: indices=(imag[m2]<=limi(photoz)) ntot=len(m2[indices]) if ntot <= 10: return 0, 0, 0 alpha=np.array([0.5,0.5]) mu=np.array([sts.scoreatpercentile(gmr[m2[indices]],per=70),sts.scoreatpercentile(gmr[m2[indices]],per=40)]) sigma=np.array([0.04,0.3]) if err is True: if rw is False: aic2=gmm.aic_ecgmm(gmr[m2[indices]],gmrerr[m2[indices]],alpha,mu,sigma) aic1=gmm.wstat(gmr[m2[indices]],gmrerr[m2[indices]])[3] else: aic2,alpha,mu,sigma=rwgmm.aic2EM(gmr[m2[indices]],gmrerr[m2[indices]],r12[indices],alpha,mu,sigma) aic1=rwgmm.aic1EM(gmr[m2[indices]],gmrerr[m2[indices]],r12[indices])[0] else: aic2=gmm.aic_ecgmm(gmr[m2[indices]],aalpha=alpha,mmu=mu,ssigma=sigma) aic1=gmm.wstat(gmr[m2[indices]])[3] if plot==True: pl.hist(gmr[m2[indices]],bins=30,normed=True,facecolor='green',alpha=0.3) pl.vlines(cgmr,0,3,color='green') x=np.arange(-1,5,0.01) srt=np.argsort(sigma) alpha=alpha[srt] mu=mu[srt] sigma=sigma[srt] z = gmrz(mu[0]) t=gmm.ecgmmplot(x,alpha,mu,sigma) pl.xlabel('g - r') pl.figtext(0.61,0.85,r'$\alpha$: '+str(np.round(alpha,4))) pl.figtext(0.61,0.8,r'$\mu$: '+str(np.round(mu,4))) pl.figtext(0.61,0.75,r'$\sigma$: '+str(np.round(sigma,4))) pl.figtext(0.61,0.68,r'$Amplitude$: '+str(np.round(ntot*alpha[0],2))) pl.figtext(0.61,0.61,r'$AIC_1$: '+str(aic1)) pl.figtext(0.61,0.54,r'$AIC_2$: '+str(aic2)) pl.figtext(0.61,0.47,'Photoz: '+str(photoz)) pl.figtext(0.61,0.4,'ridgeline Z: '+str(z)) pl.title('Total # of galaxies: '+str(ntot)) return ntot*alpha[0],aic1,aic2,cgmr,alpha,mu,sigma,z
def IMZrichness(ra, dec, photoz, cat, plot=True): fra = cat.field('ra') fdec = cat.field('dec') imag = cat.field('model_counts')[:, 3] imz = cat.field('imz') imzerr = cat.field('imz_err') depth = 12 h = es.htm.HTM(depth) srad = np.rad2deg(1. / es.cosmology.Da(0, photoz, h=0.7) / (1 + photoz)) m1, m2, d12 = h.match(ra, dec, fra, fdec, srad, maxmatch=5000) indices = (imag[m2] <= limi(photoz)) ntot = len(m2[indices]) alpha = np.array([0.5, 0.5]) mu = np.array([ sts.scoreatpercentile(imz[m2[indices]], per=70), sts.scoreatpercentile(imz[m2[indices]], per=40) ]) sigma = np.array([0.04, 0.3]) aic2 = gmm.aic_ecgmm(imz[m2[indices]], imzerr[m2[indices]], alpha, mu, sigma) aic1 = gmm.wstat(imz[m2[indices]], imzerr[m2[indices]])[3] if plot == True: pl.hist(imz[m2[indices]], bins=30, normed=True, histtype='step') x = np.arange(-1, 5, 0.01) srt = np.argsort(sigma) alpha = alpha[srt] mu = mu[srt] sigma = sigma[srt] t = gmm.ecgmmplot(x, alpha, mu, sigma) pl.xlabel('i - z') pl.figtext(0.61, 0.85, r'$\alpha$: ' + str(np.round(alpha, 4))) pl.figtext(0.61, 0.8, r'$\mu$: ' + str(np.round(mu, 4))) pl.figtext(0.61, 0.75, r'$\sigma$: ' + str(np.round(sigma, 4))) pl.figtext(0.61, 0.68, r'$Ngals$: ' + str(np.round(ntot * alpha[0]))) pl.figtext(0.61, 0.61, r'$AIC_1$: ' + str(aic1)) pl.figtext(0.61, 0.54, r'$AIC_2$: ' + str(aic2)) pl.figtext(0.61, 0.47, 'Photoz: ' + str(photoz)) pl.title('Total # of galaxies: ' + str(ntot)) return ntot * alpha[0]
z,alp1m,yerr = bp.bin_scatter(redshift,alp1,binsize=0.05,plot=False) z,mu0m,yerr = bp.bin_scatter(redshift,mu0,binsize=0.05,plot=False) z,mu1m,yerr = bp.bin_scatter(redshift,mu1,binsize=0.05,plot=False) z,sgm0m,yerr = bp.bin_scatter(redshift,sgm0,binsize=0.05,plot=False) z,sgm1m,yerr = bp.bin_scatter(redshift,sgm1,binsize=0.05,plot=False) alpha = np.array(zip(alp0m,alp1m)) mu = np.array(zip(mu0m,mu1m)) sigma = np.array(zip(sgm0m,sgm1m)) x=np.arange(-0.5,2.5,0.01) pl.figure(figsize=(15,15)) nn = len(z) for i in range(nn): pl.subplot(3,3,i+1) gmm.ecgmmplot(x,alpha[i],mu[i],sigma[i]) pl.title('zbin: '+str(round(z[i],3))+' +/- 0.025') pl.xlabel('g - r') if galtype == 'truth': pl.ylabel('DES Mock '+version+' : Truth') else: pl.ylabel('DES Mock '+version+' : Obs catalog') if galtype == 'truth': pl.savefig(catdir+'DES_Mock_'+version+'_gmr_distribution_truth_zbin.png') else: pl.savefig(catdir+'DES_mock_'+version+'_gmr_distribution_obs_zbin.png') pl.close() #------rmi ridgeline distribution ------ redshift = resRI[9]
def RMIrichness(ra=None, dec=None, photoz=None, cat=None, plot=True, err=True, rw=True, bcg=True): fra = cat.field('ra') fdec = cat.field('dec') imag = cat.field('imag') rmi = cat.field('model_mag')[:, 2] - cat.field('model_mag')[:, 3] rmierr = np.sqrt( cat.field('model_magerr')[:, 2]**2 + cat.field('model_magerr')[:, 3]**2) depth = 12 h = es.htm.HTM(depth) srad = np.rad2deg(1. / Da(0, photoz)) m1, m2, d12 = h.match(ra, dec, fra, fdec, srad, maxmatch=50000) r12 = np.deg2rad(d12) * Da(0, photoz) cimag = imag[m2[0]] crmi = rmi[m2[0]] if bcg is True: indices = (imag[m2] <= limi0_2(photoz)) * (imag[m2] > cimag) else: indices = (imag[m2] <= limi0_2(photoz)) ntot = len(m2[indices]) if ntot <= 10: return 'not enough galaxy brighter than 0.2 L*' alpha = np.array([0.5, 0.5]) mu = np.array([ sts.scoreatpercentile(rmi[m2[indices]], per=70), sts.scoreatpercentile(rmi[m2[indices]], per=40) ]) sigma = np.array([0.04, 0.3]) if err is True: if rw is False: aic2 = gmm.aic_ecgmm(rmi[m2[indices]], rmierr[m2[indices]], alpha, mu, sigma) aic1 = gmm.wstat(rmi[m2[indices]], rmierr[m2[indices]])[3] else: aic2, alpha, mu, sigma = rwgmm.aic2EM(rmi[m2[indices]], rmierr[m2[indices]], r12[indices], alpha, mu, sigma) aic1 = rwgmm.aic1EM(rmi[m2[indices]], rmierr[m2[indices]], r12[indices])[0] else: aic2 = gmm.aic_ecgmm(rmi[m2[indices]], aalpha=alpha, mmu=mu, ssigma=sigma) aic1 = gmm.wstat(rmi[m2[indices]])[3] srt = np.argsort(sigma) alpha = alpha[srt] mu = mu[srt] sigma = sigma[srt] z = rmiz(mu[0]) if plot == True: pl.figure(figsize=(12, 6)) pl.subplot(1, 2, 1) hh = pl.hist(rmi[m2[indices]], bins=50, normed=True, facecolor='green', alpha=0.3, range=[-1, 3]) pl.vlines(crmi, 0, hh[0].max() + 0.5, color='red', lw=2, linestyle='dashed') pl.grid() x = np.arange(-1, 3, 0.01) t = gmm.ecgmmplot(x, alpha, mu, sigma) richness = ntot * alpha[0] pl.xlabel('r - i') pl.figtext(0.61, 0.85, 'Relative Weights: ' + str(np.round(alpha, 4))) pl.figtext(0.61, 0.8, 'Mean Colors: ' + str(np.round(mu, 4))) pl.figtext(0.61, 0.75, 'Mean Color Widths: ' + str(np.round(sigma, 4))) pl.figtext(0.61, 0.68, 'Richness: ' + str(np.round(richness, 2))) pl.figtext(0.61, 0.61, r'$AIC_1$: ' + str(aic1)) pl.figtext(0.61, 0.54, r'$AIC_2$: ' + str(aic2)) pl.figtext(0.61, 0.47, 'Test Photoz: ' + str(photoz)) pl.figtext(0.61, 0.4, 'Ridgeline Photoz: ' + str(round(z, 3))) pl.figtext(0.61, 0.33, 'R200: ' + str(round(0.09 * richness**0.798, 2)) + ' Mpc') pl.figtext( 0.61, 0.25, 'M200: ' + str(round(8.8 * (richness / 19.)**1.7, 2)) + 'x10^13 Solar Mass') pl.title('Total # of galaxies: ' + str(ntot)) return richness, aic1, aic2, crmi, alpha, mu, sigma, z
def ZMYrichness(ra=None, dec=None, photoz=None, cat=None, plot=True, err=True, rw=True, bcg=True): fra = cat.field('ra') fdec = cat.field('dec') imag = cat.field('mag_z') zmy = cat.field('mag_z') - cat.field('mag_y') zmyerr = np.sqrt(cat.field('MAGERR_z')**2 + cat.field('MAGERR_y')**2) depth = 10 h = es.htm.HTM(depth) srad = np.rad2deg(1. / Da(0, photoz)) m1, m2, d12 = h.match(ra, dec, fra, fdec, srad, maxmatch=5000) cimag = imag[m2[0]] czmy = zmy[m2[0]] r12 = np.deg2rad(d12) * Da(0, photoz) if bcg is True: indices = (imag[m2] <= limi(photoz)) * (imag[m2] > cimag) else: indices = (imag[m2] <= limi(photoz)) ntot = len(m2[indices]) if ntot <= 10: return 0, 0, 0 alpha = np.array([0.5, 0.5]) mu = np.array([ sts.scoreatpercentile(zmy[m2[indices]], per=70), sts.scoreatpercentile(zmy[m2[indices]], per=40) ]) sigma = np.array([0.04, 0.3]) if err is True: if rw is False: aic2 = gmm.aic_ecgmm(zmy[m2[indices]], zmyerr[m2[indices]], alpha, mu, sigma) aic1 = gmm.wstat(zmy[m2[indices]], zmyerr[m2[indices]])[3] else: aic2, alpha, mu, sigma = rwgmm.aic2EM(zmy[m2[indices]], zmyerr[m2[indices]], r12[indices], alpha, mu, sigma) aic1 = rwgmm.aic1EM(zmy[m2[indices]], zmyerr[m2[indices]], r12[indices])[0] else: aic2 = gmm.aic_ecgmm(zmy[m2[indices]], aalpha=alpha, mmu=mu, ssigma=sigma) aic1 = gmm.wstat(zmy[m2[indices]])[3] if plot == True: pl.hist(zmy[m2[indices]], bins=30, normed=True, facecolor='green', alpha=0.3) pl.vlines(czmy, 0, 3, color='pink') x = np.arange(-1, 5, 0.01) srt = np.argsort(sigma) alpha = alpha[srt] mu = mu[srt] sigma = sigma[srt] t = gmm.ecgmmplot(x, alpha, mu, sigma) pl.xlabel('i - z') pl.figtext(0.61, 0.85, r'$\alpha$: ' + str(np.round(alpha, 4))) pl.figtext(0.61, 0.8, r'$\mu$: ' + str(np.round(mu, 4))) pl.figtext(0.61, 0.75, r'$\sigma$: ' + str(np.round(sigma, 4))) pl.figtext(0.61, 0.68, r'$Amplitude$: ' + str(np.round(ntot * alpha[0], 2))) pl.figtext(0.61, 0.61, r'$AIC_1$: ' + str(aic1)) pl.figtext(0.61, 0.54, r'$AIC_2$: ' + str(aic2)) pl.figtext(0.61, 0.47, 'Photoz: ' + str(photoz)) pl.title('Total # of galaxies: ' + str(ntot)) return ntot * alpha[0], aic1, aic2
def redsker(b, idx, err=True): depth = 12 h = es.htm.HTM(depth) ra = b.field('ra') dec = b.field('dec') photoz = b.field('z') central = b.field('central') gmr = b.field('omag')[:, 0] - b.field('omag')[:, 1] rmi = b.field('omag')[:, 1] - b.field('omag')[:, 2] imz = b.field('omag')[:, 2] - b.field('omag')[:, 3] gmz = b.field('omag')[:, 0] - b.field('omag')[:, 3] rmz = b.field('omag')[:, 1] - b.field('omag')[:, 3] gmi = b.field('omag')[:, 0] - b.field('omag')[:, 2] num = len(ra) if err: gmrerr = b.field('omagerr')[:, 0] - b.field('omagerr')[:, 1] rmierr = b.field('omagerr')[:, 1] - b.field('omagerr')[:, 2] imzerr = b.field('omagerr')[:, 2] - b.field('omagerr')[:, 3] gmzerr = b.field('omagerr')[:, 0] - b.field('omagerr')[:, 3] rmzerr = b.field('omagerr')[:, 1] - b.field('omagerr')[:, 3] gmierr = b.field('omagerr')[:, 0] - b.field('omagerr')[:, 2] else: gmrerr = np.zeros(num) rmierr = np.zeros(num) imzerr = np.zeros(num) gmzerr = np.zeros(num) rmzerr = np.zeros(num) gmierr = np.zeros(num) iamag = b.field('amag')[:, 2] imag = b.field('omag')[:, 2] srad = np.rad2deg(1. / es.cosmology.Da(0, photoz[idx], h=0.7) / (1 + photoz[idx])) m1, m2, d12 = h.match(ra[idx], dec[idx], ra, dec, srad, maxmatch=5000) indices = (imag[m2] <= limi(photoz[idx])) * (imag[m2] > imag[m1]) #indices=(iamag[m2]<=-20)*(iamag[m2]>iamag[m1]) ntot = len(m2[indices]) alpha = np.array([0.5, 0.5]) mu = np.array([ sts.scoreatpercentile(gmr[m2[indices]], per=80), sts.scoreatpercentile(gmr[m2[indices]], per=30) ]) sigma = np.array([0.04, 0.3]) aic2 = gmm.aic_ecgmm(gmr[m2[indices]], gmrerr[m2[indices]], alpha, mu, sigma) aic1 = gmm.wstat(gmr[m2[indices]], gmrerr[m2[indices]])[3] fig = pl.figure(figsize=(15, 8)) ax = fig.add_subplot(2, 3, 1) pl.hist(gmr[m2[indices]], bins=30, normed=True, histtype='step') x = np.arange(-1, 5, 0.01) t = gmm.ecgmmplot(x, alpha, mu, sigma) pl.xlabel('g - r') pl.title('M200: ' + str(b[idx].field('m200'))) pl.text(0.1, 0.85, r'$\alpha$: ' + str(np.round(alpha, 4)), transform=ax.transAxes) pl.text(0.1, 0.8, r'$\mu$: ' + str(np.round(mu, 4)), transform=ax.transAxes) pl.text(0.1, 0.75, r'$\sigma$: ' + str(np.round(sigma, 4)), transform=ax.transAxes) pl.text(0.1, 0.68, r'$Ngals$: ' + str(np.round(ntot * alpha[0])), transform=ax.transAxes) pl.text(0.1, 0.6, r'$AIC$: ' + str(np.round(aic1)) + ', ' + str(np.round(aic2)), transform=ax.transAxes) alpha = np.array([0.5, 0.5]) mu = np.array([ sts.scoreatpercentile(rmi[m2[indices]], per=80), sts.scoreatpercentile(rmi[m2[indices]], per=30) ]) sigma = np.array([0.04, 0.3]) aic2 = gmm.aic_ecgmm(rmi[m2[indices]], rmierr[m2[indices]], alpha, mu, sigma) aic1 = gmm.wstat(rmi[m2[indices]], rmierr[m2[indices]])[3] ax = fig.add_subplot(2, 3, 2) pl.hist(rmi[m2[indices]], bins=30, normed=True, histtype='step') x = np.arange(-1, 5, 0.01) t = gmm.ecgmmplot(x, alpha, mu, sigma) pl.xlabel('r - i') pl.title('photoz: ' + str(photoz[idx])) pl.xlim(-0.2, 2.5) pl.text(0.1, 0.85, r'$\alpha$: ' + str(np.round(alpha, 4)), transform=ax.transAxes) pl.text(0.1, 0.8, r'$\mu$: ' + str(np.round(mu, 4)), transform=ax.transAxes) pl.text(0.1, 0.75, r'$\sigma$: ' + str(np.round(sigma, 4)), transform=ax.transAxes) pl.text(0.1, 0.68, r'$Ngals$: ' + str(np.round(ntot * alpha[0])), transform=ax.transAxes) pl.text(0.1, 0.6, r'$AIC$: ' + str(np.round(aic1)) + ', ' + str(np.round(aic2)), transform=ax.transAxes) alpha = np.array([0.5, 0.5]) mu = np.array([ sts.scoreatpercentile(imz[m2[indices]], per=60), sts.scoreatpercentile(imz[m2[indices]], per=30) ]) sigma = np.array([0.02, 0.3]) aic2 = gmm.aic_ecgmm(imz[m2[indices]], imzerr[m2[indices]], alpha, mu, sigma) aic1 = gmm.wstat(imz[m2[indices]], imzerr[m2[indices]])[3] ax = fig.add_subplot(2, 3, 3) pl.hist(imz[m2[indices]], bins=30, normed=True, histtype='step') x = np.arange(-1, 5, 0.01) t = gmm.ecgmmplot(x, alpha, mu, sigma) pl.xlabel('i - z') pl.title('Ntot: ' + str(ntot)) pl.xlim(-0.2, 2.5) pl.text(0.1, 0.85, r'$\alpha$: ' + str(np.round(alpha, 4)), transform=ax.transAxes) pl.text(0.1, 0.8, r'$\mu$: ' + str(np.round(mu, 4)), transform=ax.transAxes) pl.text(0.1, 0.75, r'$\sigma$: ' + str(np.round(sigma, 4)), transform=ax.transAxes) pl.text(0.1, 0.68, r'$Ngals$: ' + str(np.round(ntot * alpha[0])), transform=ax.transAxes) pl.text(0.1, 0.6, r'$AIC$: ' + str(np.round(aic1)) + ', ' + str(np.round(aic2)), transform=ax.transAxes) alpha = np.array([0.5, 0.5]) mu = np.array([ sts.scoreatpercentile(gmz[m2[indices]], per=60), sts.scoreatpercentile(gmz[m2[indices]], per=30) ]) sigma = np.array([0.02, 0.3]) aic2 = gmm.aic_ecgmm(gmz[m2[indices]], gmzerr[m2[indices]], alpha, mu, sigma) aic1 = gmm.wstat(gmz[m2[indices]], gmzerr[m2[indices]])[3] ax = fig.add_subplot(2, 3, 4) pl.hist(gmz[m2[indices]], bins=30, normed=True, histtype='step') x = np.arange(-1, 5, 0.01) t = gmm.ecgmmplot(x, alpha, mu, sigma) pl.xlabel('g - z') pl.text(0.1, 0.85, r'$\alpha$: ' + str(np.round(alpha, 4)), transform=ax.transAxes) pl.text(0.1, 0.8, r'$\mu$: ' + str(np.round(mu, 4)), transform=ax.transAxes) pl.text(0.1, 0.75, r'$\sigma$: ' + str(np.round(sigma, 4)), transform=ax.transAxes) pl.text(0.1, 0.68, r'$Ngals$: ' + str(np.round(ntot * alpha[0])), transform=ax.transAxes) pl.text(0.1, 0.6, r'$AIC$: ' + str(np.round(aic1)) + ', ' + str(np.round(aic2)), transform=ax.transAxes) alpha = np.array([0.5, 0.5]) mu = np.array([ sts.scoreatpercentile(rmz[m2[indices]], per=60), sts.scoreatpercentile(rmz[m2[indices]], per=30) ]) sigma = np.array([0.02, 0.3]) aic2 = gmm.aic_ecgmm(rmz[m2[indices]], rmzerr[m2[indices]], alpha, mu, sigma) aic1 = gmm.wstat(rmz[m2[indices]], rmzerr[m2[indices]])[3] ax = fig.add_subplot(2, 3, 5) pl.hist(rmz[m2[indices]], bins=30, normed=True, histtype='step') x = np.arange(-1, 5, 0.01) t = gmm.ecgmmplot(x, alpha, mu, sigma) pl.xlabel('r - z') pl.text(0.1, 0.85, r'$\alpha$: ' + str(np.round(alpha, 4)), transform=ax.transAxes) pl.text(0.1, 0.8, r'$\mu$: ' + str(np.round(mu, 4)), transform=ax.transAxes) pl.text(0.1, 0.75, r'$\sigma$: ' + str(np.round(sigma, 4)), transform=ax.transAxes) pl.text(0.1, 0.68, r'$Ngals$: ' + str(np.round(ntot * alpha[0])), transform=ax.transAxes) pl.text(0.1, 0.6, r'$AIC$: ' + str(np.round(aic1)) + ', ' + str(np.round(aic2)), transform=ax.transAxes) alpha = np.array([0.5, 0.5]) mu = np.array([ sts.scoreatpercentile(gmi[m2[indices]], per=60), sts.scoreatpercentile(gmi[m2[indices]], per=30) ]) sigma = np.array([0.02, 0.3]) aic2 = gmm.aic_ecgmm(gmi[m2[indices]], gmierr[m2[indices]], alpha, mu, sigma) aic1 = gmm.wstat(gmi[m2[indices]], gmierr[m2[indices]])[3] ax = fig.add_subplot(2, 3, 6) pl.hist(gmi[m2[indices]], bins=30, normed=True, histtype='step') x = np.arange(-1, 5, 0.01) t = gmm.ecgmmplot(x, alpha, mu, sigma) pl.xlabel('g - i') pl.text(0.1, 0.85, r'$\alpha$: ' + str(np.round(alpha, 4)), transform=ax.transAxes) pl.text(0.1, 0.8, r'$\mu$: ' + str(np.round(mu, 4)), transform=ax.transAxes) pl.text(0.1, 0.75, r'$\sigma$: ' + str(np.round(sigma, 4)), transform=ax.transAxes) pl.text(0.1, 0.68, r'$Ngals$: ' + str(np.round(ntot * alpha[0])), transform=ax.transAxes) pl.text(0.1, 0.6, r'$AIC$: ' + str(np.round(aic1)) + ', ' + str(np.round(aic2)), transform=ax.transAxes) return ('Plot is done!')
# assign initial guess as two mixtures alpha=np.array([0.5,0.5]) mu=np.array([0.3,0.1]) sigma=np.array([0.05,0.2]) #aic=ec.aic_ecgmm(x,xerr,alpha,mu,sigma) bic=ec.bic_ecgmm(x,xerr,alpha,mu,sigma) #make plots pl.figure(figsize=(12,6)) pl.subplot(1,2,1) y=np.arange(-1,1,0.0001) pl.hist(x,bins=30,alpha=0.3,normed=True,facecolor='green') ec.ecgmmplot(y,alpha,mu,sigma) pl.xlabel='x' pl.text(-0.9,3, r'$\mu=$'+str(mu)) pl.text(-0.9,2.6, r'$\sigma=$'+str(sigma)) pl.ylim(0,7) pl.title("ECGMM") # non-error corrected GMM alpha=np.array([0.5,0.5]) mu=np.array([0.3,0.1]) sigma=np.array([0.05,0.2]) xerr[:]=0
z,alp1m,yerr = bp.bin_scatter(redshift,alp1,binsize=0.05,plot=False) z,mu0m,yerr = bp.bin_scatter(redshift,mu0,binsize=0.05,plot=False) z,mu1m,yerr = bp.bin_scatter(redshift,mu1,binsize=0.05,plot=False) z,sgm0m,yerr = bp.bin_scatter(redshift,sgm0,binsize=0.05,plot=False) z,sgm1m,yerr = bp.bin_scatter(redshift,sgm1,binsize=0.05,plot=False) alpha = np.array(zip(alp0m,alp1m)) mu = np.array(zip(mu0m,mu1m)) sigma = np.array(zip(sgm0m,sgm1m)) x=np.arange(-0.5,2.5,0.01) pl.figure(figsize=(15,15)) nn = len(z) for i in range(nn): pl.subplot(3,3,i+1) gmm.ecgmmplot(x,alpha[i],mu[i],sigma[i]) pl.title('zbin: '+str(round(z[i],3))+' +/- 0.025') pl.xlabel('g - r') if galtype == 'input': pl.ylabel('DC6B input catalog') else: pl.ylabel('DC6B output catalog') if galtype == 'input': pl.savefig(catdir+'dc6b_gmr_distribution_input.png') else: pl.savefig(catdir+'dc6b_gmr_distribution_output.png') pl.close() #------rmi ridgeline distribution ------ redshift = resRI[9]