You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When multiple CameraDisplays are plotted on different Axis objects, each with a registered "pick_event" callback, they all seem to respond to the same "pick_event", so clicking one display moves the selected pixel on the other and the callback is called once per instance.
They should be independent.
To Reproduce
fromctapipe.visualizationimportCameraDisplayfromctapipe.instrumentimportCameraGeometryimportmatplotlib.pyplotaspltclassMyCameraDisplay(CameraDisplay):
defon_pixel_clicked(self, pix_id):
print(f"MyCamera: {pix_id=} has value {self.image[pix_id]:.2f}")
fig, ax=plt.subplots(2,2)
geom=CameraGeometry.from_name("NectarCam")
disp1=MyCameraDisplay(geom, ax=ax[0,0])
disp1.enable_pixel_picker()
disp2=MyCameraDisplay(geom, ax=ax[0,1])
disp2.enable_pixel_picker()
plt.show()
When clicking a pixel in either CameraDisplay, both get updated and the on_pixel_picked() method gets called twice
Expected behavior
Each display can be clicked independently
Supporting information
If applicable, add screenshots, logs, or a traceback to help illustrate the bug.
Describe the bug
As found by Vincent:
When multiple CameraDisplays are plotted on different Axis objects, each with a registered "pick_event" callback, they all seem to respond to the same "pick_event", so clicking one display moves the selected pixel on the other and the callback is called once per instance.
They should be independent.
To Reproduce
When clicking a pixel in either CameraDisplay, both get updated and the
on_pixel_picked()
method gets called twiceExpected behavior
Each display can be clicked independently
Supporting information
If applicable, add screenshots, logs, or a traceback to help illustrate the bug.
Additional context
The relevant line is probably:
ctapipe/ctapipe/visualization/mpl_camera.py
Line 269 in 623ac86
Which should set the callback on this instance, not in general.
The text was updated successfully, but these errors were encountered: