""" run this code to create the directories """ import os import sys sys.path.append(os.path.abspath('../')) from shear_KL_source import params params.load('base_params.dat') for param_file in ('base_params.dat', 'params_f0.5.dat', 'params_sig0.1.dat', 'params_sig0.1_f0.5.dat', 'params_sig0.1_f0.35.dat'): params.load(param_file) for p in ['scratch_dir', 'shear_in_dir', 'shear_recons_dir', 'Map_dir', 'kappa_dir', 'mask_outdir', 'condorlog']: F = params[p] if not os.path.exists(F): print "mkdir %s" % F os.system('mkdir %s' % F)
if logplot: pylab.semilogx(xvals,SN,label='Signal+Noise') pylab.semilogx(xvals,S,label='Signal') pylab.semilogx(xvals,N,'--k',label='Noise') ax.xaxis.set_major_formatter(FuncFormatter(lambda x,*args: '%i'%x)) else: pylab.plot(xvals,SN,label='Signal+Noise') pylab.plot(xvals,S,label='Signal') pylab.plot(xvals,N,'--k',label='Noise') pylab.legend(loc=4) pylab.xlim(1,4096) pylab.grid(True,c='#AAAAAA') pylab.xlabel('mode number') pylab.ylabel('cumulative value') if __name__ == '__main__': import os import sys sys.path.append(os.path.abspath('../')) from shear_KL_source import params params.load('../run/base_params.dat') from shear_KL_source.DES_tile.tools import get_basis_filename plot_evals( get_basis_filename() ) pylab.savefig('figs/fig03_eigenvalues.eps') pylab.savefig('figs/fig03_eigenvalues.pdf') pylab.show()
def plot_reconstruction_2(): nmodes=900 alpha=0.15 RAmin=11.5 DECmin=36 xlim=(15,45) ylim=(20,50) RAlim = (RAmin,RAmin+1) DEClim = (DECmin,DECmin+1) RAside = (RAlim[1]-RAlim[0]) DECside = (DEClim[1]-DEClim[0]) params.load('../run/base_params.dat') params.load('../run/params_sig0.1.dat') gamma_out_masked_1, noise = get_reconstruction(nmodes, alpha, True, RAmin, DECmin) gamma_out_unmasked_1, noise = get_reconstruction(nmodes, alpha, False, RAmin, DECmin) mask_1 = get_mask(False,RAlim,DEClim) params.load('../run/params_sig0.1_f0.35.dat') gamma_out_masked_2, noise = get_reconstruction(nmodes, alpha, True, RAmin, DECmin) mask_2 = get_mask(False,RAlim,DEClim) params.load('../run/params_sig0.1_f0.5.dat') gamma_out_masked_3, noise = get_reconstruction(nmodes, alpha, True, RAmin, DECmin) mask_3 = get_mask(False,RAlim,DEClim) offset = (RAmin,DECmin) dtheta = params.dtheta/60. xlim = (offset[0] + xlim[0]/60., offset[0] + xlim[1]/60.) ylim = (offset[1] + ylim[0]/60., offset[1] + ylim[1]/60.) extent=(offset[0],offset[0]+RAside, offset[1],offset[1]+DECside) #-------------------------------------------------- pylab.figure(figsize=(8,8)) ax = pylab.subplot(221) pylab.imshow(mask_1.T*0, origin='lower', extent=extent, interpolation='nearest', cmap=pylab.cm.binary) whiskerplot(gamma_out_unmasked_1,dtheta,dtheta,offset=offset) pylab.xlim(xlim) pylab.ylim(ylim) #pylab.title(r'$\mathdefault{unmasked\ KL}$') #pylab.xlabel('') pylab.text(0.97,0.97,'no mask', transform = ax.transAxes, va = 'top', ha = 'right', bbox=dict(facecolor='w',edgecolor='w') ) ax.xaxis.set_major_locator(MultipleLocator(0.2)) ax.yaxis.set_major_locator(MultipleLocator(0.2)) #-------------------------------------------------- ax = pylab.subplot(222) pylab.imshow(mask_1.T, origin='lower', extent=extent, interpolation='nearest', cmap=GreyWhite) pylab.clim(0,1) whiskerplot(gamma_out_masked_1,dtheta,dtheta,offset=offset) pylab.xlim(xlim) pylab.ylim(ylim) #pylab.title(r'$\mathdefault{masked\ KL}$') #pylab.xlabel('') pylab.ylabel('') pylab.text(0.97,0.97,'20% mask', transform = ax.transAxes, va = 'top', ha = 'right', bbox=dict(facecolor='w',edgecolor='w') ) ax.xaxis.set_major_locator(MultipleLocator(0.2)) ax.yaxis.set_major_locator(MultipleLocator(0.2)) #-------------------------------------------------- ax = pylab.subplot(223) pylab.imshow(mask_2.T, origin='lower', extent=extent, interpolation='nearest', cmap=GreyWhite) pylab.clim(0,1) whiskerplot(gamma_out_masked_2,dtheta,dtheta,offset=offset) pylab.xlim(xlim) pylab.ylim(ylim) #pylab.title(r'$\mathdefault{masked\ KL}$') pylab.text(0.97,0.97,'35% mask', transform = ax.transAxes, va = 'top', ha = 'right', bbox=dict(facecolor='w',edgecolor='w') ) ax.xaxis.set_major_locator(MultipleLocator(0.2)) ax.yaxis.set_major_locator(MultipleLocator(0.2)) #-------------------------------------------------- ax = pylab.subplot(224) pylab.imshow(mask_3.T, origin='lower', extent=extent, interpolation='nearest', cmap=GreyWhite) pylab.clim(0,1) whiskerplot(gamma_out_masked_3,dtheta,dtheta,offset=offset) pylab.xlim(xlim) pylab.ylim(ylim) #pylab.title(r'$\mathdefault{masked\ KL}$') pylab.ylabel('') pylab.text(0.97,0.97,'50% mask', transform = ax.transAxes, va = 'top', ha = 'right', bbox=dict(facecolor='w',edgecolor='w') ) ax.xaxis.set_major_locator(MultipleLocator(0.2)) ax.yaxis.set_major_locator(MultipleLocator(0.2)) #-------------------------------------------------- pylab.figtext(0.5,0.97,r'$\mathdefault{KL\ Reconstructions}$', ha='center',va='top', fontsize=16) pylab.figtext(0.5,0.94,r'$\mathdefault{n=900\ modes,\ \ n_{gal}=100/arcmin^2}$', ha='center',va='top', fontsize=14)
""" run this code to compute the aperture mass map from the input shear """ import os import sys sys.path.append(os.path.abspath('../')) from shear_KL_source import params params.load('base_params.dat') from shear_KL_source.DES_tile.mass_maps import compute_Map_input for usemask in ['y','n']: for normed in [True,False]: if usemask=='n' and normed: continue for add_signal in (True, False): for add_noise in (True, False): if add_signal == False and add_noise == False: continue compute_Map_input(add_signal = add_signal, add_noise = add_noise, usemask = usemask, normed = normed)
""" run this code to create the cfg file for the condor runs """ import os import sys sys.path.append(os.path.abspath('../')) from shear_KL_source import params params.load('base_params.dat') from shear_KL_source.DES_tile.setup_utils import create_cfg_file create_cfg_file( cfg_file = 'DES_tile.cfg', alphas = (0.15,), NMODES = (900,), use_noise = (True,), use_mask = (True,False), noise_only = False, compute_shear_noise = False, compute_Map = True, compute_Map_noise = True, ) create_cfg_file( cfg_file = 'DES_tile_noiseonly.cfg', alphas = (0.15,), NMODES = (900,), use_noise = (True,), use_mask = (True,False), noise_only = True, compute_shear_noise = False, compute_Map = True,
""" run this to create the mask tiles for the condor runs This creates masks with different mask fractions """ import os import sys sys.path.append(os.path.abspath('../')) from shear_KL_source import params from shear_KL_source.DES_tile.setup_utils import create_mask_tiles import numpy params.load('base_params.dat') params.load('params_f0.5.dat') numpy.random.seed(3) create_mask_tiles( params.mask_outdir, fmask = params.fmask ) params.load('params_f0.35.dat') numpy.random.seed(3) create_mask_tiles( params.mask_outdir, fmask = params.fmask )