def _display_cam_animation(): plt.style.use("ggplot") fig, ax = plt.subplots() # load the camera geom = io.get_camera_geometry("hess", 1) disp = visualization.CameraDisplay(geom, ax=ax) 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 = mock.generate_2d_shower_model(centroid=centroid, width=width, length=length, psi=angle*u.deg) image, sig, bg = mock.make_mock_shower_image(geom, model.pdf, intensity=intens, nsb_level_pe=5000) image /= image.max() disp.image = image disp.set_limits_percent(100) anim = FuncAnimation(fig, update, interval=50) plt.show()
def _display_cam_animation(): plt.style.use("ggplot") fig, ax = plt.subplots() # load the camera geom = io.get_camera_geometry("hess", 1) disp = visualization.CameraDisplay(geom, ax=ax) 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 = mock.generate_2d_shower_model(centroid=centroid, width=width, length=length, psi=angle * u.deg) image, sig, bg = mock.make_mock_shower_image(geom, model.pdf, intensity=intens, nsb_level_pe=5000) image /= image.max() disp.image = image disp.set_limits_percent(100) anim = FuncAnimation(fig, update, interval=50) plt.show()
model = mock.generate_2d_shower_model(centroid=(0.2 - ii * 0.1, -ii * 0.05), width=0.005 + 0.001 * ii, length=0.1 + 0.05 * ii, psi=np.radians(ii * 20)) image, sig, bg = mock.make_mock_shower_image(geom, model.pdf, intensity=50, nsb_level_pe=1000) clean = image.copy() clean[image <= 3.0 * image.mean()] = 0.0 hillas = hillas_parameters(geom.pix_x.value, geom.pix_y.value, clean) disp.set_cmap(cmaps[ii]) disp.set_image(image) disp.overlay_moments(hillas, linewidth=3, color='blue') if __name__ == '__main__': hexgeom = io.get_camera_geometry("hess", 1) recgeom = io.make_rectangular_camera_geometry() draw_several_cams(recgeom) draw_several_cams(hexgeom) plt.tight_layout() plt.show()
model = mock.generate_2d_shower_model(centroid=(0.2 - ii * 0.1, -ii * 0.05), width=0.005 + 0.001 * ii, length=0.1 + 0.05 * ii, psi=ii * 20 * u.deg) image, sig, bg = mock.make_mock_shower_image(geom, model.pdf, intensity=50, nsb_level_pe=1000) clean = image.copy() clean[image <= 3.0 * image.mean()] = 0.0 hillas = hillas_parameters(geom.pix_x.value, geom.pix_y.value, clean) disp.image = image disp.set_limits_percent(95) disp.overlay_moments(hillas, linewidth=3, color='blue') if __name__ == '__main__': hexgeom = io.get_camera_geometry("hess", 1) recgeom = io.make_rectangular_camera_geometry() draw_several_cams(recgeom) draw_several_cams(hexgeom) plt.tight_layout() plt.show()