forked from cta-observatory/ctapipe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_animation.py
More file actions
34 lines (24 loc) · 1023 Bytes
/
Copy patharray_animation.py
File metadata and controls
34 lines (24 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import numpy as np
from astropy.table import Table
from ctapipe.utils import datasets
from ctapipe.visualization import ArrayDisplay
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=False)
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)