6 Cross correlation - nmik/Xgam GitHub Wiki

Setting the configuration file:

Let's start by taking a look the configuration file: config/config_crosscorrelation.py.

The first section of the configuration file set the Fermi-LAT maps, masks and Wbeam function (see Sec. 5 to know how to create the Wbeam functions).

Fist of all declare the list of gamma-ray maps you want to cross correlate:

FERMI_MAPS_LIST = [os.path.join(X_OUT, 'output_flux/10years_SV_t56_gp25src4fgl_glliemv07_flux_524-1000.fits'),
	           os.path.join(X_OUT, 'output_flux/10years_SV_t56_gp25src4fgl_glliemv07_flux_1000-1737.fits')]      

Then select the associated masks. The masks have to be a list of .fits objects, either a single mask in the list or a number of masks equal to the number of maps provided in FERMI_MAPS_LIST:

FERMI_MASKS_LIST = os.path.join(X_OUT,'fits/Mask_list.txt')

Then provide the Wbeam file previously generated with bin/mkwbeamFermiLAT.py (see Sec. 5):

FERMI_WBEAM_MATRIX = os.path.join(X_OUT, 'P8R3_SOURCEVETO_V2_evt56_Wbeam.txt') # or None if you don't want to apply the PSF correction
GAMMA = 2.3 #index of the power law assumed to compute the integral of the Wbeam in the energy bin

The second section is dedicated to the other probe you want to cross-correlate with the gamma-ray maps. Again you need to provide a list of maps and masks (in the future the possibility to provide the Wbeam corrections for the given maps will be implemented, for the moment leave LSS_TRACER_WBEAM_LIST = None).

ATT: If only one map is provided the routine will cross-correlate each Fermi map in the FERMI_MAPS_LIST with the map given here. Otherwise will cross-correlate the maps matching their order in the list (e.g. the first one with the first Fermi map, the second with the second Fermi map, and so on). This means that the code does not compute the cross-correlation with all the combinations of maps in the two lists! To do that you need to list the same map files multiple times in the lists (in order to create all the combinations you need) or run the routine multiple times creating different configuration files.

# ----> LSS tracer products

LSS_TRACER_MAPS_LIST = ['output/fits/CMB_lens_hp512.fits']

LSS_TRACER_MASK_LIST = ['output/fits/mask_lens_hp512.fits']

LSS_TRACER_WBEAM_LIST = None

Last section is to set the APS parameters (namely the maximum multipole you want PolSpice to compute, and the binning in multipoles).

# ----> APS parameters

MAX_APS_MULTIPOLE = 1500
BINNING_MIN_MULTIPOLE = 0
BINNING_MAX_MULTIPOLE = 1500
BINNING_MULTIPOLE_NBIN = 21
BINNING_MULTIPOLE_ALGORITHM = 'lin'  #'lin' or 'log'
BINNING_CUSTOM = None #None or list. If a list, previous "BINNING_" parameters are neglected.

BINNING_LABEL = '20bins'

We also provide the possibility to change any PolSpice argument by changing the values in the following dictionary. ATT: you should not change the parameters that are set as 'DEFAULT', because those parameters are automatically set by the routine according to this configuration file.

# ----> PolSpice dictionary 

POLCEPICE_DICT = {'mapfile' : 'DEFAULT',
                  'mapfile2' : 'DEFAULT',
                  'maskfile' : 'DEFAULT',
                  'maskfile2' : 'DEFAULT',
                  'clfile' : 'DEFAULT',
                  'cl_outmap_file' : 'DEFAULT',
                  'covfileout' : 'DEFAULT',
                  'corfile' : 'DEFAULT',
	          'apodizesigma' : 100,
                  'thetamax' : 100,
                  'nlmax' : MAX_APS_MULTIPOLE,
              
              ....
              
              }

Run Example

This is how you run the routine:

>>> python bin/mkcrosscorrelation.py -c config/config_crosscorrelation.py 

A new output file will be created: as "_crosscorrelation.txt" in your output/ folder. if you want to overwrite the output file:

>>> python bin/mkcrosscorrelation.py -c config/config_crosscorrelation.py --overwrite True

ATT: the previous command will overwrite only the .txt output file with the binned APS. If you want PolSpice to re-run the crosscorrelation you need to delete the PolSpice product in the output/output_pol folder!