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

Vectorize operations in HillasReconstructor #2036

Merged
merged 11 commits into from
Sep 23, 2022
8 changes: 5 additions & 3 deletions ctapipe/reco/hillas_reconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import numpy as np
from astropy import units as u
from astropy.coordinates import AltAz, SkyCoord, cartesian_to_spherical
from astropy.coordinates import AltAz, Longitude, SkyCoord, cartesian_to_spherical

from ctapipe.containers import (
CameraHillasParametersContainer,
Expand Down Expand Up @@ -190,9 +190,11 @@ def __call__(self, event):
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)
LukasNickel marked this conversation as resolved.
Show resolved Hide resolved
az = Longitude(-lon)

event.dl2.stereo.geometry[self.__class__.__name__] = ReconstructedGeometryContainer(
event.dl2.stereo.geometry[
self.__class__.__name__
] = ReconstructedGeometryContainer(
alt=lat,
az=az,
core_x=core_pos_ground.x,
Expand Down
3 changes: 2 additions & 1 deletion ctapipe/reco/tests/test_HillasReconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def test_reconstruction_against_simulation_camera_frame(
# Get shower geometry
calib(event)
image_processor(event)
result = reconstructor(event)
reconstructor(event)
result = event.dl2.stereo.geometry[reconstructor.__class__.__name__]

# get the reconstructed coordinates in the sky
reco_coord = SkyCoord(alt=result.alt, az=result.az, frame=AltAz())
Expand Down