Skip to content

Commit

Permalink
Add explicit cast necessary in numpy >=2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Jan 20, 2025
1 parent 05c4821 commit bcb7e98
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changes/2682.maintenance.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add compatibility with numpy>=2.1.
2 changes: 1 addition & 1 deletion src/ctapipe/calib/camera/calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _calibrate_dl0(self, event, tel_id):

dl0_pixel_status = r1.pixel_status.copy()
# set dvr pixel bit in pixel_status for pixels kept by DVR
dl0_pixel_status[signal_pixels] |= PixelStatus.DVR_STORED_AS_SIGNAL
dl0_pixel_status[signal_pixels] |= np.uint8(PixelStatus.DVR_STORED_AS_SIGNAL)
# unset dvr bits for removed pixels
dl0_pixel_status[~signal_pixels] &= ~np.uint8(PixelStatus.DVR_STATUS)

Expand Down
4 changes: 2 additions & 2 deletions src/ctapipe/io/simteleventsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,8 +998,8 @@ def _get_r1_pixel_status(self, tel_id, selected_gain_channel):
low_gain_stored = selected_gain_channel == GainChannel.LOW

# set gain bits
pixel_status[high_gain_stored] |= PixelStatus.HIGH_GAIN_STORED
pixel_status[low_gain_stored] |= PixelStatus.LOW_GAIN_STORED
pixel_status[high_gain_stored] |= np.uint8(PixelStatus.HIGH_GAIN_STORED)
pixel_status[low_gain_stored] |= np.uint8(PixelStatus.LOW_GAIN_STORED)

# reset gain bits for completely disabled pixels
disabled = tel_desc["disabled_pixels"]["HV_disabled"]
Expand Down

0 comments on commit bcb7e98

Please sign in to comment.