ASmoothMapEstimator#
- class gammapy.estimators.ASmoothMapEstimator(scales=None, kernel=<class 'astropy.convolution.kernels.Gaussian2DKernel'>, spectral_model=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:
- scales
Quantity
Smoothing scales.
- kernel
astropy.convolution.Kernel
Smoothing kernel.
- spectral_model
SpectralModel
, optional Spectral model assumption. Default is power-law with spectral index of 2.
- 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).
- scales
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
Configuration parameters.
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.
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:
- dataset
MapDataset
Dataset.
- dataset
- Returns:
- imagesdict of
WcsNDMap
- Smoothed images; keys are:
‘counts’
‘background’
‘flux’ (optional)
‘scales’
‘sqrt_ts’.
- imagesdict of
- 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:
- scales
ndarray
Scale array.
- scales
- run(dataset)[source]#
Run adaptive smoothing on input MapDataset.
- Parameters:
- dataset
MapDataset
orMapDatasetOnOff
The input dataset (with one bin in energy at most).
- dataset
- Returns:
- imagesdict of
WcsNDMap
- Smoothed images; keys are:
‘counts’
‘background’
‘flux’ (optional)
‘scales’
‘sqrt_ts’.
- imagesdict of
Notes
The progress bar can be displayed for this function.