ReflectedRegionsFinder

class gammapy.spectrum.ReflectedRegionsFinder(region, center, angle_increment='0.1 rad', min_distance='0 rad', min_distance_input='0.1 rad', max_region_number=10000, exclusion_mask=None, binsz='0.01 deg')[source]

Bases: object

Find reflected regions.

This class is responsible for placing Reflected regions background for a given input region and pointing position. It converts to pixel coordinates internally assuming a tangent projection at center position.

If the center lies inside the input region, no reflected regions can be found.

If you want to make a background estimate for an IACT observation using the reflected regions method, see also ReflectedRegionsBackgroundMaker

Parameters
regionSkyRegion

Region to rotate

centerSkyCoord

Rotation point

angle_incrementAngle, optional

Rotation angle applied when a region falls in an excluded region.

min_distanceAngle, optional

Minimal distance between two consecutive reflected regions

min_distance_inputAngle, optional

Minimal distance from input region

max_region_numberint, optional

Maximum number of regions to use

exclusion_maskWcsNDMap, optional

Exclusion mask

binszAngle

Bin size of the reference map used for region finding.

Examples

>>> from astropy.coordinates import SkyCoord, Angle
>>> from regions import CircleSkyRegion
>>> from gammapy.spectrum import ReflectedRegionsFinder
>>> pointing = SkyCoord(83.2, 22.7, unit='deg', frame='icrs')
>>> target_position = SkyCoord(80.2, 23.5, unit='deg', frame='icrs')
>>> theta = Angle(0.4, 'deg')
>>> on_region = CircleSkyRegion(target_position, theta)
>>> finder = ReflectedRegionsFinder(min_distance_input='1 rad', region=on_region, center=pointing)
>>> finder.run()
>>> print(finder.reflected_regions[0])
Region: CircleSkyRegion
center: <SkyCoord (Galactic): (l, b) in deg
    ( 184.9367087, -8.37920222)>
    radius: 0.400147197682 deg

Methods Summary

find_regions(self)

Find reflected regions.

make_reference_map(region, center[, binsz, …])

Create empty reference map.

plot(self[, fig, ax])

Standard debug plot.

run(self)

Run all steps.

setup(self)

Compute parameters for reflected regions algorithm.

Methods Documentation

find_regions(self)[source]

Find reflected regions.

static make_reference_map(region, center, binsz='0.01 deg', min_width='0.3 deg')[source]

Create empty reference map.

The size of the map is chosen such that all reflected regions are contained on the image. To do so, the reference map width is taken to be 4 times the distance between the target region center and the rotation point. This distance is larger than the typical dimension of the region itself (otherwise the rotation point would lie inside the region). A minimal width value is added by default in case the region center and the rotation center are too close.

The WCS of the map is the TAN projection at the center in the coordinate system used by the region center.

Parameters
regionSkyRegion

Region to rotate

centerSkyCoord

Rotation point

binszAngle

Reference map bin size.

min_widthAngle

Minimal map width.

Returns
reference_mapWcsNDMap

Map containing the region

plot(self, fig=None, ax=None)[source]

Standard debug plot.

See example here: :ref:’regions_reflected’.

run(self)[source]

Run all steps.

setup(self)[source]

Compute parameters for reflected regions algorithm.