2 Sky Masks - nmik/Xgam GitHub Wiki
This is how you can create a mask for the Fermi-LAT sky.
The masks are created... (TO BE COMPLETED!)
What you can do:
- mask the Galactic plane below B and above -B, B being the Galactic latitude.
- mask the point sources of a given Fermi-LAT source catalog with a disc of fixed radius.
- mask the extended sources of a given Fermi-LAT source catalog.
- mask the Southern Hemisphere (below a given B)
- mask the Northern Hemisphere (above a given B)
- mask the point sources of a given Fermi-LAT source catalog with a radius defined according to the LAT point spread function (at the energy given in the configuration file) and each source brightness.
- produce a set of masks for your analysis using the datafluxmap config file
Single Mask
Setting the configuration file:
Let's start by taking a look the configuration file: config/config_mask.py:
OUT_LABEL = 'Mask_gp25_src4fgl.fits'
NSIDE = 128
SRC_CATALOG = '/path/to/the/fermiLAT/catalog/gll_psc_v19_4FGL.fit'
EXTSRC_CATALOG = '/path/to/the/fermiLAT/catalog/gll_psc_v19_4FGL.fit'
SRC_MASK_RAD = 1 #[deg]
GP_MASK_LAT = 25. #[deg]
# Only for weighted mask use in function "mask_src_fluxPSFweighted_1"
PSF_FILE = os.path.join(X_CONFIG, 'fits/psf_SV_t32.fits')
ENERGY = 1000 #[MeV]
# Only for Northen/Southern hemisphere masks
NORTH_LAT = 80 # mask above this latitude
SOUTH_LAT = -2 # mask below this latitude
Example:
To run built a mask map (NSIDE=128) covering the Galactic plane at |b|<25 deg and the point sources of the 4FGL catalog:
>>> python bin/mkmask.py -c config/config_mask.py --srcmask True --gpmask flat
This will create the file with the mask map in HEALPix format:
output/fits/Mask_gp25_src4fgl.fits
To see the option availabe for bin/mkdataselection.py type:
>>> python bin/mkmask.py -h
Smart Mask
Suppose you wish to run an analysis on several energy bins; you can exploit the same configuration file of the app datafluxmaps (created for rebinning your data selection and perform foreground subtraction) in order to prepare a set of masks that will be consistent with your data restyling.
The config file should have this form:
IN_LABELS_LIST = ['w9w50_SV_t56', 'w51w100_SV_t56']
OUT_LABEL = '100weeks_SV_t56'
FORE_LABEL = 'glliemv07'
FORE_FILES_LIST = 'output/fits/gll_iem_v07_hp512_list.txt'
IGRB_FILE = os.path.join(X_OUT, 'data/iso_P8R3_SOURCEVETO_V2_v1.txt')
BINCALC = 'CENTER' #CENTER or EDGE, according to the data selection
BINNING_LABEL = '2binsTEST'
MICRO_BINS_FILE = os.path.join(X_OUT, 'ebinning.fits') # Created when mkdataselection.py is run
MACRO_BINS = [(27,32),(33, 38)]
MASK_FILE = os.path.join(X_OUT, 'fits/Mask_gp25_src4fgl.fits')
MASK_LABEL = 'mymask'
The details of the file will be explained in the dedicated section. The important parameters are
MICRO_BINS_FILE
that is the same binning file of your data selectionMACRO_BINS
that is the rebinning bounds (the energy at which the mask will be computed is the logarithmic average of the bin bounds)MASK_LABEL
i.e. the output label
You can run the app by typing:
python bin/mksmartmask.py -c config/config_datafluxmaps.py --srccat=fits/gll_psc_v20.fit --srcextcat=fits/gll_psc_v20.fit --irfs=P8R3_SOURCEVETO_V2 --evtype=3 --ltfile=output_gtltcube/TEST_outofltcube.fits
In this example we used the 4FGL catalog of sources provided by the Fermi-LAT collaboration in order to mask both point and extended sources. A Galactic plane cut of 25 deg will be applied by default. If you already have a psf file you can pass it as an option, otherwise the app will try to build the PSF file. Note that in the second case you have to provide the IRFs and the event type in order to be consistent with your data selection; you have also to provide the ltcube file(s) (it can be a list of files as a .txt/.dat format) resulting from your data selection. NSIDE and Galactic plane cut of the output maps can be changed as an option.
To see all the options available type:
>>> python bin/mksmartmask.py -h