• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Want to get organized in 2022? Let Dokkio put your cloud files (Drive, Dropbox, and Slack and Gmail attachments) and documents (Google Docs, Sheets, and Notion) in order. Try Dokkio (from the makers of PBworks) for free. Available on the web, Mac, and Windows.


How to Calculate Cls

Page history last edited by Tom 13 years, 4 months ago

Initiative     Tools     Resources     Help     Contact Us     FAQs




How to calculated the lensing powerspectrum (Cl)


Once IDL and iCosmo are set up, you can calculate the lensing powerspectrum using the following 4 simple steps (an explanation is given below):


; (1) set fiducial parameters:



; (2) create a survey structure: 



; (3) create cosmology parameters structure:



; (4) calculate lensing correlation functions:





(1) Set Fiducial Parameters


Create a structure that contains all the fiducial values that are used in iCosmo.  At this stage users can input options here.  For this there are three input structures: cosmo_in, calc_in and expt_in:


cosmo_in: input cosmological parameter, the options are - 

H, Omega_B, Omega_m, Omega_L, w0, wa, n, Tau, Sigma8 and Curv 


calc_in: Input calculation parameter. Here you can decide which transfer function to use (using the fit_tk key word) and the nonlinear correction to use (the fit_nl key word). In the example fit_nl is set to 2 (Smith et al) and fit_tk is set to 0 (E&H).  The options are -

fit_NL, fit_TK, verbose, delta, n_l, l_ran, speed, linear, k_ran, n_k, n_lbin, nz_fn, nz_crs, ran_z and err


fit_nl: fitting formula for the non-linear powerspectrum

          (default 0:Peacock & Dodds, 1: Ma et al., 2: Smith et al.) 

fit_tk: fitting function for transfer function to use:    

          0: E&H without wiggles (default)   

          1: E&H with wiggles (UNSTABLE w/ NON-LINEAR CORRECTION)   

          2: BBKS as summarised by Peacock & Dodds (1997)


expt_in: Input experiment parametersproperties of a survey. The options are: 

sv1_N_ZBIN, sv1_ZERROR, sv1_Z_MED, sv1_NG,  sv1_A_SURVEY, sv1_EFF, sv1_SIG_INT, sv1_DNDZTYPE, sv1_DNDZP, sv1_DNDZZ, sv1_BIASTYPE, sv1_NS, sv1_SIGMAM, sv1_DELM, sv1_SNE_ZRAN, sv1_NAME, sv1_PROBES  (sv1 can also be changed to sv2 and sv3)


a_survey: survey area  [deg^2]

eff: masking efficiency

ng: galaxy surface density (without binning) [gals amin^-2]

z_m: galaxy median redshift (without binning)

 sig_int: intrinsic rms shear per component

n_zbin: number of redshift slices

gerror: Gaussian photo-z error (sigz=gerror*(1+z))

f_cat: fraction of catastrophic failures

z_delta: off set of a catastrophic failure 


To see the cosmological parameters:  help,fid.cosmo,/st

To see the calculation parameters:  help,fid.calc,/st

To see the parameters for survey:  help,fid.expt.sv1,/st


(2) Create a Survey Structure

Produces a structure with the survey parameters for the survey chosen by the user (help,sv,/st). 




(3) Create a Cosmology Structure


Calculates the basic cosmology parameters using the setting in the fiducial structure.  This routine produces a structure which in turn contains three structure (help,cosmo,/st):


     cosmo.const - cosmological constants such as Omega_m and sigma8

     cosmo.evol   - cosmological parameters that evolve with redshift such as co-moving distance

     cosmo.pk     - 3D matter powerspectrum (both linear and non-linear) for a set of redshift.


To see the const parameters: help,cosmo.const,/st  

To see the evol parameters:   help,cosmo.evol,/st

To see the pk parameters:      help,cosmo.pk,/st


(4) Calculate the lensing powerspectrum. 


You should now have a strucutre (cl) that contains the lensing powerspectrum.  If you type, help,cl,/st , you will see the information contained in this structure.  In the example above we get;

IDL> help,cl,/st

** Structure <1d8f340>, 5 tags, length=3220, data length=3220, refs=1:

   N_ZBIN          LONG                 2

   ZBINS           INT       Array[2, 3]

   N_CL            LONG                 3

   L               DOUBLE    Array[200]

   CL              DOUBLE    Array[200, 3]

   L_RAN           DOUBLE    Array[2]



This means that:

(i) N_ZBIN = 2, i.e. two tomographic bins have been used

(ii) zbins contains the information about which bins are being correlated.  In our example if you type print,cl.ZBINS  you should get:

IDL> print,cl.ZBINS

       0       0

       1       1

       0       1

This means that the 1st is the autocorrelation of bin 0, the 2nd cl is autocorrelation of bin 1 and the 3rd cl is the crosscorrelation of bins 0 and 1.

(iii) N_CL =3, is the number of lensing spectra. For two slices this is three (2 autocorrelations and 1 crosscorrlations)

(iv)    L = Array[200], an array containing the ell values

(v) CL = Array[200, 3], an array containing the Cl values.  To print the i'th Cl value (where i can be anywhere  from 0 to 2) type: print,cl.cl(*,i)

Printing Cl's to a file.


If you want to print the Cl's to a file here is an example of how this can be done:



printf,10,' ell          Cl_00           Cl_11           Cl_01'




The '10' is a Logical Unit Number between 0 and 128 to uniquely specify the file read from or written to. The value of WIDTH should be chosen such that all characters that are printed fit into one line. The number given in FORMAT (in this case '4') corresponds to the number of columns printed and should be equal to N_CL+1.



  • red - Commands you can type into IDL
  • green - What IDL print
  • blue - other, e.g. keywords


Comments (0)

You don't have permission to comment on this page.