This is the User Notebook to run validation tests at NERSC You only need to input your localdir (at NERSC) to save outputs.
Each cell should have one test
To run a test you need to input
Output: path to png image to plot
In [1]:
from desi_image_validation4 import *
from IPython.display import Image
from astropy.io import fits
import scipy.signal
import matplotlib.pyplot as plt
#%matplotlib inline
In [2]:
#help(scipy.signal);
In [2]:
localdir = '/global/homes/m/manera/DESI/validation-outputs/'
In [ ]:
In [3]:
verbose=False
sample=mysample('DECaLS','DR8','g',localdir,verbose)
# TEST Information
print( '----- check values sample ----' )
print( 'band = ', sample.band )
print( 'localdir = ', sample.localdir )
print( 'survey = ', sample.survey )
print( 'DR = ', sample.DR )
print( 'path ccd = ',sample.ccds )
print( '----------' )
print( 'zp0 = ', sample.zp0 )
print( 'extinction coef = ', sample.extc )
print( 'extinction raw = ', sample.be )
print( 'magnitude limit = ', sample.recm )
print( 'photoz req = ', sample.phreq )
print( 'catalogue = ', sample.catalog )
print( 'verbose = ', sample.verbose )
print( 'fraction of exposures = ', sample.FracExp )
print( '------------------------' )
print( ' ' )
In [5]:
verbose=False
sample=mysample('BASS','DR8','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1,Nexpmax=500)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=False
sample=mysample('MZLS','DR8','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1,Nexpmax=500)
fig = Image(filename=(fname))
fig
Out[6]:
In [4]:
verbose=False
sample=mysample('BASS','DR8','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=False
sample=mysample('BASS','DR8','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=False
sample=mysample('MZLS','DR8','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[6]:
In [7]:
verbose=False
sample=mysample('DECaLS','DR8','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1,Nexpmax=500)
fig = Image(filename=(fname))
fig
Out[7]:
In [8]:
verbose=False
sample=mysample('DECaLS','DR8','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1,Nexpmax=500)
fig = Image(filename=(fname))
fig
Out[8]:
In [4]:
verbose=False
sample=mysample('DECaLS','DR8','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1,Nexpmax=500)
fig = Image(filename=(fname))
fig
Out[4]:
In [8]:
verbose=False
sample=mysample('DECaLS','DR8','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[8]:
In [9]:
verbose=False
sample=mysample('DECaLS','DR8','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[9]:
In [5]:
verbose=False
sample=mysample('BASS','DR6','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[5]:
In [4]:
verbose=False
sample=mysample('DECaLS','DR8','z',localdir,verbose)
fname1,fname2=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=3,Nexpmax=500,depthmin=22.5)
fig = Image(filename=(fname1))
fig
fig = Image(filename=(fname2))
fig
Out[4]:
In [5]:
fig = Image(filename=(fname1))
fig
Out[5]:
In [6]:
verbose=False
sample=mysample('DECaLS','DR8','z',localdir,verbose)
fname1,fname2=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=1,Nexpmax=500,depthmin=22.5)
fig = Image(filename=(fname1))
fig
fig = Image(filename=(fname2))
fig
Out[6]:
In [7]:
fig = Image(filename=(fname1))
fig
Out[7]:
In [4]:
verbose=False
sample=mysample('MZLS','DR8','z',localdir,verbose)
fname1,fname2=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=1,Nexpmax=500,depthmin=22.5)
fig = Image(filename=(fname1))
fig
fig = Image(filename=(fname2))
fig
Out[4]:
In [5]:
fig = Image(filename=(fname1))
fig
Out[5]:
In [6]:
verbose=False
sample=mysample('MZLS','DR8','z',localdir,verbose)
fname1,fname2=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=3,Nexpmax=500,depthmin=22.5)
fig = Image(filename=(fname1))
fig
fig = Image(filename=(fname2))
fig
Out[6]:
In [3]:
verbose=False
sample = mysample('MZLS','DR8','z',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[3]:
In [6]:
verbose=False
sample = mysample('MZLS','DR8','z',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[6]:
In [5]:
verbose=False
sample = mysample('DECaLS','DR8','z',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[5]:
In [5]:
verbose=False
sample = mysample('DECaLS','DR8','g',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[5]:
In [7]:
verbose=False
sample = mysample('BASS','DR8','g',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[7]:
In [4]:
verbose=False
sample = mysample('DECaLS','DR8','r',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[4]:
In [8]:
verbose=False
sample = mysample('BASS','DR8','r',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[8]:
In [ ]:
verbose=True
sample= mysample('BASS','DR8','g',localdir,verbose)
fname1, fname2 = val3p4c_seeing(sample)
print 'For pass >=3'
fig = Image(filename=(fname1))
fig
In [4]:
verbose=False
sample = mysample('MZLS','DR8','z',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=False
sample = mysample('DECaLS','DR8','z',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=False
sample = mysample('BASS','DR8','r',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[6]:
In [7]:
verbose=False
sample = mysample('DECaLS','DR8','r',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[7]:
In [8]:
verbose=False
sample = mysample('BASS','DR8','g',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[8]:
In [ ]:
verbose=False
sample = mysample('DECaLS','DR8','g',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
In [4]:
verbose=False
sample=mysample('DECaLS','DR8b','z',localdir,verbose)
fname0,fname1,fname2=maps_fwhm(sample,minfwhm=1.3,Nexpmin=3,Nexpmax=500)
print(fname0,fname1,fname2)
In [3]:
verbose=False
sample=mysample('DECaLS','DR8b','z',localdir,verbose)
fname1,fname2=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=3,Nexpmax=500)
fig = Image(filename=(fname1))
fig
fig = Image(filename=(fname2))
fig
Out[3]:
In [5]:
fig = Image(filename=(fname1))
fig
Out[5]:
In [4]:
verbose=False
sample=mysample('DECaLS','DR8b','z',localdir,verbose)
fname1,fname2=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=3,Nexpmax=500)
fig = Image(filename=(fname1))
fig
fig = Image(filename=(fname2))
fig
Out[4]:
In [5]:
fig = Image(filename=(fname1))
fig
Out[5]:
In [5]:
verbose=False
sample=mysample('DECaLS','DR8b','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
from quicksipManera3 import *
import fitsio
In [7]:
nside = 512 # Resolution of output maps
nsideSTR='512' # same as nside but in string format
nsidesout = None # if you want full sky degraded maps to be written
ratiores = 1 # Superresolution/oversampling ratio, simp mode doesn't allow anything other than 1
mode = 1 # 1: fully sequential, 2: parallel then sequential, 3: fully parallel
pixoffset = 0 # How many pixels are being removed on the edge of each CCD? 15 for DES.
oversamp='1' # ratiores in string format
In [10]:
nside = 1024 # Resolution of output maps
nsideSTR='1024' # same as nside but in string format
nsidesout = None # if you want full sky degraded maps to be written
ratiores = 1 # Superresolution/oversampling ratio, simp mode doesn't allow anything other than 1
mode = 1 # 1: fully sequential, 2: parallel then sequential, 3: fully parallel
pixoffset = 0 # How many pixels are being removed on the edge of each CCD? 15 for DES.
oversamp='1' # ratiores in string format
band = sample.band
catalogue_name = sample.catalog
fname = sample.ccds
localdir = sample.localdir
extc = sample.extc
In [12]:
#Read ccd file
tbdata = pyfits.open(fname)[1].data
# ------------------------------------------------------
# Obtain indices
auxstr='band_'+band
sample_names = [auxstr]
if(sample.DR == 'DR7'):
if(sample.survey == 'DECaLS'):
inds = np.where((tbdata['filter'] == band))
elif(sample.survey == 'DEShyb'):
inds = np.where((tbdata['filter'] == band) & (list(map(InDEShybFootprint,tbdata['ra'],tbdata['dec']))))
elif(sample.survey == 'NGCproxy'):
inds = np.where((tbdata['filter'] == band) & (list(map(InNGCproxyFootprint,tbdata['ra']))))
elif(sample.DR == 'DR8b'):
if(sample.survey == 'DECaLS'):
inds = np.where((tbdata['filter'] == band))
elif(sample.survey == 'DEShyb'):
inds = np.where((tbdata['filter'] == band) & (list(map(InDEShybFootprint,tbdata['ra'],tbdata['dec']))))
elif(sample.survey == 'NGCproxy'):
inds = np.where((tbdata['filter'] == band) & (list(map(InNGCproxyFootprint,tbdata['ra']))))
In [14]:
#Read data
#obtain invnoisesq here, including extinction
nmag = Magtonanomaggies(tbdata['galdepth']-extc*tbdata['EBV'])/5.
ivar= 1./nmag**2.
hits=np.ones(np.shape(ivar))
# What properties do you want mapped?
# Each each tuple has [(quantity to be projected, weighting scheme, operation),(etc..)]
propertiesandoperations = [ ('ivar', '', 'total'), ('hits','','total') ]
# What properties to keep when reading the images?
# Should at least contain propertiesandoperations and the image corners.
# MARCM - actually no need for ra dec image corners.
# Only needs ra0 ra1 ra2 ra3 dec0 dec1 dec2 dec3 only if fast track appropriate quicksip subroutines were implemented
#propertiesToKeep = [ 'filter', 'FWHM','mjd_obs'] \
# + ['RA', 'DEC', 'crval1', 'crval2', 'crpix1', 'crpix2', 'cd1_1', 'cd1_2', 'cd2_1', 'cd2_2','width','height']
propertiesToKeep = [ 'filter', 'FWHM','mjd_obs'] \
+ ['RA', 'DEC', 'ra0','ra1','ra2','ra3','dec0','dec1','dec2','dec3']
# Create big table with all relevant properties.
tbdata = np.core.records.fromarrays([tbdata[prop] for prop in propertiesToKeep] + [ivar] + [hits], names = propertiesToKeep + [ 'ivar', 'hits'])
# Read the table, create Healtree, project it into healpix maps, and write these maps.
# Done with Quicksip library, note it has quite a few hardcoded values (use new version by MARCM for BASS and MzLS)
# project_and_write_maps_simp(mode, propertiesandoperations, tbdata, catalogue_name, outroot, sample_names, inds, nside)
#project_and_write_maps(mode, propertiesandoperations, tbdata, catalogue_name, localdir, sample_names, inds, nside, ratiores, pixoffset, nsidesout)
project_and_write_maps_simp(mode, propertiesandoperations, tbdata, catalogue_name, localdir, sample_names, inds, nside)
# Read Haelpix maps from quicksip
prop='ivar'
op='total'
vmin=21.0
vmax=24.0
fname2=localdir+catalogue_name+'/nside'+nsideSTR+'_oversamp'+oversamp+'/'+\
catalogue_name+'_band_'+band+'_nside'+nsideSTR+'_oversamp'+oversamp+'_'+prop+'__'+op+'.fits.gz'
f = fitsio.read(fname2)
In [16]:
print(fname2)
In [ ]:
# HEALPIX DEPTH MAPS
# convert ivar to depth
import healpy as hp
from healpix3 import pix2ang_ring,thphi2radec
ral = []
decl = []
val = f['SIGNAL']
pix = f['PIXEL']
#get hits
prop = 'hits'
op = 'total'
fname2=localdir+catalogue_name+'/nside'+nsideSTR+'_oversamp'+oversamp+'/'+\
catalogue_name+'_band_'+band+'_nside'+nsideSTR+'_oversamp'+oversamp+'_'+prop+'__'+op+'.fits.gz'
f = fitsio.read(fname2)
hitsb=f['SIGNAL']
# Obtain values to plot
#if (prop == 'ivar'):
myval = []
mylabel='depth'
below=0
for i in range(0,len(val)):
depth=nanomaggiesToMag(sqrt(1./val[i]) * 5.)
npases=hitsb[i]
if(npases >= Nexpmin and npases <= Nexpmax ):
myval.append(depth)
th,phi = hp.pix2ang(int(nside),pix[i])
ra,dec = thphi2radec(th,phi)
ral.append(ra)
decl.append(dec)
if(depth < vmin):
below=below+1
npix=len(myval)
print('Area is ', npix/(float(nside)**2.*12)*360*360./pi, ' sq. deg.')
print(below, 'of ', npix, ' pixels are not plotted as their ', mylabel,' < ', vmin)
print('Within the plot, min ', mylabel, '= ', min(myval), ' and max ', mylabel, ' = ', max(myval))
In [ ]:
# Plot depth
#from matplotlib import pyplot as plt
#import matplotlib.cm as cm
#ralB = [ ra-360 if ra > 300 else ra for ra in ral ]
#vmax = sample.recm
#vmin = vmax - 2.0
#mapa = plt.scatter(ralB,decl,c=myval, cmap=cm.rainbow,s=2., vmin=vmin, vmax=vmax, lw=0,edgecolors='none')
#mapa = plt.scatter(ralB,decl,c=myval, cmap=cm.gnuplot,s=2., vmin=vmin, vmax=vmax, lw=0,edgecolors='none')
#mapa.cmap.set_over('yellowgreen')
#cbar = plt.colorbar(mapa,extend='both')
#plt.xlabel('r.a. (degrees)')
#plt.ylabel('declination (degrees)')
#plt.title('Map of '+ mylabel +' for '+catalogue_name+' '+band+'-band \n with 3 or more exposures')
#plt.xlim(-60,300)
#plt.ylim(-30,90)
#mapfile=localdir+mylabel+'_'+band+'_'+catalogue_name+str(nside)+'.png'
#print 'saving plot to ', mapfile
#plt.savefig(mapfile)
#plt.close()
#plt.show()
#cbar.set_label(r'5$\sigma$ galaxy depth', rotation=270,labelpad=1)
#plt.xscale('log')
mapfile=localdir+mylabel+'_'+band+'_'+catalogue_name+str(nside)+'.png'
mytitle='Map of '+ mylabel +' for '+catalogue_name+' '+band+'-band \n with '+str(Nexpmin)+\
' or more exposures'
plot_magdepth2D(sample,ral,decl,myval,mapfile,mytitle)
# Statistics depths
deptharr=np.array(myval)
p90=np.percentile(deptharr,10)
p95=np.percentile(deptharr,5)
p98=np.percentile(deptharr,2)
med=np.percentile(deptharr,50)
mean = sum(deptharr)/float(np.size(deptharr)) # 1M array, too long for precision
std = sqrt(sum(deptharr**2.)/float(len(deptharr))-mean**2.)
ndrawn=np.size(deptharr)
print("Total pixels", np.size(deptharr), "probably too many for exact mean and std")
print("Mean = ", mean, "; Median = ", med ,"; Std = ", std)
print("Results for 90% 95% and 98% are: ", p90, p95, p98)
# Statistics pases
#prop = 'hits'
#op = 'total'
#fname2=localdir+catalogue_name+'/nside'+nsideSTR+'_oversamp'+oversamp+'/'+\
#catalogue_name+'_band_'+band+'_nside'+nsideSTR+'_oversamp'+oversamp+'_'+prop+'__'+op+'.fits.gz'
#f = fitsio.read(fname2)
#hitsb=f['SIGNAL']
hist, bin_edges =np.histogram(hitsb,bins=[-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5, 11.5,12.5, 13.5, 14.5, 15.5, 16.15,17.5,18.5,19.5,20.5,21.5,22.5,23.5,24.5,25.5,100],density=True)
#print hitsb[1000:10015]
#hist, bin_edges =np.histogram(hitsb,density=True)
print("Percentage of hits for 0,1,2., to >7 pases\n", end=' ')
#print bin_edges
print(hist)
#print 100*hist
return mapfile
In [6]:
import numpy
def smooth(x,window_len=11,window='hanning'):
"""smooth the data using a window with requested size.
This method is based on the convolution of a scaled window with the signal.
The signal is prepared by introducing reflected copies of the signal
(with the window size) in both ends so that transient parts are minimized
in the begining and end part of the output signal.
input:
x: the input signal
window_len: the dimension of the smoothing window; should be an odd integer
window: the type of window from 'flat', 'hanning', 'hamming', 'bartlett', 'blackman'
flat window will produce a moving average smoothing.
output:
the smoothed signal
example:
t=linspace(-2,2,0.1)
x=sin(t)+randn(len(t))*0.1
y=smooth(x)
see also:
numpy.hanning, numpy.hamming, numpy.bartlett, numpy.blackman, numpy.convolve
scipy.signal.lfilter
TODO: the window parameter could be the window itself if an array instead of a string
NOTE: length(output) != length(input), to correct this: return y[(window_len/2-1):-(window_len/2)] instead of just y.
"""
if x.ndim != 1:
raise ValueError, "smooth only accepts 1 dimension arrays."
if x.size < window_len:
raise ValueError, "Input vector needs to be bigger than window size."
if window_len<3:
return x
if not window in ['flat', 'hanning', 'hamming', 'bartlett', 'blackman']:
raise ValueError, "Window is on of 'flat', 'hanning', 'hamming', 'bartlett', 'blackman'"
s=numpy.r_[x[window_len-1:0:-1],x,x[-2:-window_len-1:-1]]
#print(len(s))
if window == 'flat': #moving average
w=numpy.ones(window_len,'d')
else:
w=eval('numpy.'+window+'(window_len)')
y=numpy.convolve(w/w.sum(),s,mode='valid')
return y
from numpy import *
from pylab import *
def smooth_demo():
t=linspace(-4,4,100)
x=sin(t)
xn=x+randn(len(t))*0.1
y=smooth(x)
ws=31
subplot(211)
plot(ones(ws))
windows=['flat', 'hanning', 'hamming', 'bartlett', 'blackman']
hold(True)
for w in windows[1:]:
eval('plot('+w+'(ws) )')
axis([0,30,0,1.1])
legend(windows)
title("The smoothing windows")
subplot(212)
plot(x)
plot(xn)
for w in windows:
plot(smooth(xn,10,w))
l=['original signal', 'signal with noise']
l.extend(windows)
legend(l)
title("Smoothing a noisy signal")
show()
if __name__=='__main__':
smooth_demo()
In [9]:
verbose=False
sample=mysample('BASS','DR6','g',localdir,verbose)
print sample.ccds
hdul=fits.open(sample.ccds)
myheader=hdul[1].header
mydata=hdul[1].data
hdul.close()
galdepth=mydata['galdepth']
mjdobs=mydata['mjd_obs']
mjddepth=galdepth[mjdobs.argsort()] # depth sorted by modified julian date
depthsmooth=smooth(mjddepth,window_len=401,window='flat') #remove window in output y[200,-200]
plt.scatter(mjdobs,depthsmooth[200:-200],s=0.05,c='green')
plt.xlabel("MJD observed")
plt.ylabel("Average depth")
plt.title("g-band hanning mean depth \n (400 exposures window)")
plt.show()
In [10]:
verbose=False
sample=mysample('BASS','DR6','r',localdir,verbose)
print sample.ccds
hdul=fits.open(sample.ccds)
myheader=hdul[1].header
mydata=hdul[1].data
hdul.close()
galdepth=mydata['galdepth']
mjdobs=mydata['mjd_obs']
mjddepth=galdepth[mjdobs.argsort()] # depth sorted by modified julian date
depthsmooth=smooth(mjddepth,window_len=401,window='flat') #remove window in output y[200,-200]
plt.scatter(mjdobs,depthsmooth[200:-200],s=0.05,c='red')
plt.xlabel("MJD observed")
plt.ylabel("Average depth")
plt.title("r-band hanning mean depth \n (400 exposures window)")
plt.show()
In [11]:
verbose=False
sample=mysample('MZLS','DR6','z',localdir,verbose)
print sample.ccds
hdul=fits.open(sample.ccds)
myheader=hdul[1].header
mydata=hdul[1].data
hdul.close()
galdepth=mydata['galdepth']
mjdobs=mydata['mjd_obs']
mjddepth=galdepth[mjdobs.argsort()] # depth sorted by modified julian date
depthsmooth=smooth(mjddepth,window_len=401,window='flat') #remove window in output y[200,-200]
plt.scatter(mjdobs,depthsmooth[200:-200],s=0.05,c='blue')
plt.xlabel("MJD observed")
plt.ylabel("Average depth")
plt.title("z-band hanning mean depth \n (400 exposures window)")
plt.show()
In [19]:
verbose=False
sample=mysample('BASS','DR6','g',localdir,verbose)
print sample.ccds
hdul=fits.open(sample.ccds)
myheader=hdul[1].header
mydata=hdul[1].data
hdul.close()
galdepth=mydata['galdepth']
mjdobs=mydata['mjd_obs']
mjddepth=galdepth[mjdobs.argsort()] # depth sorted by modified julian date
depthsmooth=smooth(mjddepth,window_len=2001,window='hanning') #remove window in output y[200,-200]
plt.scatter(mjdobs,depthsmooth[1000:-1000],s=0.05,c='green')
plt.xlabel("MJD observed")
plt.ylabel("Average depth")
plt.title("g-band hanning mean depth \n (2000 exposures window)")
plt.show()
In [20]:
verbose=False
sample=mysample('BASS','DR6','r',localdir,verbose)
print sample.ccds
hdul=fits.open(sample.ccds)
myheader=hdul[1].header
mydata=hdul[1].data
hdul.close()
galdepth=mydata['galdepth']
mjdobs=mydata['mjd_obs']
mjddepth=galdepth[mjdobs.argsort()] # depth sorted by modified julian date
depthsmooth=smooth(mjddepth,window_len=2001,window='hanning') #remove window in output y[200,-200]
plt.scatter(mjdobs,depthsmooth[1000:-1000],s=0.05,c='red')
plt.xlabel("MJD observed")
plt.ylabel("Average depth")
plt.title("r-band hanning mean depth \n (2000 exposures window)")
plt.show()
In [21]:
verbose=False
sample=mysample('MZLS','DR6','z',localdir,verbose)
print sample.ccds
hdul=fits.open(sample.ccds)
myheader=hdul[1].header
mydata=hdul[1].data
hdul.close()
galdepth=mydata['galdepth']
mjdobs=mydata['mjd_obs']
mjddepth=galdepth[mjdobs.argsort()] # depth sorted by modified julian date
depthsmooth=smooth(mjddepth,window_len=2001,window='hanning') #remove window in output y[200,-200]
plt.scatter(mjdobs,depthsmooth[1000:-1000],s=0.05,c='blue')
plt.xlabel("MJD observed")
plt.ylabel("Average depth")
plt.title("z-band hanning mean depth \n (2000 exposures window)")
plt.show()
In [3]:
verbose=False
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname1,fname2=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=3,Nexpmax=500)
fig = Image(filename=(fname1))
fig
fig = Image(filename=(fname2))
fig
Out[3]:
In [6]:
fig = Image(filename=(fname1))
fig
Out[6]:
In [7]:
verbose=False
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname1,fname2=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=3,Nexpmax=500,depthmin=22.5)
fig = Image(filename=(fname1))
fig
fig = Image(filename=(fname2))
fig
Out[7]:
In [9]:
fig = Image(filename=(fname1))
fig
Out[9]:
In [3]:
verbose=False
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname1,fname2=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=3,Nexpmax=500,depthmin=22.5)
fig = Image(filename=(fname1))
fig
fig = Image(filename=(fname2))
fig
Out[3]:
In [4]:
fig = Image(filename=(fname1))
fig
Out[4]:
In [3]:
verbose=False
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=1,Nexpmax=500)
fig = Image(filename=(fname))
fig
Out[3]:
In [ ]:
verbose=False
sample=mysample('DECaLS','DR7','r',localdir,verbose)
fname=val4p1_bandquality(sample,minfwhm=1.3,Nexpmin=1,Nexpmax=500)
fig = Image(filename=(fname))
fig
In [4]:
verbose=False
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=False
sample=mysample('DECaLS','DR7','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=False
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
Out[6]:
In [7]:
verbose=False
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[7]:
In [3]:
verbose=False
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[3]:
In [3]:
verbose=False
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[3]:
In [4]:
verbose=False
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[4]:
In [7]:
verbose=False
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[7]:
In [4]:
verbose=False
sample=mysample('DECaLS','DR7','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[4]:
In [18]:
verbose=False
sample=mysample('DECaLS','DR7','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[18]:
In [4]:
verbose=False
sample=mysample('DECaLS','DR7','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[4]:
In [8]:
verbose=False
sample=mysample('DECaLS','DR7','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[8]:
In [10]:
verbose=False
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[10]:
In [3]:
verbose=False
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[3]:
In [ ]:
verbose=False
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
In [9]:
verbose=False
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[9]:
In [9]:
verbose=False
sample=mysample('BASS','DR6','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[9]:
In [ ]:
verbose=False
sample=mysample('BASS','DR6','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3,Nexpmax=3)
fig = Image(filename=(fname))
fig
In [11]:
verbose=False
sample=mysample('BASS','DR6','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[11]:
In [10]:
verbose=False
sample=mysample('MZLS','DR6','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[10]:
In [12]:
verbose=False
sample=mysample('BASS','DR6','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[12]:
In [13]:
verbose=False
sample=mysample('BASS','DR6','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[13]:
In [7]:
verbose=False
sample=mysample('MZLS','DR6','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
#projection in some pointings to healpix pixels is not correct
#This is only for 8 pointins and close to dec=0, usually excluded.
#Edit careful line in quickipManera.py to check the effect
#The efect is actually a covering band around dec=0, whicn need not be there
#Keep the results without these 8 pointings is a very good approximation for what we want
Out[7]:
In [4]:
verbose=False
sample=mysample('DECaLS','DR5','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=False
sample=mysample('DECaLS','DR5','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=False
sample=mysample('DECaLS','DR5','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[6]:
In [5]:
verbose=False
sample=mysample('DECaLS','DR5','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[5]:
In [4]:
verbose=False
sample=mysample('DECaLS','DR5','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[4]:
In [3]:
verbose=False
sample=mysample('DECaLS','DR5','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[3]:
In [ ]:
verbose=False
sample=mysample('DEShyb','DR5','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[ ]:
In [3]:
verbose=False
sample=mysample('NGCproxy','DR5','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[3]:
In [4]:
verbose=False
sample=mysample('DEShyb','DR5','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=False
sample=mysample('NGCproxy','DR5','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=False
sample=mysample('DEShyb','DR5','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[6]:
In [7]:
verbose=False
sample=mysample('NGCproxy','DR5','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[7]:
In [6]:
verbose=False
sample=mysample('NGCproxy','DR5','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[6]:
In [7]:
verbose=False
sample=mysample('DEShyb','DR5','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[7]:
In [8]:
verbose=False
sample=mysample('NGCproxy','DR5','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[8]:
In [4]:
verbose=False
sample=mysample('BASS','DR4','g',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=False
sample=mysample('BASS','DR4','r',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=False
sample=mysample('MZLS','DR4','z',localdir,verbose)
fname=val3p4c_depthfromIvar(sample)
fig = Image(filename=(fname))
fig
Out[6]:
In [5]:
sample=mysample('DECaLS','DR7','g',localdir,verbose)
type(sample.FracExp)
Out[5]:
In [4]:
#g-band DR7
fraclist= [ 0. , 0.09804808, 0.14823496, 0.20733294, 0.19860563, 0.10990054, 0.05556302, 0.03251795, 0.024456, 0.01998162, 0.01592223, 0.01199664, 0.00886791, 0.00695788, 0.00545213, 0.00446497, 0.0054284, 0.002256, 0.00273548, 0.0024744, 0.00217923, 0.00188048, 0.00204512, 0.00199771, 0.00196978, 0.00163986, 0.00037854]
In [16]:
print(np.sum(fraclist))
xfill=1.0 - np.sum(fraclist)
fraclist2 = fraclist[1:]
fraclist2[-1]=fraclist2[-1]+xfill
print(np.sum(fraclist2))
In [17]:
verbose=True
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=1,enterFrac=True,fraclist=fraclist2)
fig = Image(filename=(fname))
fig
Out[17]:
In [4]:
sample=mysample('DECaLS','DR7','r',localdir,verbose)
type(sample.FracExp)
Out[4]:
In [5]:
#r-band DR7
fraclist=[ 0.0, 0.08958166, 0.13417267, 0.19177232, 0.18441287, 0.10976927, 0.06232078, 0.04236075, 0.03582649, 0.02672343, 0.01945749, 0.01441745, 0.01276206, 0.00858993, 0.00672286, 0.00579604, 0.01480615, 0.00318169, 0.00410542, 0.00382578, 0.00320883, 0.00252454, 0.00208529, 0.00176575, 0.00189917, 0.00143467, 0.00027577]
In [6]:
print(np.sum(fraclist))
xfill=1.0 - np.sum(fraclist)
fraclist2 = fraclist[1:]
fraclist2[-1]=fraclist2[-1]+xfill
print(np.sum(fraclist2))
In [7]:
verbose=True
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=1,enterFrac=True,fraclist=fraclist2)
fig = Image(filename=(fname))
fig
Out[7]:
In [8]:
sample=mysample('DECaLS','DR7','z',localdir,verbose)
type(sample.FracExp)
Out[8]:
In [10]:
#z-band DR7
fraclist = [0.00000000e+00, 7.29212255e-02, 1.00575196e-01, 1.69661279e-01, 1.94909380e-01, 1.36119781e-01, 9.56678722e-02, 7.10858634e-02, 5.18518340e-02, 3.30638704e-02, 2.07393509e-02, 1.26088713e-02, 7.76346734e-03, 4.89770547e-03, 3.55590129e-03, 2.94601763e-03, 3.86966409e-03, 1.53252989e-03, 1.74969581e-03, 1.41664943e-03, 1.22427608e-03, 1.01116246e-03, 9.71184876e-04, 9.27600287e-04, 7.95644186e-04, 7.87227852e-04, 1.09593908e-04]
In [11]:
print(np.sum(fraclist))
xfill=1.0 - np.sum(fraclist)
fraclist2 = fraclist[1:]
fraclist2[-1]=fraclist2[-1]+xfill
print(np.sum(fraclist2))
In [13]:
verbose=True
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=1,enterFrac=True,fraclist=fraclist2)
fig = Image(filename=(fname))
fig
Out[13]:
In [4]:
verbose=True
sample=mysample('DECaLS','DR7','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=True
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=True
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=1)
fig = Image(filename=(fname))
fig
Out[6]:
In [7]:
verbose=True
sample=mysample('DECaLS','DR7','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[7]:
In [8]:
verbose=True
sample=mysample('DECaLS','DR7','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[8]:
In [9]:
verbose=True
sample=mysample('DECaLS','DR7','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[9]:
In [3]:
verbose=True
sample=mysample('BASS','DR6','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[3]:
In [4]:
verbose=True
sample=mysample('BASS','DR6','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=True
sample=mysample('MZLS','DR6','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=True
sample=mysample('BASS','DR6','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[6]:
In [7]:
verbose=True
sample=mysample('BASS','DR6','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[7]:
In [8]:
verbose=True
sample=mysample('MZLS','DR6','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[8]:
In [6]:
verbose=True
sample=mysample('DECaLS','DR5','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[6]:
In [7]:
verbose=True
sample=mysample('DECaLS','DR5','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[7]:
In [8]:
verbose=True
sample=mysample('DECaLS','DR5','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample,Nexpmin=3)
fig = Image(filename=(fname))
fig
Out[8]:
In [13]:
verbose=True
sample=mysample('DECaLS','DR5','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[13]:
In [11]:
verbose=True
sample=mysample('DECaLS','DR5','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[11]:
In [12]:
verbose=True
sample=mysample('DECaLS','DR5','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[12]:
In [5]:
verbose=True
sample=mysample('DEShyb','DR5','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[5]:
In [6]:
verbose=True
sample=mysample('NGCproxy','DR5','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[6]:
In [7]:
verbose=True
sample=mysample('DECaLS','DR5','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[7]:
In [8]:
verbose=True
sample=mysample('DEShyb','DR5','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[8]:
In [9]:
verbose=True
sample=mysample('NGCproxy','DR5','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[9]:
In [11]:
verbose=True
sample=mysample('DECaLS','DR5','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[11]:
In [12]:
verbose=True
sample=mysample('DEShyb','DR5','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[12]:
In [13]:
verbose=True
sample=mysample('NGCproxy','DR5','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[13]:
In [14]:
verbose=True
sample=mysample('DECaLS','DR5','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[14]:
In [3]:
verbose=True
sample=mysample('BASS','DR4','g',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[3]:
In [4]:
verbose=True
sample=mysample('BASS','DR4','r',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=True
sample=mysample('MZLS','DR4','z',localdir,verbose)
fname=val3p4b_maghist_pred(sample)
fig = Image(filename=(fname))
fig
Out[5]:
z-band image quality will be smaller than 1.3 arcsec FWHM in at least one pass.
val3p4c_seeing - runs everything
val3p4c_seeingplots - runs the plots only if the previous have been run
In [3]:
verbose=True
sample= mysample('BASS','DR4','g',localdir,verbose)
#fname1,fname2 = val3p4c_seeing(sample)
fname1, fname2 = val3p4c_seeing(sample)
print 'For pass >=3'
fig = Image(filename=(fname1))
fig
Out[3]:
In [4]:
fig = Image(filename=(fname2))
fig
Out[4]:
In [7]:
verbose=False
sample = mysample('BASS','DR4','g',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[7]:
In [6]:
verbose=False
sample = mysample('BASS','DR4','r',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[6]:
In [3]:
verbose=False
sample = mysample('MZLS','DR4','z',localdir,verbose)
fname = v5p1e_photometricReqPlot(sample)
fig = Image(filename=(fname))
fig
Out[3]:
In [4]:
verbose=False
sample1 = mysample('DECaLS','DR3','g',localdir,verbose)
sample2 = mysample('BASS','DR4','g',localdir,verbose)
fname = v3p5_Areas(sample1,sample2)
fig = Image(filename=(fname))
fig
Out[4]:
In [5]:
verbose=False
sample1 = mysample('DECaLS','DR3','r',localdir,verbose)
sample2 = mysample('BASS','DR4','r',localdir,verbose)
fname = v3p5_Areas(sample1,sample2)
fig = Image(filename=(fname))
fig
Out[5]:
In [3]:
verbose=False
sample1 = mysample('DECaLS','DR3','z',localdir,verbose)
sample2 = mysample('MZLS','DR4','z',localdir,verbose)
fname = v3p5_Areas(sample1,sample2)
fig = Image(filename=(fname))
fig
Out[3]:
In [1]:
import numpy as np
import healpy as hp
import astropy.io.fits as pyfits
from multiprocessing import Pool
import matplotlib as mpl
## mpl.use('Agg')
import matplotlib.pyplot as plt
from quicksipManera import *
In [2]:
inputdir='/project/projectdirs/cosmo/data/legacysurvey/dr3/'
localdir = '/global/homes/m/manera/DESI/validation-outputs/'
fname = inputdir+'ccds-annotated-decals.fits.gz'
In [ ]:
# Obtain Header and DATA
tbdataDR3 = pyfits.open(fname)[1].data
headerDR3=pyfits.open(fname)[1].header
print len(tbdataDR3)
headerDR3
In [3]:
# Compare extinction values
gdepth=tbdataDR3['galdepth'][indsDR3]
ebv=tbdataDR3['EBV'][indsDR3]
exti=tbdataDR3['decam_extinction'][indsDR3][:,1]
print ebv
print exti #compare exti with ebv*3.303
In [ ]:
# Select particular indices
indsDR4 = np.where((tbdataDR3['filter'] == 'g') & (tbdataDR3['photometric'] == True) & (tbdataDR3['blacklist_ok'] == True))
print np.size(indsDR3)
In [ ]:
# Inspect one item
ic=69720
print tbdataDR3['galdepth'][ic]
print tbdataDR3['height'][ic]
print tbdataDR3['CRPIX1'][ic]
print tbdataDR3['CD1_2'][ic]
print tbdataDR3['CRVAL1'][ic], tbdataDR3['CRVAL2'][ic]
print tbdataDR3['RA0'][ic], tbdataDR3['RA1'][ic],tbdataDR3['RA2'][ic], tbdataDR3['RA3'][ic]
print tbdataDR3['DEC0'][ic], tbdataDR3['DEC1'][ic],tbdataDR3['DEC2'][ic], tbdataDR3['DEC3'][ic]
print tbdataDR3['RA'][ic], tbdataDR3['DEC'][ic]
print tbdataDR3['decam_extinction'][ic]
In [12]:
def nanomaggiesToMag(nm):
return -2.5 * (log(nm,10.) - 9.)
def Magtonanomaggies(m):
return 10.**(-m/2.5+9.)
In [13]:
# Way 1
ext = 0.13
mag = 22.5
detsig1 = Magtonanomaggies(mag)/5. #total noise
signalext = 1./10.**(-ext/2.5)
nmagNew=detsig1*signalext
print nmagNew
In [14]:
# Way 2
ext = 0.13
mag = 22.5
mag2 = mag -ext
detsig1 = Magtonanomaggies(mag2)/5. #total noise
nmagNew=detsig1
print nmagNew