ImageProfile¶
-
class
gammapy.image.ImageProfile(table)[source]¶ Bases:
objectImage profile class.
The image profile data is stored in
Tableobject, with the following columns:x_refCoordinate bin center (required).x_minCoordinate bin minimum (optional).x_maxCoordinate bin maximum (optional).profileImage profile data (required).profile_errImage profile data error (optional).
Parameters: table :
TableTable instance with the columns specified as above.
Attributes Summary
profileImage profile quantity. profile_errImage profile error quantity. x_maxMax. x_minMin. x_refReference 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 :
ImageProfileNormalized 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 :
AxesAxes object
-
plot(ax=None, **kwargs)[source]¶ Plot image profile.
Parameters: ax :
AxesAxes object
**kwargs : dict
Keyword arguments passed to
plotReturns: ax :
AxesAxes object
-
plot_err(ax=None, **kwargs)[source]¶ Plot image profile error as band.
Parameters: ax :
AxesAxes object
**kwargs : dict
Keyword arguments passed to plt.fill_between()
Returns: ax :
AxesAxes object
-
smooth(kernel='box', radius=<Quantity 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 :
Quantityor 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 :
ImageProfileSmoothed image profile.