Skip to content

Commit

Permalink
Make sure HillasReconstructor az is in [0, 360)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Sep 23, 2022
1 parent 2400bef commit 0f5d4c5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ctapipe/reco/hillas_reconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
TooFewTelescopesException,
)



__all__ = ["HillasReconstructor"]


Expand All @@ -39,6 +37,9 @@
)


_two_pi = 2 * np.pi


def angle(v1, v2):
"""computes the angle between two vectors
assuming cartesian coordinates
Expand Down Expand Up @@ -188,9 +189,12 @@ def __call__(self, event):
# estimate max height of shower
h_max = self.estimate_h_max(cog_cartesian, telescope_positions)

# az is clockwise, lon counter-clockwise, make sure it stays in [0, 2pi)
az = u.Quantity(_two_pi - lon.to_value(u.rad), u.rad)

event.dl2.stereo.geometry[self.__class__.__name__] = ReconstructedGeometryContainer(
alt=lat,
az=-lon, # az is clockwise, lon counter-clockwise
az=az,
core_x=core_pos_ground.x,
core_y=core_pos_ground.y,
core_tilted_x=core_pos_tilted.x,
Expand Down

0 comments on commit 0f5d4c5

Please sign in to comment.