-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessor.py
More file actions
53 lines (43 loc) · 1.43 KB
/
processor.py
File metadata and controls
53 lines (43 loc) · 1.43 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from ctapipe.io import event_source
import glob
import writer
from utilities import process_type
def process(
input_path,
output_path,
max_files,
max_events,
site_altitude,
types,
telescopes,
site_location,
choppoints,
id_no,
quality_cuts):
for typename in types:
print("Processing", typename)
# Get a list of the files for this source type
files = glob.glob(input_path + typename + '/*.simtel.zst')
files = files + glob.glob(input_path + typename + '/*.simtel.gz')
if len(files)==0:
print("No ",typename," files found")
continue
# Process the files
telescope_events_data, array_events_data, runs_all, stereo, positions = process_type(
files, max_files, max_events, site_altitude, telescopes, choppoints, quality_cuts)
# Skip writing if nothing was processed
if telescope_events_data is None:
print(
typename, "did not have any events output (maybe too low-energy?)")
continue
site_location.append(runs_all[0]['prod_site_alt'])
writer.write(
typename,
output_path,
site_location,
array_events_data,
telescope_events_data,
runs_all,
positions,
stereo,
id_no)