c1 = co.Planck15 import numpy as np import glob import os import sys import matplotlib.pyplot as plt from scipy.spatial import KDTree import scipy.stats as st from legacyanalysis.pathnames import get_indir,get_outdir,make_dir f = open(os.path.join(get_outdir('dr23'),"out-ELG-decals.txt"),'w') f.write("field 242 \n") cFile1 = os.path.join(get_indir('dr23'),"catalog-EDR-242.2-243.7-8-12.1-DR3.fits") f.write("total primary any mask \n") hdu = fits.open(cFile1) dat = hdu[1].data prim = (dat['brick_primary']) noJunk = (dat['brick_primary']) & (dat['decam_anymask'].T[1]==0) & (dat['decam_anymask'].T[2]==0) & (dat['decam_anymask'].T[4]==0) psf = (noJunk) & (dat['type'] == "PSF") areaC1 = ( numpy.max(dat['ra']) - numpy.min(dat['ra']) ) * ( numpy.max(dat['dec']) - numpy.min(dat['dec']) )*numpy.cos( numpy.pi * numpy.mean(dat['dec']) / 180. ) f.write("DR3 : "+str(len(dat))+" "+str( len(prim.nonzero()[0]))+" "+str( len(noJunk.nonzero()[0]))+" "+str( len(psf.nonzero()[0]))+" "+str( areaC1)+"\n") f.write("DR3 : "+str(numpy.round(len(dat)/areaC1))+" "+str( numpy.round(len(prim.nonzero()[0])/areaC1))+" "+str( numpy.round(len(noJunk.nonzero()[0]) /areaC1) )+" "+str( numpy.round(len(psf.nonzero()[0]) /areaC1) )+"\n") cFile1 =os.path.join(get_indir('dr23'), "catalog-EDR-242.2-243.7-8-12.1-DR2.fits") hdu = fits.open(cFile1) dat = hdu[1].data
import matplotlib matplotlib.use('Agg') #display backend import matplotlib.pyplot as plt import numpy as np import os from scipy.spatial import KDTree import scipy.stats as st from scipy.optimize import curve_fit as cu from astropy.io import fits import astropy.cosmology as co from legacyanalysis.pathnames import get_indir,get_outdir,make_dir indir= get_indir('cosmos') #CREATES THE CATALOG LIST catList = ["catalog-R3-R4.fits", "catalog-R2-R4.fits", "catalog-R2-R3.fits", "catalog-R1-R4.fits", "catalog-R1-R3.fits", "catalog-R1-R2.fits"] for cnt,cat in enumerate(catList): catList[cnt]= os.path.join(indir,cat) # EACH CATALOG NEEDS TO HAVE THE TYPICAL DECALS CATALOG ENTRIES WITH "_1" AND "_2" APPENDED FOR DR2 and DR3 # DEFINES THE GAUSSIAN FUNCTION gfun = lambda x, m0, s0 : st.norm.pdf(x,loc=m0,scale=s0) #OPENS A FILE TO WRITE OUTPUTS f=open(os.path.join(get_outdir('cosmos'),"depth-comparisonp.txt"),"w") f.write("20<g<21.5 \n") # CREATES A FIGURE plt.figure(2,(5,5))
import matplotlib matplotlib.use('Agg') #display backend import matplotlib.pyplot as plt import numpy as np import os from scipy.spatial import KDTree import scipy.stats as st from scipy.optimize import curve_fit as cu from astropy.io import fits import astropy.cosmology as co from legacyanalysis.pathnames import get_indir, get_outdir, make_dir indir = get_indir('cosmos') #CREATES THE CATALOG LIST catList = [ "catalog-R3-R4.fits", "catalog-R2-R4.fits", "catalog-R2-R3.fits", "catalog-R1-R4.fits", "catalog-R1-R3.fits", "catalog-R1-R2.fits" ] for cnt, cat in enumerate(catList): catList[cnt] = os.path.join(indir, cat) # EACH CATALOG NEEDS TO HAVE THE TYPICAL DECALS CATALOG ENTRIES WITH "_1" AND "_2" APPENDED FOR DR2 and DR3 # DEFINES THE GAUSSIAN FUNCTION gfun = lambda x, m0, s0: st.norm.pdf(x, loc=m0, scale=s0) #OPENS A FILE TO WRITE OUTPUTS f = open(os.path.join(get_outdir('cosmos'), "depth-comparisonp.txt"), "w") f.write("20<g<21.5 \n") # CREATES A FIGURE plt.figure(2, (5, 5)) plt.axes([0.17, 0.15, 0.75, 0.75])