AdaptiveRingBackgroundEstimator

class gammapy.background.AdaptiveRingBackgroundEstimator(r_in, r_out_max, width, stepsize=<Quantity 0.02 deg>, threshold_alpha=0.1, theta=<Quantity 0.22 deg>, method='fixed_width')[source]

Bases: object

Adaptive ring background algorithm.

This algorithm extends the standard RingBackground method by adapting the size of the ring to achieve a minimum on / off exposure ratio (alpha) in regions where the area to estimate the background from is limited.

Parameters:

r_in : Quantity

Inner radius of the ring.

r_out_max : Quantity

Maximal outer radius of the ring.

width : Quantity

Width of the ring.

stepsize : Quantity

Stepsize used for increasing the radius.

threshold_alpha : float

Threshold on alpha above which the adaptive ring takes action.

theta : Quantity

Integration radius used for alpha computation.

method : {‘fixed_width’, ‘fixed_r_in’}

Adaptive ring method.

Examples

Here’s an example how to use the AdaptiveRingBackgroundEstimator:

from astropy import units as u
from gammapy.background import AdaptiveRingBackgroundEstimator
from gammapy.image import SkyImageList

filename = '$GAMMAPY_EXTRA/test_datasets/unbundled/poisson_stats_image/input_all.fits.gz'
images = SkyImageList.read(filename)
images['exposure'].name = 'exposure_on'
adaptive_ring_bkg = RingBackgroundEstimator(r_in=0.22 * u.deg,
                                            r_out_max=0.8 * u.deg,
                                            width=0.1 * u.deg)
results = adaptive_ring_bkg.run(images)
results['background'].show()

Methods Summary

kernels(image) Ring kernels according to the specified method.
run(images) Run adaptive ring background algorithm.

Methods Documentation

kernels(image)[source]

Ring kernels according to the specified method.

Parameters:

image : SkyImage

Sky image specifying the WCS information.

Returns:

kernels : list

List of Ring2DKernel

run(images)[source]

Run adaptive ring background algorithm.

Parameters:

images : SkyImageList

Input sky images.

Returns:

result : SkyImageList

Result sky images.