ImageProfile¶
-
class
gammapy.image.
ImageProfile
(table)[source]¶ Bases:
object
Image profile class.
The image profile data is stored in
Table
object, with the following columns:x_ref
Coordinate bin center (required).x_min
Coordinate bin minimum (optional).x_max
Coordinate bin maximum (optional).profile
Image profile data (required).profile_err
Image profile data error (optional).
Parameters: table :
Table
Table instance with the columns specified as above.
Attributes Summary
profile
Image profile quantity. profile_err
Image profile error quantity. x_max
Max. x_min
Min. x_ref
Reference x coordinates. Methods Summary
normalize
([mode])Normalize profile to peak value or integral. peek
([figsize])Show image profile and error. plot
([ax])Plot image profile. plot_err
([ax])Plot image profile error as band. smooth
([kernel, radius])Smooth profile with error propagation. Attributes Documentation
-
profile
¶ Image profile quantity.
-
profile_err
¶ Image profile error quantity.
-
x_max
¶ Max. x coordinates.
-
x_min
¶ Min. x coordinates.
-
x_ref
¶ Reference x coordinates.
Methods Documentation
-
normalize
(mode='peak')[source]¶ Normalize profile to peak value or integral.
Parameters: mode : [‘integral’, ‘peak’]
Normalize image profile so that it integrates to unity (‘integral’) or the maximum value corresponds to one (‘peak’).
Returns: profile :
ImageProfile
Normalized image profile.
-
peek
(figsize=(8, 4.5), **kwargs)[source]¶ Show image profile and error.
Parameters: **kwargs : dict
Keyword arguments passed to
ImageProfile.plot_profile()
Returns: ax :
Axes
Axes object
-
plot
(ax=None, **kwargs)[source]¶ Plot image profile.
Parameters: ax :
Axes
Axes object
**kwargs : dict
Keyword arguments passed to
plot
Returns: ax :
Axes
Axes object
-
plot_err
(ax=None, **kwargs)[source]¶ Plot image profile error as band.
Parameters: ax :
Axes
Axes object
**kwargs : dict
Keyword arguments passed to plt.fill_between()
Returns: ax :
Axes
Axes object
-
smooth
(kernel='box', radius='0.1 deg', **kwargs)[source]¶ Smooth profile with error propagation.
Smoothing is described by a convolution:
\[x_j = \sum_i x_{(j - i)} h_i\]Where \(h_i\) are the coefficients of the convolution kernel.
The corresponding error on \(x_j\) is then estimated using Gaussian error propagation, neglecting correlations between the individual \(x_{(j - i)}\):
\[\Delta x_j = \sqrt{\sum_i \Delta x^{2}_{(j - i)} h^{2}_i}\]Parameters: kernel : {‘gauss’, ‘box’}
Kernel shape
radius :
Quantity
, str or floatSmoothing width given as quantity or float. If a float is given it is interpreted as smoothing width in pixels. If an (angular) quantity is given it is converted to pixels using
xref[1] - x_ref[0]
.kwargs : dict
Keyword arguments passed to
uniform_filter
(‘box’) andgaussian_filter
(‘gauss’).Returns: profile :
ImageProfile
Smoothed image profile.