@@ -66,13 +66,31 @@ def __init__(
6666 first_file
6767 ].root .configuration .instrument .subarray .layout
6868 self .tel_ids = self .subarray_layout .cols ._f_col ("tel_id" )
69+ self .process_type = self ._v_attrs ["CTA PROCESS TYPE" ]
6970 self .data_format_version = self ._v_attrs ["CTA PRODUCT DATA MODEL VERSION" ]
70- if int (self .data_format_version .split ("." )[0 ].replace ("v" , "" )) < 6 :
71- raise Exception (
72- f"Provided CTAO data format version is '{ self .data_format_version } ' (must be >= v.6.0.0)."
73- )
7471
75- self .process_type = self ._v_attrs ["CTA PROCESS TYPE" ]
72+ # Temp fix until ctapipe can process LST-1 data writing into data format v6.0.0.
73+ # For dl1 images we can process real data with version v5.0.0 without any problems.
74+ # TODO: Remove v5.0.0 once v6.0.0 is available
75+ if self .process_type == "Observation" and image_settings is not None :
76+ if int (self .data_format_version .split ("." )[0 ].replace ("v" , "" )) < 5 :
77+ raise IOError (
78+ f"Provided ctapipe data format version is '{ self .data_format_version } ' (must be >= v.5.0.0 for LST-1 data)."
79+ )
80+ else :
81+ if int (self .data_format_version .split ("." )[0 ].replace ("v" , "" )) < 6 :
82+ raise IOError (
83+ f"Provided ctapipe data format version is '{ self .data_format_version } ' (must be >= v.6.0.0)."
84+ )
85+ # Add several checks for real data processing, i.e. no quality cut applied and a single file is provided.
86+ if self .process_type == "Observation" and parameter_selection is not None :
87+ raise ValueError (
88+ f"When processing real observational data, please do not select any quality cut (currently: '{ parameter_selection } ')."
89+ )
90+ if self .process_type == "Observation" and len (self .files ) != 1 :
91+ raise ValueError (
92+ f"When processing real observational data, please provide a single file (currently: '{ len (self .files )} ')."
93+ )
7694 self .subarray_shower = None
7795 if self .process_type == "Simulation" :
7896 self .subarray_shower = self .files [
@@ -131,13 +149,19 @@ def __init__(
131149 self .telescope_pointings = {}
132150 self .fix_pointing = None
133151 tel_id = None
152+ self .tel_trigger_table = None
134153 if self .process_type == "Observation" :
135154 for tel_id in self .tel_ids :
136155 with lock :
137156 self .telescope_pointings [f"tel_{ tel_id :03d} " ] = read_table (
138157 self .files [first_file ],
139158 f"/dl1/monitoring/telescope/pointing/tel_{ tel_id :03d} " ,
140159 )
160+ with lock :
161+ self .tel_trigger_table = read_table (
162+ self .files [first_file ],
163+ "/dl1/event/telescope/trigger" ,
164+ )
141165 elif self .process_type == "Simulation" :
142166 for tel_id in self .tel_ids :
143167 with lock :
@@ -276,7 +300,7 @@ def __init__(
276300 if example_identifiers_file is None :
277301 example_identifiers_file = {}
278302 else :
279- example_identifiers_file = pd .HDFStore (example_identifiers_file , mode = 'r' )
303+ example_identifiers_file = pd .HDFStore (example_identifiers_file )
280304
281305 if "/example_identifiers" in list (example_identifiers_file .keys ()):
282306 self .example_identifiers = pd .read_hdf (
0 commit comments