ASmoothMapEstimator#

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

Bases: 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{‘lima’, ‘asmooth’}

Significance estimation method. Default is ‘lima’.

thresholdfloat

Significance threshold. Default is 5.

energy_edgeslist of Quantity, optional

Edges of the target maps energy bins. The resulting bin edges won’t be exactly equal to the input ones, but rather the closest values to the energy axis edges of the parent dataset. Default is None: apply the estimator in each energy bin of the parent dataset. For further explanation see Estimators (DL4 to DL5, and DL6).

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

Configuration 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#

Configuration 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’.

Notes

The progress bar can be displayed for this function.

selection_all()[source]#

Which quantities are computed.