# create a clean mask of pixels above the threshold cleanmask = tailcuts_clean(camgeom, image, picture_thresh=10, boundary_thresh=5) if np.count_nonzero(cleanmask) < 10: continue # set all rejected pixels to zero cleaned_image[~cleanmask] = 0 # Calculate hillas parameters try: hillas_dict[tel_id] = hillas_parameters(camgeom, cleaned_image) except HillasParameterizationError: continue # skip failed parameterization (normally no signal) timing_dict[tel_id] = timing_parameters(camgeom, image, time, hillas_dict[tel_id], cleanmask).slope.value array_disp.set_vector_hillas(hillas_dict, 500, timing_dict, angle_offset=0 * u.deg) plt.pause(0.1) # allow matplotlib to redraw the display if len(hillas_dict) < 2: continue
continue stereo = reco.predict( hillas_containers, event.inst, pointing_alt=pointing_altitude, pointing_az=pointing_azimuth ) plt.figure() angle_offset = event.mcheader.run_array_direction[0] disp = ArrayDisplay(event.inst.subarray) disp.set_vector_hillas( hillas_containers, time_gradient=time_gradients, angle_offset=angle_offset, length=500 ) plt.scatter( event.mc.core_x, event.mc.core_y, s=200, c='k', marker='x', label='True Impact', ) plt.scatter( stereo.core_x, stereo.core_y, s=200, c='r', marker='x', label='Estimated Impact', ) plt.legend() plt.show()
continue array_pointing = SkyCoord(az=event.mcheader.run_array_direction[0], alt=event.mcheader.run_array_direction[1], frame=horizon_frame) stereo = reco.predict( hillas_containers, event_source.subarray, array_pointing, ) plt.figure() angle_offset = event.mcheader.run_array_direction[0] disp = ArrayDisplay(event_source.subarray) disp.set_vector_hillas(hillas_containers, time_gradient=time_gradients, angle_offset=angle_offset, length=500) plt.scatter( event.mc.core_x, event.mc.core_y, s=200, c='k', marker='x', label='True Impact', ) plt.scatter( stereo.core_x, stereo.core_y, s=200, c='r', marker='x',
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 cleanmask = tailcuts_clean( camgeom, image, picture_thresh=10, boundary_thresh=5 ) # set all rejected pixels to zero cleaned_image[~cleanmask] = 0 # Calculate hillas parameters try: hillas_dict[tel_id] = hillas_parameters(camgeom, cleaned_image) except HillasParameterizationError: pass # skip failed parameterization (normally no signal) array_disp.set_vector_hillas(hillas_dict, angle_offset=0 * u.deg) plt.pause(0.1) # allow matplotlib to redraw the display if len(hillas_dict) < 2: continue