Skip to content

Commit

Permalink
pixel_positions for TelescopeFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
StFroese committed Jan 13, 2023
1 parent 9af1cf7 commit 2f3c6de
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ctapipe/instrument/camera/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down

0 comments on commit 2f3c6de

Please sign in to comment.