Skip to content

Commit

Permalink
Add docstring to _evaluate_bkg and make it non-public
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Emery <gabriel.emery@cta-consortium.org>
  • Loading branch information
gabemery committed Oct 7, 2024
1 parent b554ca0 commit cbaf964
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions gammapy/makers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,35 @@ def _map_spectrum_weight(map, spectrum=None):
return map * weights.reshape(shape.astype(int))


def evaluate_bkg(pointing, ontime, bkg, geom, use_region_center, obstime, d_omega):
def _evaluate_bkg(pointing, ontime, bkg, geom, use_region_center, obstime, d_omega):
"""
Evaluate the background IRF on a given geometry.
Parameters
----------
pointing : `~gammapy.data.FixedPointingInfo` or `~astropy.coordinates.SkyCoord`
Observation pointing.
ontime : `~astropy.units.Quantity`
Observation ontime. i.e. not corrected for deadtime
bkg : `~gammapy.irf.Background3D`
Background rate model.
geom : `~gammapy.maps.WcsGeom`
Reference geometry.
use_region_center : bool, optional
For geom as a `~gammapy.maps.RegionGeom`. If True, consider the values at the region center.
If False, average over the whole region.
Default is True.
obstime : `~astropy.time.Time`
Observation time to use.
d_omega : 'astropy.units.Quantity'
Solid angle of the image geometry.
Returns
-------
evaluated_bkg : `numpy.ndarray`
Background IRF evaluated on the provided geometry
"""
coords = _get_fov_coords(
pointing=pointing,
irf=bkg,
Expand Down Expand Up @@ -295,7 +323,7 @@ def make_map_background_irf(
image_geom = geom.to_image()
d_omega = image_geom.solid_angle()
if bkg.has_offset_axis or bkg.fov_alignment == FoVAlignment.RADEC:
data = evaluate_bkg(
data = _evaluate_bkg(
pointing, ontime, bkg, geom, use_region_center, obstime, d_omega
)
if bkg.fov_alignment == FoVAlignment.ALTAZ:
Expand All @@ -315,7 +343,7 @@ def make_map_background_irf(
if steptime < endtime - obstime - MINIMUM_TIME_STEP
else endtime - obstime
)
data += evaluate_bkg(
data += _evaluate_bkg(
pointing, steptime, bkg, geom, use_region_center, obstime, d_omega
)
obstime = obstime + steptime
Expand Down

0 comments on commit cbaf964

Please sign in to comment.