get_rebinned_axis#
- gammapy.estimators.utils.get_rebinned_axis(fluxpoint, axis_name='energy', method=None, **kwargs)[source]#
Get the rebinned axis for resampling the flux point object along the mentioned axis.
- Parameters:
- fluxpoint
FluxPoints
The flux point object to rebin.
- axis_namestr, optional
The axis name to combine along. Default is ‘energy’.
- methodstr
The method to resample the axis. Supported options are ‘fixed_bins’ and ‘min-ts’.
- kwargsdict
Keywords passed to
get_edges_fixed_bins
orget_edges_min_ts
. If method is ‘fixed-bins’, keyword should begroup_size
. If method is ‘min-ts’, keyword should bets_threshold
.
- fluxpoint
- Returns:
- axis_new
MapAxis
orTimeMapAxis
The new axis.
- axis_new
Examples
>>> from gammapy.estimators.utils import get_rebinned_axis >>> from gammapy.estimators import FluxPoints >>> >>> # Rebin lightcurve axis >>> lc_1d = FluxPoints.read( ... "$GAMMAPY_DATA/estimators/pks2155_hess_lc/pks2155_hess_lc.fits", ... format="lightcurve", ... ) >>> # Rebin axis by combining adjacent bins as per the group_size >>> new_axis = get_rebinned_axis( ... lc_1d, method="fixed-bins", group_size=2, axis_name="time" ... ) >>> >>> # Rebin HESS flux points axis >>> fp = FluxPoints.read( ... "$GAMMAPY_DATA/estimators/crab_hess_fp/crab_hess_fp.fits" ... ) >>> # Rebin according to a minimum significance >>> axis_new = get_rebinned_axis( ... fp, method='min-ts', ts_threshold=4, axis_name='energy' ... )