frame=tiltedframe, ).transform_to(array_disp.frame) markers = ax.plot([core_coord.x.value], [core_coord.y.value], "r+", markersize=10) # plot the hit pattern (triggered tels). # first expand the tel.keys() list into a fixed-length vector, # then set the value so that the ArrayDisplay shows it as color per # telescope. tel_idx = source.subarray.tel_indices hit_pattern[:] = 0 mask = [tel_idx[t] for t in event.r0.tel.keys()] hit_pattern[mask] = 10.0 array_disp.values = hit_pattern # calculate and plot the hillas params for tel_id in event.dl0.tel.keys(): # Camera Geometry required for hillas parametrization camgeom = subarray.tel[tel_id].camera.geometry # note the [0] is for channel 0 which is high-gain channel image = event.dl1.tel[tel_id].image time = event.dl1.tel[tel_id].peak_time # Cleaning of the image cleaned_image = image.copy()
from matplotlib import pyplot as plt if __name__ == '__main__': plt.style.use("ggplot") plt.figure(figsize=(10, 8)) arrayfile = datasets.get_path("PROD2_telconfig.fits.gz") tels = Table.read(arrayfile, hdu="TELESCOPE_LEVEL0") adisp = ArrayDisplay(tels['TelX'], tels['TelY'], tels['MirrorArea'] * 2, title='PROD2 telescopes', autoupdate=True) plt.tight_layout() values = np.zeros(len(tels)) # do a small animation to show various trigger patterns: for ii in range(20): # generate a random trigger pattern and integrated intensity: ntrig = np.random.poisson(10) trigmask = np.random.random_integers(len(tels) - 1, size=ntrig) values[:] = 0 values[trigmask] = np.random.uniform(0, 100, size=ntrig) # update the display: adisp.values = values plt.pause(0.5)
# display the array subarray = event.inst.subarray ad = ArrayDisplay(subarray, tel_scale=3.0) print("Now setting vectors") plt.pause(1.0) plt.tight_layout() for phi in np.linspace(0, 360, 30) * u.deg: r = np.cos(phi / 2) ad.set_vector_rho_phi(r, phi) plt.pause(0.01) ad.set_vector_rho_phi(0, 0 * u.deg) plt.pause(1.0) print("Now setting values") ad.telescopes.set_linewidth(0) for ii in range(50): vals = np.random.uniform(100.0, size=subarray.num_tels) ad.values = vals plt.pause(0.01) print("Setting labels") for ii in range(3): ad.add_labels() plt.pause(0.5) ad.remove_labels() plt.pause(0.5)
from numpy import ones_like import matplotlib.pylab as plt if __name__ == '__main__': plt.style.use("ggplot") plt.figure(figsize=(9.5, 8.5)) # load up an example table that has the telescope positions and # mirror areas in it: arrayfile = datasets.get_path("PROD2_telconfig.fits.gz") tels = Table.read(arrayfile, hdu="TELESCOPE_LEVEL0") X = tels['TelX'] Y = tels['TelY'] A = tels['MirrorArea'] * 2 # exaggerate scale a bit # display the array, and set the color value to 50 ad = ArrayDisplay(X, Y, A, title="Prod 2 Full Array") ad.values = ones_like(X) * 50 # label them for tel in tels: name = "CT{tid}".format(tid=tel['TelID']) plt.text(tel['TelX'], tel['TelY'], name, fontsize=8) ad.axes.set_xlim(-1000, 1000) ad.axes.set_ylim(-1000, 1000) plt.tight_layout() plt.show()
y=event.mc.core_y, frame=tiltedframe ).transform_to(array_disp.frame) markers = ax.plot([core_coord.x.value, ], [core_coord.y.value, ], "r+", markersize=10) # plot the hit pattern (triggered tels). # first expand the tels_with_data list into a fixed-length vector, # then set the value so that the ArrayDisplay shows it as color per # telescope. tel_idx = event.inst.subarray.tel_indices hit_pattern[:] = 0 mask = [tel_idx[t] for t in event.r0.tels_with_data] hit_pattern[mask] = 10.0 array_disp.values = hit_pattern # calculate and plot the hillas params for tel_id in event.dl0.tels_with_data: # Camera Geometry required for hillas parametrization camgeom = subarray.tel[tel_id].camera # note the [0] is for channel 0 which is high-gain channel image = event.dl1.tel[tel_id].image[0] # Cleaning of the image cleaned_image = image.copy() # create a clean mask of pixels above the threshold
if __name__ == '__main__': plt.style.use("ggplot") plt.figure(figsize=(10, 8)) arrayfile = datasets.get_path("PROD2_telconfig.fits.gz") tels = Table.read(arrayfile, hdu="TELESCOPE_LEVEL0") adisp = ArrayDisplay(tels['TelX'], tels['TelY'], tels['MirrorArea'] * 2, title='PROD2 telescopes', autoupdate=True) plt.tight_layout() values = np.zeros(len(tels)) # do a small animation to show various trigger patterns: for ii in range(20): # generate a random trigger pattern and integrated intensity: ntrig = np.random.poisson(10) trigmask = np.random.random_integers(len(tels) - 1, size=ntrig) values[:] = 0 values[trigmask] = np.random.uniform(0, 100, size=ntrig) # update the display: adisp.values = values plt.pause(0.5)