add example for KernelBackgroundEstimator
@@ -47,6 +47,26 @@ class KernelBackgroundEstimator(object):
--------
gammapy.background.RingBackgroundEstimator,
gammapy.background.AdaptiveRingBackgroundEstimator
+
+ Examples
+ --------
+ .. plot::
+ :include-source:
+
+ import numpy as np
+ from gammapy.maps import Map
+ from astropy.convolution import Ring2DKernel, Tophat2DKernel
+ from gammapy.detect import KernelBackgroundEstimator
+
+ counts = Map.create(npix=100, binsz=1)
+ counts.data += 42
+ counts.data[50][50] = 1000
+ source_kernel = Tophat2DKernel(3)
+ bkg_kernel = Ring2DKernel(radius_in=4, width=2)
+ kbe = KernelBackgroundEstimator(kernel_src=source_kernel.array,
+ kernel_bkg=bkg_kernel.array)
+ result = kbe.run({'counts':counts})
+ result['exclusion'].plot()
"""
def __init__(self, kernel_src, kernel_bkg,
