ASmoothMapEstimator#

class gammapy.estimators.ASmoothMapEstimator(scales=None, kernel=<class 'astropy.convolution.kernels.Gaussian2DKernel'>, spectrum=None, method='lima', threshold=5, energy_edges=None)[source]#

Bases: gammapy.estimators.core.Estimator

Adaptively smooth counts image.

Achieves a roughly constant sqrt_ts of features across the whole image.

Algorithm based on https://ui.adsabs.harvard.edu/abs/2006MNRAS.368…65E

The algorithm was slightly adapted to also allow Li & Ma to estimate the sqrt_ts of a feature in the image.

Parameters
scalesQuantity

Smoothing scales.

kernelastropy.convolution.Kernel

Smoothing kernel.

spectrumSpectralModel

Spectral model assumption

method{‘asmooth’, ‘lima’}

Significance estimation method.

thresholdfloat

Significance threshold.

Examples

>>> import astropy.units as u
>>> import numpy as np
>>> from gammapy.estimators import ASmoothMapEstimator
>>> from gammapy.datasets import MapDataset
>>> dataset = MapDataset.read("$GAMMAPY_DATA/cta-1dc-gc/cta-1dc-gc.fits.gz")
>>> scales = u.Quantity(np.arange(0.1, 1, 0.1), unit="deg")
>>> smooth = ASmoothMapEstimator(threshold=3, scales=scales, energy_edges=[1, 10] * u.TeV)
>>> images = smooth.run(dataset)

Attributes Summary

config_parameters

Config parameters

selection_optional

tag

Methods Summary

copy()

Copy estimator

estimate_maps(dataset)

Run adaptive smoothing on input Maps.

get_kernels(pixel_scale)

Get kernels according to the specified method.

get_scales(n_scales[, factor, kernel])

Create list of Gaussian widths.

run(dataset)

Run adaptive smoothing on input MapDataset.

selection_all()

Which quantities are computed

Attributes Documentation

config_parameters#

Config parameters

selection_optional#
tag = 'ASmoothMapEstimator'#

Methods Documentation

copy()#

Copy estimator

estimate_maps(dataset)[source]#

Run adaptive smoothing on input Maps.

Parameters
datasetMapDataset

Dataset

Returns
imagesdict of WcsNDMap
Smoothed images; keys are:
  • ‘counts’

  • ‘background’

  • ‘flux’ (optional)

  • ‘scales’

  • ‘sqrt_ts’.

get_kernels(pixel_scale)[source]#

Get kernels according to the specified method.

Parameters
pixel_scaleAngle

Sky image pixel scale

Returns
kernelslist

List of Kernel

static get_scales(n_scales, factor=1.4142135623730951, kernel=<class 'astropy.convolution.kernels.Gaussian2DKernel'>)[source]#

Create list of Gaussian widths.

Parameters
n_scalesint

Number of scales

factorfloat

Incremental factor

Returns
scalesndarray

Scale array

run(dataset)[source]#

Run adaptive smoothing on input MapDataset.

Parameters
datasetMapDataset or MapDatasetOnOff

the input dataset (with one bin in energy at most)

Returns
imagesdict of WcsNDMap
Smoothed images; keys are:
  • ‘counts’

  • ‘background’

  • ‘flux’ (optional)

  • ‘scales’

  • ‘sqrt_ts’.

selection_all()[source]#

Which quantities are computed