Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed offset calculation in Background2D.to_3d #4728

Merged
merged 4 commits into from Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion gammapy/irf/background.py
Expand Up @@ -2,6 +2,7 @@
import logging
import numpy as np
import astropy.units as u
from astropy.coordinates import angular_separation
from astropy.visualization import quantity_support
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
Expand Down Expand Up @@ -254,7 +255,9 @@ def to_3d(self):

axes = MapAxes([self.axes["energy"], fov_lon, fov_lat])
coords = axes.get_coord()
offset = np.sqrt(coords["fov_lat"] ** 2 + coords["fov_lon"] ** 2)
offset = angular_separation(
0 * u.rad, 0 * u.rad, coords["fov_lon"], coords["fov_lat"]
)
data = self.evaluate(offset=offset, energy=coords["energy"])

return Background3D(
Expand Down