How to exclude bins from a counts cube?

What you will learn

You will learn how to exclude bins from a counts cube to restrict an analysis to a specific region of interest.

You can exclude bins in an analysis from a counts cube by using the ctcubemask tool.

ctcubemask allows selecting only bins from a counts cube within a circular Region of Interest (ROI) and within given energy boundaries. Bins outside these regions will be masked (masked bins are flagged in a counts cube with a value of -1). In addition, circular regions of bins can be masked, and the definition of these circular regions is taken from a ds9 region file.

The following example shows of how you can exclude all bins outside a radius of 1 degree around the location of Src001.

$ ctcubemask
Input counts cube or observation definition XML file [cntcube.fits]
Input exclusion region file in ds9 format [NONE]
RA for ROI centre (degrees) (0-360) [83.63] 266.42
Dec for ROI centre (degrees) (-90-90) [22.51] -29.01
Radius of ROI (degrees) (0-180) [3.0] 1.0
Lower energy limit (TeV) [0.1] 1.0
Upper energy limit (TeV) [100.0]
Output counts cube or observation definition XML file [cntcube_filtered.fits]

A map of the resulting counts cube, summed over the energy axis, is shown in the following image.

../../../../_images/howto_filtered.png

Filtered counts cube

In the next step we exclude in addition a circular region of 0.3 degrees around Src001 from the counts cube. For this purpose you first have to generate a ds9 region file file:

$ nano exclude.reg
fk5
circle(266.42, -29.01, 0.3)

and use this file as Input exclusion region file in ds9 format in the ctcubemask run:

$ ctcubemask
Input counts cube or observation definition XML file [cntcube.fits]
Input exclusion region file in ds9 format [NONE] exclude.reg
RA for ROI centre (degrees) (0-360) [266.42]
Dec for ROI centre (degrees) (-90-90) [-29.01]
Radius of ROI (degrees) (0-180) [1.0]
Lower energy limit (TeV) [1.0]
Upper energy limit (TeV) [100.0]
Output counts cube or observation definition XML file [cntcube_filtered.fits] cntcube_filtered_exclude.fits

The resulting counts cube, summed over the energy axis, is shown in the following image.

../../../../_images/howto_filtered_exclude.png

Filtered counts cube with exclusion region