mock data in all_l_exact data format

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Jaiseung Kim
Posts: 13
Joined: January 21 2008
Affiliation: Max Planck Institute for Astrophysics

mock data in all_l_exact data format

Post by Jaiseung Kim » July 15 2008

I have created all_l exact mock data, using the sample code I found in this forum.
I keep getting the following errors, when I use the mock data:
cmbdata.f90::ReadAllExact: wrong number of columns

When I checked the variablen ncols of cmbdata.F90. it says 1, while it is supposed to be 7 (l Cl_TT Cl_TE Cl_EE N_T N_P f_sky).
The num_cls in cmbtypes.f90 is set to 3.

I used the sample code found in the threads 'all_l exact data format' without change and added the following header.

name = Planck
has_pol = T
all_l_exact=T
all_l_file = data/Planck.dat
all_l_lmax=3000

The code I copied is as follows:

Antony Lewis wrote: Should be

Code: Select all

!Simulate CMB C_l data
!Simple version assuming isotropic noise and full sky
!no lensing, no tensors (check input Cl file has only 4 columns!)
!all parameters hard wired in code
!Data points are max likelihood values
!AL: Sept 2004

program CMB_cl_sim
 use AMLutils
 implicit none

!parameters
 character(LEN=*), parameter :: cl_infile = 'MAPcls.dat'
 character(LEN=*), parameter :: out_name = 'planck.dat'
 logical :: DoPol = .true., DoTemp = .true.
 real :: NoiseVar = 3d-4   !Pessimistic Planck 
       !in MicroK^2
 real, parameter :: fwhm_arcmin = 7. ! 13.  !WMAP ~ 13 (0.22 deg min) 
 real, parameter :: ENoiseFac = 2 !factor more noise on the polarization
 integer, parameter :: lmax = 2250


!Other stuff
 integer, parameter ::  C_T = 1, C_E = 2, C_B = 3, C_C = 4
 
 real :: fwhm_deg = fwhm_arcmin/60 
 real :: Cl(lmax,4), NoiseCl(lmax)
 real amp, xlc, sigma2
 integer l,ll
 real T, E, TE,B, scal


print *,'lmax = ',lmax
print *,'fwhm_arcmin = ', fwhm_arcmin
print *,'Noise = ',NoiseVar

   xlc= 180*sqrt(8.*log(2.))/3.14159
   sigma2 = (fwhm_deg/xlc)**2
   do l=2, lmax
     NoiseCl(l) = NoiseVar*exp(l*(l+1)*sigma2)
   end do


Cl=0
B=0
open(unit=1,file=Cl_infile,form='formatted',status='old')
do ll=2,lmax
  read (1,*) l, T, E, TE
  if (l/=ll) stop 'cl must start at l=2'
  scal=twopi/(l*(l+1))
  Cl(l,1) = T*scal
  Cl(l,2) = E*scal
  Cl(l,3) = B*scal
  Cl(l,4) = TE*scal
end do
close(1)

call CreateTxtFile(out_name,34)

 do l=2, lmax

      write (34,'(1I5,6E15.5)') l,(Cl(l,1)+NoiseCl(l)) , &
                                (Cl(l,C_C)), &
                                (Cl(l,C_E)+ENoiseFac*NoiseCl(l)), &
                            !      (Cl(l,C_B)+ENoiseFac*NoiseCl(l)), &
                                    NoiseCl(l),ENoiseFac*NoiseCl(l), 1.
 end do
 close(34)
end program CMB_cl_sim
thanks,
Jaiseung

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: mock data in all_l_exact data format

Post by Antony Lewis » July 15 2008

Check why TxtFileColumns thinks there is only one column in the data file.

Jaiseung Kim
Posts: 13
Joined: January 21 2008
Affiliation: Max Planck Institute for Astrophysics

mock data in all_l_exact data format

Post by Jaiseung Kim » July 16 2008

I did not realize that .dataset (header file) and .dat (data file) should be separate.
I used to put the header before data in a single file.
Once I had put them in separate files, it works perfect.

Jaiseung Kim
Posts: 13
Joined: January 21 2008
Affiliation: Max Planck Institute for Astrophysics

mock data in all_l_exact data format

Post by Jaiseung Kim » August 20 2008

Is NoiseCl(l) supposed to provide information purely on instrumental noise or
estimation error on observed/simulated C_l?

For instance, estimation error is sqrt(2/(2 l+1)) (S(l) +N(l)), where S(l) is the true signal variance and N(l) is the true noise variance.
Then, noiseCl(l) in all_l exact data format should be equal to N(l) or (2/(2 l+1)) (S(l) +N(l))^2 ?

Antony Lewis
Posts: 1941
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: mock data in all_l_exact data format

Post by Antony Lewis » August 21 2008

The former.

Post Reply