ImageProfile#
- class gammapy.estimators.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.
- table
Attributes Summary
Image profile quantity.
Image profile error quantity.
Max.
Min.
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’). Default is “peak”.
- Returns
- profile
ImageProfile
Normalized image profile.
- profile
- peek(figsize=(8, 4.5), **kwargs)[source]#
Show image profile and error.
- Parameters
- figsizetuple
Size of the figure. Default is (8, 4.5).
- **kwargsdict, optional
Keyword arguments passed to
ImageProfile.plot_profile()
.
- Returns
- ax
Axes
Axes object.
- ax
- plot_err(ax=None, **kwargs)[source]#
Plot image profile error as band.
- Parameters
- ax
Axes
, optional Axes object. Default is None.
- **kwargsdict, optional
Keyword arguments passed to
fill_between
.
- ax
- Returns
- ax
Axes
Axes object.
- ax
- 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. Default is “box”.
- 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]
. Default is “0.1 deg”.- kwargsdict, optional
Keyword arguments passed to
uniform_filter
(‘box’) andgaussian_filter
(‘gauss’).
- Returns
- profile
ImageProfile
Smoothed image profile.
- profile