Skip to content

Commit

Permalink
Merge pull request #2682 from cta-observatory/fix_pixel_status
Browse files Browse the repository at this point in the history
Add explicit cast necessary in numpy >=2.1
  • Loading branch information
maxnoe authored Jan 20, 2025
2 parents 2e36f86 + bcb7e98 commit 1372299
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2

build:
os: ubuntu-22.04
os: ubuntu-24.04
apt_packages:
- ffmpeg
- graphviz
Expand All @@ -14,3 +14,6 @@ python:
path: .
extra_requirements:
- docs

sphinx:
configuration: docs/conf.py
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 1372299

Please sign in to comment.