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 :
Table Table 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(self[, mode])Normalize profile to peak value or integral. peek(self[, figsize])Show image profile and error. plot(self[, ax])Plot image profile. plot_err(self[, ax])Plot image profile error as band. smooth(self[, 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(self, 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(self, 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(self, ax=None, **kwargs)[source]¶ Plot image profile.
Parameters: Returns: - ax :
Axes Axes object
- ax :
-
plot_err(self, 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
- ax :
-
smooth(self, 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 float Smoothing 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.