beam_weight = beam_weight/np.mean(beam_weight) beam_weight = np.array([beam_weight for i in range(nside_standard**2/nside_beamweight**2)]).transpose().flatten() print "done." sys.stdout.flush() #hpv.mollview(beam_weight, nest=True) #plt.show() #quit() ################################################ #####################GSM########################### ############################################# #rotate sky map and converts to nest equatorial_GSM_standard_2000 = np.fromfile(datadir + 'skymap_mwacs_nside256_float32.dat', dtype='float32') print "Rotating GSM_standard and converts to nest...", sys.stdout.flush() equ2013_to_equ2000_matrix = sv.epoch_transmatrix(2000,stdtime=2013.64) ang0, ang1 =hp.rotator.rotateDirection(equ2013_to_equ2000_matrix, hpf.pix2ang(nside_standard, range(12*nside_standard**2), nest=True)) equatorial_GSM_standard = hpf.get_interp_val(equatorial_GSM_standard_2000, ang0, ang1) print "done." sys.stdout.flush() #hpv.mollview(np.log10(equatorial_GSM_standard), min=-3.5,max=1.5, coord=plotcoord, title='GSM', nest=True) #plt.show() #quit() ######################################################################## ########################processing dynamic pixelization###################### ######################################################################## nside_distribution = np.zeros(12*nside_standard**2) final_index = np.zeros(12*nside_standard**2) thetas, phis, sizes = [], [], []
print "done." sys.stdout.flush() #hpv.mollview(beam_weight, nest=True) #plt.show() #quit() ################################################ #####################GSM########################### ############################################# #rotate sky map and converts to nest equatorial_GSM_standard_2000 = np.fromfile(datadir + 'skymap_mwacs_nside256_float32.dat', dtype='float32') print "Rotating GSM_standard and converts to nest...", sys.stdout.flush() equ2013_to_equ2000_matrix = sv.epoch_transmatrix(2000, stdtime=2013.64) ang0, ang1 = hp.rotator.rotateDirection( equ2013_to_equ2000_matrix, hpf.pix2ang(nside_standard, range(12 * nside_standard**2), nest=True)) equatorial_GSM_standard = hpf.get_interp_val(equatorial_GSM_standard_2000, ang0, ang1) print "done." sys.stdout.flush() #hpv.mollview(np.log10(equatorial_GSM_standard), min=-3.5,max=1.5, coord=plotcoord, title='GSM', nest=True) #plt.show() #quit() ######################################################################## ########################processing dynamic pixelization###################### ########################################################################
############################################# pca1 = hp.fitsfunc.read_map(script_dir + '/../data/gsm1.fits' + str(nside_standard)) pca2 = hp.fitsfunc.read_map(script_dir + '/../data/gsm2.fits' + str(nside_standard)) pca3 = hp.fitsfunc.read_map(script_dir + '/../data/gsm3.fits' + str(nside_standard)) components = np.loadtxt(script_dir + '/../data/components.dat') scale_loglog = si.interp1d(np.log(components[:,0]), np.log(components[:,1])) w1 = si.interp1d(components[:,0], components[:,2]) w2 = si.interp1d(components[:,0], components[:,3]) w3 = si.interp1d(components[:,0], components[:,4]) gsm_standard = np.exp(scale_loglog(np.log(freq))) * (w1(freq)*pca1 + w2(freq)*pca2 + w3(freq)*pca3) #rotate sky map and converts to nest equatorial_GSM_standard = np.zeros(12*nside_standard**2,'float') print "Rotating GSM_standard and converts to nest...", sys.stdout.flush() equ2013_to_gal_matrix = hp.rotator.Rotator(coord='cg').mat.dot(sv.epoch_transmatrix(2000,stdtime=2013.58)) ang0, ang1 =hp.rotator.rotateDirection(equ2013_to_gal_matrix, hpf.pix2ang(nside_standard, range(12*nside_standard**2), nest=True)) equatorial_GSM_standard = hpf.get_interp_val(gsm_standard, ang0, ang1) print "done." sys.stdout.flush() ######################################################################## ########################processing dynamic pixelization###################### ######################################################################## nside_distribution = np.zeros(12*nside_standard**2) final_index = np.zeros(12*nside_standard**2) thetas, phis, sizes = [], [], [] abs_thresh = np.mean(equatorial_GSM_standard * beam_weight) * thresh
############################################# pca1 = hp.fitsfunc.read_map(script_dir + '/../data/gsm1.fits' + str(nside_standard)) pca2 = hp.fitsfunc.read_map(script_dir + '/../data/gsm2.fits' + str(nside_standard)) pca3 = hp.fitsfunc.read_map(script_dir + '/../data/gsm3.fits' + str(nside_standard)) components = np.loadtxt(script_dir + '/../data/components.dat') scale_loglog = si.interp1d(np.log(components[:, 0]), np.log(components[:, 1])) w1 = si.interp1d(components[:, 0], components[:, 2]) w2 = si.interp1d(components[:, 0], components[:, 3]) w3 = si.interp1d(components[:, 0], components[:, 4]) gsm_standard = np.exp(scale_loglog(np.log(freq))) * (w1(freq) * pca1 + w2(freq) * pca2 + w3(freq) * pca3) # rotate sky map and converts to nest equatorial_GSM_standard = np.zeros(12 * nside_standard ** 2, 'float') print "Rotating GSM_standard and converts to nest...", sys.stdout.flush() equ2013_to_gal_matrix = hp.rotator.Rotator(coord='cg').mat.dot(sv.epoch_transmatrix(2000, stdtime=2013.58)) ang0, ang1 = hp.rotator.rotateDirection(equ2013_to_gal_matrix, hpf.pix2ang(nside_standard, range(12 * nside_standard ** 2), nest=True)) equatorial_GSM_standard = hpf.get_interp_val(gsm_standard, ang0, ang1) print "done." sys.stdout.flush() ###UBL#### ubls = {} for p in ['x', 'y']: ubl_filename = datadir + tag + '_%s%s_%i_%i.ubl' % (p, p, nUBL, 3) ubls[p] = np.fromfile(ubl_filename, dtype='float32').reshape((nUBL, 3)) common_ubls = np.array([u for u in ubls['x'] if (u in ubls['y'] or -u in ubls['y'])]) #manually filter UBLs
'/home/omniscope/simulate_visibilities/data/gsm1.fits' + str(nside_standard)) pca2 = hp.fitsfunc.read_map( '/home/omniscope/simulate_visibilities/data/gsm2.fits' + str(nside_standard)) pca3 = hp.fitsfunc.read_map( '/home/omniscope/simulate_visibilities/data/gsm3.fits' + str(nside_standard)) gsm_standard = 422.952 * (0.307706 * pca1 + -0.281772 * pca2 + 0.0123976 * pca3) equatorial_GSM_standard = np.zeros(12 * nside_standard**2, 'float') #rotate sky map print "Rotating GSM_standard...", sys.stdout.flush() equ2013_to_gal_matrix = hp.rotator.Rotator(coord='cg').mat.dot( sv.epoch_transmatrix(2000, stdtime=2013.8)) ang0, ang1 = hp.rotator.rotateDirection( equ2013_to_gal_matrix, hpf.pix2ang(nside_standard, range(12 * nside_standard**2))) equatorial_GSM_standard = hpf.get_interp_val(gsm_standard, ang0, ang1) print "done." sys.stdout.flush() sim_data_clean = A.dot(equatorial_GSM_standard[pix_mask]) noise_data = np.random.randn(len(data)) / Ni**.5 sim_data = sim_data_clean + noise_data sim_sol = np.zeros(12 * nside**2, dtype='float32') sim_sol[pix_mask] = AtNiAi.dot(AtNi.dot(sim_data)) noise_sol = np.zeros(12 * nside**2, dtype='float32') noise_sol[pix_mask] = AtNiAi.dot(AtNi.dot(noise_data)) sim_sol_clean = np.zeros(12 * nside**2, dtype='float32')