From 2f3c6de112a5abdb611d15874992560ca4d50de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Fr=C3=B6se?= Date: Mon, 9 Jan 2023 16:41:40 +0100 Subject: [PATCH] pixel_positions for TelescopeFrame --- ctapipe/instrument/camera/geometry.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ctapipe/instrument/camera/geometry.py b/ctapipe/instrument/camera/geometry.py index 079fd45acb4..440463d7b88 100644 --- a/ctapipe/instrument/camera/geometry.py +++ b/ctapipe/instrument/camera/geometry.py @@ -448,6 +448,7 @@ def _pixel_positions_2d(self): ------- (rows, columns) of each pixel if transformed onto an orthogonal grid """ + pix_unit = self.pix_x.unit if self.pix_type in {PixelShape.HEXAGON, PixelShape.CIRCLE}: # cam rotation should be 0 unless the derotation is turned off in the init rot_x, rot_y = unskew_hex_pixel_grid( @@ -456,13 +457,14 @@ def _pixel_positions_2d(self): cam_angle=30 * u.deg - self.pix_rotation - self.cam_rotation, ) x_edges, y_edges, _ = get_orthogonal_grid_edges( - rot_x.to_value(u.m), rot_y.to_value(u.m) + rot_x.to_value(pix_unit), rot_y.to_value(pix_unit) ) square_mask = np.histogramdd( - [rot_x.to_value(u.m), rot_y.to_value(u.m)], bins=(x_edges, y_edges) + [rot_x.to_value(pix_unit), rot_y.to_value(pix_unit)], + bins=(x_edges, y_edges), )[0].astype(bool) hex_to_rect_map = np.histogramdd( - [rot_x.to_value(u.m), rot_y.to_value(u.m)], + [rot_x.to_value(pix_unit), rot_y.to_value(pix_unit)], bins=(x_edges, y_edges), weights=np.arange(len(self.pix_y)), )[0].astype(int)