Home > matutils > interf > cmb_skysim.m

cmb_skysim

PURPOSE ^

[map_sky,vis_sky]=cmb_skysim(ad,l,C_l,doplot)

SYNOPSIS ^

function [map_sky,vis_sky]=cmb_skysim(ad,l,C_l,doplot)

DESCRIPTION ^

 [map_sky,vis_sky]=cmb_skysim(ad,l,C_l,doplot)

 Make a realization of a CMB sky with the given C_l style power spectrum
 Return a brightness map in temperature units

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [map_sky,vis_sky]=cmb_skysim(ad,l,C_l,doplot)
0002 % [map_sky,vis_sky]=cmb_skysim(ad,l,C_l,doplot)
0003 %
0004 % Make a realization of a CMB sky with the given C_l style power spectrum
0005 % Return a brightness map in temperature units
0006 
0007 if(~exist('doplot'))
0008   doplot=0;
0009 end
0010 
0011 % The C_l are the variance of the a_lm for given l.
0012 % In spherical multipole expansion the a_lm are fluxes.
0013 % In fourier expansion each grid point is power per 1/delta_u^2 units
0014 % of frequency space ie. a brightness.
0015 C_u=C_l/ad.del_u^2;
0016 u=l/(2*pi);
0017 
0018 % Get an array of unit variance complex numbers which have a purely
0019 % real Fourier transform.
0020 rnd=randn_ft_of_real(ad.N_pix);
0021 
0022 % Envelope rnd array with C_u power spectrum
0023 vis_sky=realize(ad,u,C_u,rnd);
0024 
0025 % Do the FT with power conserving normalization
0026 map_sky=f2i(ad,vis_sky);
0027 
0028 % Plot the vis and their inverse the map
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;

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005