Note
Go to the end to download the full example code.
Basic Image Cleaning and Dilation#
Here we create an example shower image, do a tail-cuts (picture/boundary) cleaning, and then dilate the resulting cleaning mask by several neighbor pixels
11 import astropy.units as u
12
13 # %matplotlib inline
14 from matplotlib import pyplot as plt
15
16 from ctapipe.image import dilate, tailcuts_clean, toymodel
17 from ctapipe.instrument import SubarrayDescription
18 from ctapipe.visualization import CameraDisplay
19
20 # Load a camera from an example file
21 subarray = SubarrayDescription.read("dataset://gamma_prod5.simtel.zst")
22 geom = subarray.tel[100].camera.geometry
23
24 # Create a fake camera image to display:
25 model = toymodel.Gaussian(
26 x=0.2 * u.m,
27 y=0.0 * u.m,
28 width=0.05 * u.m,
29 length=0.15 * u.m,
30 psi="35d",
31 )
32
33 image, sig, bg = model.generate_image(geom, intensity=1500, nsb_level_pe=5)
Apply the image cleaning:
Now dialte the mask a few times:
63 plt.figure(figsize=(18, 3))
64
65 for ii in range(0, 6):
66 plt.subplot(1, 7, ii + 1)
67 show_dilate(cleanmask.copy(), times=ii)
Total running time of the script: (0 minutes 4.273 seconds)