0001 function [map_sky,vis_sky]=cmb_skysim(ad,l,C_l,doplot)
0002
0003
0004
0005
0006
0007 if(~exist('doplot'))
0008 doplot=0;
0009 end
0010
0011
0012
0013
0014
0015 C_u=C_l/ad.del_u^2;
0016 u=l/(2*pi);
0017
0018
0019
0020 rnd=randn_ft_of_real(ad.N_pix);
0021
0022
0023 vis_sky=realize(ad,u,C_u,rnd);
0024
0025
0026 map_sky=f2i(ad,vis_sky);
0027
0028
0029 if(doplot>0)
0030 subplot(1,2,1);
0031 imagesc(ad.u_val,ad.u_val,abs(vis_sky)); axis square; colorbar;
0032 title('Random Visibilities with PS Envelope');
0033 xlabel('u (\lambda)'); ylabel('v (\lambda)');
0034
0035 subplot(1,2,2);
0036 imagesc(ad.t_val_deg,ad.t_val_deg,map_sky); axis square;
0037 caxis([-1,1]*max(abs(map_sky(:)))); colorbar;
0038 title('Simulated CMB Sky Map');
0039 xlabel('\theta_x (deg)'); ylabel('\theta_y (deg)');
0040 disp('Hit a key to continue'); pause;
0041 end
0042
0043 return;