本文整理汇总了Python中ctapipe.visualization.CameraDisplay类的典型用法代码示例。如果您正苦于以下问题:Python CameraDisplay类的具体用法?Python CameraDisplay怎么用?Python CameraDisplay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CameraDisplay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_camera
def draw_camera(self, tel, data, axes=None):
"""
Draw a camera image using the correct geometry.
Parameters
----------
tel : int
The telescope you want drawn.
data : `np.array`
1D array with length equal to npix.
axes : `matplotlib.axes.Axes`
A matplotlib axes object to plot on, or None to create a new one.
Returns
-------
`ctapipe.visualization.CameraDisplay`
"""
geom = self.get_geometry(tel)
axes = axes if axes is not None else plt.gca()
camera = CameraDisplay(geom, ax=axes)
camera.image = data
camera.cmap = plt.cm.viridis
# camera.add_colorbar(ax=axes, label="Amplitude (ADC)")
# camera.set_limits_percent(95) # autoscale
return camera
示例2: plot
def plot(self, event, telid):
chan = 0
image = event.dl1.tel[telid].image[chan]
pulse_time = event.dl1.tel[telid].pulse_time[chan]
if self._current_tel != telid:
self._current_tel = telid
self.ax_intensity.cla()
self.ax_pulse_time.cla()
# Redraw camera
geom = self.get_geometry(event, telid)
self.c_intensity = CameraDisplay(geom, ax=self.ax_intensity)
self.c_pulse_time = CameraDisplay(geom, ax=self.ax_pulse_time)
tmaxmin = event.dl0.tel[telid].waveform.shape[2]
t_chargemax = pulse_time[image.argmax()]
cmap_time = colors.LinearSegmentedColormap.from_list(
'cmap_t',
[(0 / tmaxmin, 'darkgreen'),
(0.6 * t_chargemax / tmaxmin, 'green'),
(t_chargemax / tmaxmin, 'yellow'),
(1.4 * t_chargemax / tmaxmin, 'blue'), (1, 'darkblue')]
)
self.c_pulse_time.pixels.set_cmap(cmap_time)
if not self.cb_intensity:
self.c_intensity.add_colorbar(
ax=self.ax_intensity, label='Intensity (p.e.)'
)
self.cb_intensity = self.c_intensity.colorbar
else:
self.c_intensity.colorbar = self.cb_intensity
self.c_intensity.update(True)
if not self.cb_pulse_time:
self.c_pulse_time.add_colorbar(
ax=self.ax_pulse_time, label='Pulse Time (ns)'
)
self.cb_pulse_time = self.c_pulse_time.colorbar
else:
self.c_pulse_time.colorbar = self.cb_pulse_time
self.c_pulse_time.update(True)
self.c_intensity.image = image
if pulse_time is not None:
self.c_pulse_time.image = pulse_time
self.fig.suptitle(
"Event_index={} Event_id={} Telescope={}"
.format(event.count, event.r0.event_id, telid)
)
if self.display:
plt.pause(0.001)
if self.pdf is not None:
self.pdf.savefig(self.fig)
示例3: _display_camera_animation
def _display_camera_animation(self):
#plt.style.use("ggplot")
fig = plt.figure(num="ctapipe Camera Demo", figsize=(7, 7))
ax = plt.subplot(111)
# load the camera
geom = CameraGeometry.from_name(self.camera)
disp = CameraDisplay(geom, ax=ax, autoupdate=True, )
disp.cmap = plt.cm.terrain
def update(frame):
centroid = np.random.uniform(-0.5, 0.5, size=2)
width = np.random.uniform(0, 0.01)
length = np.random.uniform(0, 0.03) + width
angle = np.random.uniform(0, 360)
intens = np.random.exponential(2) * 50
model = toymodel.generate_2d_shower_model(centroid=centroid,
width=width,
length=length,
psi=angle * u.deg)
image, sig, bg = toymodel.make_toymodel_shower_image(geom, model.pdf,
intensity=intens,
nsb_level_pe=5000)
# alternate between cleaned and raw images
if self._counter == self.cleanframes:
plt.suptitle("Image Cleaning ON")
self.imclean = True
if self._counter == self.cleanframes*2:
plt.suptitle("Image Cleaning OFF")
self.imclean = False
self._counter = 0
if self.imclean:
cleanmask = tailcuts_clean(geom, image/80.0)
for ii in range(3):
dilate(geom, cleanmask)
image[cleanmask == 0] = 0 # zero noise pixels
self.log.debug("count = {}, image sum={} max={}"
.format(self._counter, image.sum(), image.max()))
disp.image = image
if self.autoscale:
disp.set_limits_percent(95)
else:
disp.set_limits_minmax(-100, 4000)
disp.axes.figure.canvas.draw()
self._counter += 1
return [ax,]
self.anim = FuncAnimation(fig, update, interval=self.delay,
blit=self.blit)
plt.show()
示例4: display_event
def display_event(event, geoms):
"""an extremely inefficient display. It creates new instances of
CameraDisplay for every event and every camera, and also new axes
for each event. It's hacked, but it works
"""
print("Displaying... please wait (this is an inefficient implementation)")
global fig
ntels = len(event.r0.tels_with_data)
fig.clear()
plt.suptitle("EVENT {}".format(event.r0.event_id))
disps = []
for ii, tel_id in enumerate(event.r0.tels_with_data):
print("\t draw cam {}...".format(tel_id))
nn = int(ceil(sqrt(ntels)))
ax = plt.subplot(nn, nn, ii + 1)
x, y = event.inst.pixel_pos[tel_id]
geom = geoms[tel_id]
disp = CameraDisplay(geom, ax=ax, title="CT{0}".format(tel_id))
disp.pixels.set_antialiaseds(False)
disp.autoupdate = False
disp.cmap = 'afmhot'
chan = 0
signals = event.r0.tel[tel_id].adc_sums[chan].astype(float)
signals -= signals.mean()
disp.image = signals
disp.set_limits_percent(95)
disp.add_colorbar()
disps.append(disp)
return disps
示例5: draw_several_cams
def draw_several_cams(geom, ncams=4):
cmaps = ['jet', 'afmhot', 'terrain', 'autumn']
fig, axs = plt.subplots(
1, ncams, figsize=(15, 4),
)
for ii in range(ncams):
disp = CameraDisplay(
geom,
ax=axs[ii],
title="CT{}".format(ii + 1),
)
disp.cmap = cmaps[ii]
model = toymodel.generate_2d_shower_model(
centroid=(0.2 - ii * 0.1, -ii * 0.05),
width=0.05 + 0.001 * ii,
length=0.15 + 0.05 * ii,
psi=ii * 20 * u.deg,
)
image, sig, bg = toymodel.make_toymodel_shower_image(
geom,
model.pdf,
intensity=1500,
nsb_level_pe=5,
)
mask = tailcuts_clean(
geom,
image,
picture_thresh=6 * image.mean(),
boundary_thresh=4 * image.mean()
)
cleaned = image.copy()
cleaned[~mask] = 0
hillas = hillas_parameters(geom, cleaned)
disp.image = image
disp.add_colorbar(ax=axs[ii])
disp.set_limits_percent(95)
disp.overlay_moments(hillas, linewidth=3, color='blue')
示例6: start
def start(self):
geom = None
imsum = None
disp = None
for data in hessio_event_source(self.infile,
allowed_tels=self._selected_tels,
max_events=self.max_events):
self.calibrator.calibrate(data)
if geom is None:
x, y = data.inst.pixel_pos[self._base_tel]
flen = data.inst.optical_foclen[self._base_tel]
geom = CameraGeometry.guess(x, y, flen)
imsum = np.zeros(shape=x.shape, dtype=np.float)
disp = CameraDisplay(geom, title=geom.cam_id)
disp.add_colorbar()
disp.cmap = 'viridis'
if len(data.dl0.tels_with_data) <= 2:
continue
imsum[:] = 0
for telid in data.dl0.tels_with_data:
imsum += data.dl1.tel[telid].image[0]
self.log.info("event={} ntels={} energy={}" \
.format(data.r0.event_id,
len(data.dl0.tels_with_data),
data.mc.energy))
disp.image = imsum
plt.pause(0.1)
if self.output_suffix is not "":
filename = "{:020d}{}".format(data.r0.event_id,
self.output_suffix)
self.log.info("saving: '{}'".format(filename))
plt.savefig(filename)
示例7: start
def start(self):
geom = None
imsum = None
disp = None
for event in self.reader:
self.calibrator(event)
if geom is None:
geom = event.inst.subarray.tel[self._base_tel].camera
imsum = np.zeros(shape=geom.pix_x.shape, dtype=np.float)
disp = CameraDisplay(geom, title=geom.cam_id)
disp.add_colorbar()
disp.cmap = 'viridis'
if len(event.dl0.tels_with_data) <= 2:
continue
imsum[:] = 0
for telid in event.dl0.tels_with_data:
imsum += event.dl1.tel[telid].image[0]
self.log.info(
"event={} ntels={} energy={}".format(
event.r0.event_id, len(event.dl0.tels_with_data),
event.mc.energy
)
)
disp.image = imsum
plt.pause(0.1)
if self.output_suffix is not "":
filename = "{:020d}{}".format(
event.r0.event_id, self.output_suffix
)
self.log.info(f"saving: '{filename}'")
plt.savefig(filename)
示例8: __init__
def __init__(self, waveform_data, geometry,
camera_axis, waveform_axis_list, waveform_axis_ylabel):
self.__waveform_data = None
self.__waveform_axis_list = None
self.__integration_window = None
self.camera_axis = camera_axis
self.waveform_axis_list = []
self.waveform_title_list = []
self.waveform_window_list = []
self.waveforms = []
self.pixel_switch_num = 0
self.colors = itertools.cycle(['r', 'b', 'c', 'm', 'y', 'k', 'w', 'g'])
self.current_color = 'r'
self.active_pixels = []
self.active_pixel_patches = []
self.active_pixel_labels = []
self.window_start = None
self.window_end = None
CameraDisplay.__init__(self, geometry, ax=camera_axis)
self._active_pixel.set_linewidth(1.5)
self.geom = geometry
self.waveform_yaxis_label = waveform_axis_ylabel
self.waveform_data = waveform_data
self.waveform_axis_list = waveform_axis_list
geometry_text = "Geometry = {}".format(geometry.cam_id)
self.camera_axis.text(0.01, 0.99, geometry_text,
horizontalalignment='left',
verticalalignment='top',
transform=self.camera_axis.transAxes)
示例9: CameraDisplay
from matplotlib import pyplot as plt
from ctapipe.image import toymodel
from ctapipe.instrument import CameraGeometry
from ctapipe.visualization import CameraDisplay
if __name__ == '__main__':
plt.style.use('ggplot')
fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(1, 1, 1)
geom = CameraGeometry.from_name('NectarCam')
disp = CameraDisplay(geom, ax=ax)
disp.add_colorbar()
model = toymodel.generate_2d_shower_model(
centroid=(0.05, 0.0), width=0.05, length=0.15, psi='35d'
)
image, sig, bg = toymodel.make_toymodel_shower_image(
geom, model.pdf, intensity=1500, nsb_level_pe=5
)
disp.image = image
mask = disp.image > 10
disp.highlight_pixels(mask, linewidth=2, color='crimson')
plt.show()
示例10: _display_camera_animation
def _display_camera_animation(self):
# plt.style.use("ggplot")
fig = plt.figure(num="ctapipe Camera Demo", figsize=(7, 7))
ax = plt.subplot(111)
# load the camera
tel = TelescopeDescription.from_name(optics_name=self.optics,
camera_name=self.camera)
geom = tel.camera
# poor-man's coordinate transform from telscope to camera frame (it's
# better to use ctapipe.coordiantes when they are stable)
foclen = tel.optics.equivalent_focal_length.to(geom.pix_x.unit).value
fov = np.deg2rad(4.0)
scale = foclen
minwid = np.deg2rad(0.1)
maxwid = np.deg2rad(0.3)
maxlen = np.deg2rad(0.5)
self.log.debug("scale={} m, wid=({}-{})".format(scale, minwid, maxwid))
disp = CameraDisplay(
geom, ax=ax, autoupdate=True,
title="{}, f={}".format(tel, tel.optics.equivalent_focal_length)
)
disp.cmap = plt.cm.terrain
def update(frame):
centroid = np.random.uniform(-fov, fov, size=2) * scale
width = np.random.uniform(0, maxwid-minwid) * scale + minwid
length = np.random.uniform(0, maxlen) * scale + width
angle = np.random.uniform(0, 360)
intens = np.random.exponential(2) * 500
model = toymodel.generate_2d_shower_model(centroid=centroid,
width=width,
length=length,
psi=angle * u.deg)
self.log.debug(
"Frame=%d width=%03f length=%03f intens=%03d",
frame, width, length, intens
)
image, sig, bg = toymodel.make_toymodel_shower_image(
geom,
model.pdf,
intensity=intens,
nsb_level_pe=3,
)
# alternate between cleaned and raw images
if self._counter == self.cleanframes:
plt.suptitle("Image Cleaning ON")
self.imclean = True
if self._counter == self.cleanframes * 2:
plt.suptitle("Image Cleaning OFF")
self.imclean = False
self._counter = 0
disp.clear_overlays()
if self.imclean:
cleanmask = tailcuts_clean(geom, image,
picture_thresh=10.0,
boundary_thresh=5.0)
for ii in range(2):
dilate(geom, cleanmask)
image[cleanmask == 0] = 0 # zero noise pixels
try:
hillas = hillas_parameters(geom, image)
disp.overlay_moments(hillas, with_label=False,
color='red', alpha=0.7,
linewidth=2, linestyle='dashed')
except HillasParameterizationError:
disp.clear_overlays()
pass
self.log.debug("Frame=%d image_sum=%.3f max=%.3f",
self._counter, image.sum(), image.max())
disp.image = image
if self.autoscale:
disp.set_limits_percent(95)
else:
disp.set_limits_minmax(-5, 200)
disp.axes.figure.canvas.draw()
self._counter += 1
return [ax, ]
frames = None if self.num_events == 0 else self.num_events
repeat = True if self.num_events == 0 else False
self.log.info("Running for {} frames".format(frames))
self.anim = FuncAnimation(fig, update,
interval=self.delay,
frames=frames,
repeat=repeat,
blit=self.blit)
#.........这里部分代码省略.........
示例11: CameraDisplay
from ctapipe.image import toymodel
from ctapipe.io import CameraGeometry
from ctapipe.visualization import CameraDisplay
from matplotlib import pyplot as plt
if __name__ == '__main__':
plt.style.use('ggplot')
fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(1, 1, 1)
geom = CameraGeometry.from_name('hess', 1)
disp = CameraDisplay(geom, ax=ax)
disp.add_colorbar()
model = toymodel.generate_2d_shower_model(
centroid=(0.05, 0.0), width=0.005, length=0.025, psi='35d'
)
image, sig, bg = toymodel.make_toymodel_shower_image(
geom, model.pdf, intensity=50, nsb_level_pe=20
)
disp.image = image
mask = disp.image > 15
disp.highlight_pixels(mask, linewidth=3)
plt.show()
示例12: print
plt.style.use("ggplot")
fig, ax = plt.subplots()
# load the camera
tel = TelescopeDescription.from_name("SST-1M","DigiCam")
print(tel, tel.optics.effective_focal_length)
geom = tel.camera
# poor-man's coordinate transform from telscope to camera frame (it's
# better to use ctapipe.coordiantes when they are stable)
scale = tel.optics.effective_focal_length.to(geom.pix_x.unit).value
fov = np.deg2rad(4.0)
maxwid = np.deg2rad(0.01)
maxlen = np.deg2rad(0.03)
disp = CameraDisplay(geom, ax=ax)
disp.cmap = plt.cm.terrain
disp.add_colorbar(ax=ax)
def update(frame):
centroid = np.random.uniform(-fov, fov, size=2) * scale
width = np.random.uniform(0, maxwid) * scale
length = np.random.uniform(0, maxlen) * scale + width
angle = np.random.uniform(0, 360)
intens = np.random.exponential(2) * 50
model = toymodel.generate_2d_shower_model(
centroid=centroid,
width=width,
length=length,
psi=angle * u.deg,
)
示例13: plot
def plot(event, telid, chan, extractor_name):
# Extract required images
dl0 = event.dl0.tel[telid].waveform[chan]
t_pe = event.mc.tel[telid].photo_electron_image
dl1 = event.dl1.tel[telid].image[chan]
max_time = np.unravel_index(np.argmax(dl0), dl0.shape)[1]
max_charges = np.max(dl0, axis=1)
max_pix = int(np.argmax(max_charges))
min_pix = int(np.argmin(max_charges))
geom = event.inst.subarray.tel[telid].camera
nei = geom.neighbors
# Get Neighbours
max_pixel_nei = nei[max_pix]
min_pixel_nei = nei[min_pix]
# Draw figures
ax_max_nei = {}
ax_min_nei = {}
fig_waveforms = plt.figure(figsize=(18, 9))
fig_waveforms.subplots_adjust(hspace=.5)
fig_camera = plt.figure(figsize=(15, 12))
ax_max_pix = fig_waveforms.add_subplot(4, 2, 1)
ax_min_pix = fig_waveforms.add_subplot(4, 2, 2)
ax_max_nei[0] = fig_waveforms.add_subplot(4, 2, 3)
ax_min_nei[0] = fig_waveforms.add_subplot(4, 2, 4)
ax_max_nei[1] = fig_waveforms.add_subplot(4, 2, 5)
ax_min_nei[1] = fig_waveforms.add_subplot(4, 2, 6)
ax_max_nei[2] = fig_waveforms.add_subplot(4, 2, 7)
ax_min_nei[2] = fig_waveforms.add_subplot(4, 2, 8)
ax_img_nei = fig_camera.add_subplot(2, 2, 1)
ax_img_max = fig_camera.add_subplot(2, 2, 2)
ax_img_true = fig_camera.add_subplot(2, 2, 3)
ax_img_cal = fig_camera.add_subplot(2, 2, 4)
# Draw max pixel traces
ax_max_pix.plot(dl0[max_pix])
ax_max_pix.set_xlabel("Time (ns)")
ax_max_pix.set_ylabel("DL0 Samples (ADC)")
ax_max_pix.set_title(
f'(Max) Pixel: {max_pix}, True: {t_pe[max_pix]}, '
f'Measured = {dl1[max_pix]:.3f}'
)
max_ylim = ax_max_pix.get_ylim()
for i, ax in ax_max_nei.items():
if len(max_pixel_nei) > i:
pix = max_pixel_nei[i]
ax.plot(dl0[pix])
ax.set_xlabel("Time (ns)")
ax.set_ylabel("DL0 Samples (ADC)")
ax.set_title(
"(Max Nei) Pixel: {}, True: {}, Measured = {:.3f}"
.format(pix, t_pe[pix], dl1[pix])
)
ax.set_ylim(max_ylim)
# Draw min pixel traces
ax_min_pix.plot(dl0[min_pix])
ax_min_pix.set_xlabel("Time (ns)")
ax_min_pix.set_ylabel("DL0 Samples (ADC)")
ax_min_pix.set_title(
f'(Min) Pixel: {min_pix}, True: {t_pe[min_pix]}, '
f'Measured = {dl1[min_pix]:.3f}'
)
ax_min_pix.set_ylim(max_ylim)
for i, ax in ax_min_nei.items():
if len(min_pixel_nei) > i:
pix = min_pixel_nei[i]
ax.plot(dl0[pix])
ax.set_xlabel("Time (ns)")
ax.set_ylabel("DL0 Samples (ADC)")
ax.set_title(
f'(Min Nei) Pixel: {pix}, True: {t_pe[pix]}, '
f'Measured = {dl1[pix]:.3f}'
)
ax.set_ylim(max_ylim)
# Draw cameras
nei_camera = np.zeros_like(max_charges, dtype=np.int)
nei_camera[min_pixel_nei] = 2
nei_camera[min_pix] = 1
nei_camera[max_pixel_nei] = 3
nei_camera[max_pix] = 4
camera = CameraDisplay(geom, ax=ax_img_nei)
camera.image = nei_camera
ax_img_nei.set_title("Neighbour Map")
ax_img_nei.annotate(
f"Pixel: {max_pix}",
xy=(geom.pix_x.value[max_pix], geom.pix_y.value[max_pix]),
xycoords='data',
xytext=(0.05, 0.98),
textcoords='axes fraction',
arrowprops=dict(facecolor='red', width=2, alpha=0.4),
horizontalalignment='left',
verticalalignment='top'
)
#.........这里部分代码省略.........
示例14: transform_and_clean_hex_image
def transform_and_clean_hex_image(pmt_signal, cam_geom, photo_electrons):
start_time = time.time()
colors = cm.inferno(pmt_signal/max(pmt_signal))
new_geom, new_signal = convert_geometry_1d_to_2d(
cam_geom, pmt_signal, cam_geom.cam_id)
print("rot_signal", np.count_nonzero(np.isnan(new_signal)))
square_mask = new_geom.mask
cleaned_img = wavelet_transform(new_signal,
raw_option_string=args.raw)
unrot_img = cleaned_img[square_mask]
unrot_colors = cm.inferno(unrot_img/max(unrot_img))
cleaned_img_ik = kill_isolpix(cleaned_img, threshold=.5)
unrot_img_ik = cleaned_img_ik[square_mask]
unrot_colors_ik = cm.inferno(unrot_img_ik/max(unrot_img_ik))
square_image_add_noise = np.copy(new_signal)
square_image_add_noise[~square_mask] = \
np.random.normal(0.13, 5.77, np.count_nonzero(~square_mask))
square_image_add_noise_cleaned = wavelet_transform(square_image_add_noise,
raw_option_string=args.raw)
square_image_add_noise_cleaned_ik = kill_isolpix(square_image_add_noise_cleaned,
threshold=1.5)
unrot_geom, unrot_noised_signal = convert_geometry_back(
new_geom, square_image_add_noise_cleaned_ik, cam_geom.cam_id)
end_time = time.time()
print(end_time - start_time)
global fig
global cb1, ax1
global cb2, ax2
global cb3, ax3
global cb4, ax4
global cb5, ax5
global cb6, ax6
global cb7, ax7
global cb8, ax8
global cb9, ax9
if fig is None:
fig = plt.figure(figsize=(10, 10))
else:
fig.delaxes(ax1)
fig.delaxes(ax2)
fig.delaxes(ax3)
fig.delaxes(ax4)
fig.delaxes(ax5)
fig.delaxes(ax6)
fig.delaxes(ax7)
fig.delaxes(ax8)
fig.delaxes(ax9)
cb1.remove()
cb2.remove()
cb3.remove()
cb4.remove()
cb5.remove()
cb6.remove()
cb7.remove()
cb8.remove()
cb9.remove()
ax1 = fig.add_subplot(333)
disp1 = CameraDisplay(cam_geom, image=photo_electrons, ax=ax1)
plt.gca().set_aspect('equal', adjustable='box')
plt.title("photo-electron image")
disp1.cmap = plt.cm.inferno
disp1.add_colorbar()
cb1 = disp1.colorbar
ax2 = fig.add_subplot(336)
disp2 = CameraDisplay(cam_geom, image=pmt_signal, ax=ax2)
plt.gca().set_aspect('equal', adjustable='box')
disp2.cmap = plt.cm.inferno
disp2.add_colorbar()
cb2 = disp2.colorbar
plt.title("noisy image")
ax3 = fig.add_subplot(331)
plt.imshow(new_signal, interpolation='none', cmap=cm.inferno,
origin='lower')
plt.gca().set_aspect('equal', adjustable='box')
plt.title("noisy, slanted image")
cb3 = plt.colorbar()
ax4 = fig.add_subplot(334)
plt.imshow(cleaned_img, interpolation='none', cmap=cm.inferno,
origin='lower')
plt.gca().set_aspect('equal', adjustable='box')
plt.title("cleaned, slanted image, islands not killed")
cb4 = plt.colorbar()
ax4.set_axis_off()
#.........这里部分代码省略.........
示例15: transform_and_clean_hex_samples
def transform_and_clean_hex_samples(pmt_samples, cam_geom):
# rotate all samples in the image to a rectangular image
rot_geom, rot_samples = convert_geometry_1d_to_2d(
cam_geom, pmt_samples, cam_geom.cam_id)
print("rot samples.shape:", rot_samples.shape)
# rotate the samples back to hex image
unrot_geom, unrot_samples = convert_geometry_back(rot_geom, rot_samples,
cam_geom.cam_id)
global fig
global cb1, ax1
global cb2, ax2
global cb3, ax3
if fig is None:
fig = plt.figure(figsize=(10, 10))
else:
fig.delaxes(ax1)
fig.delaxes(ax2)
fig.delaxes(ax3)
cb1.remove()
cb2.remove()
cb3.remove()
ax1 = fig.add_subplot(221)
disp1 = CameraDisplay(rot_geom, image=np.sum(rot_samples, axis=-1), ax=ax1)
plt.gca().set_aspect('equal', adjustable='box')
plt.title("rotated image")
disp1.cmap = plt.cm.inferno
disp1.add_colorbar()
cb1 = disp1.colorbar
ax2 = fig.add_subplot(222)
disp2 = CameraDisplay(cam_geom, image=np.sum(pmt_samples, axis=-1), ax=ax2)
plt.gca().set_aspect('equal', adjustable='box')
plt.title("original image")
disp2.cmap = plt.cm.inferno
disp2.add_colorbar()
cb2 = disp2.colorbar
ax3 = fig.add_subplot(223)
disp3 = CameraDisplay(unrot_geom, image=np.sum(unrot_samples, axis=-1), ax=ax3)
plt.gca().set_aspect('equal', adjustable='box')
plt.title("de-rotated image")
disp3.cmap = plt.cm.inferno
disp3.add_colorbar()
cb3 = disp3.colorbar
plt.pause(.1)
response = input("press return to continue")
if response != "":
exit()