Commit 404d2cb9 authored by Moritz Huetten's avatar Moritz Huetten
Browse files

MAGIC reader compatible with ctapipe 0.7.0.post98

parent 5d11d4e9
Pipeline #64873 failed with stage
...@@ -80,7 +80,7 @@ class MAGICEventSource(EventSource): ...@@ -80,7 +80,7 @@ class MAGICEventSource(EventSource):
geom = CameraGeometry.from_name('MAGICCam') geom = CameraGeometry.from_name('MAGICCam')
self.magic_tel_description = TelescopeDescription(name='MAGIC', tel_type='MAGIC', optics=optics, camera=geom) self.magic_tel_description = TelescopeDescription(name='MAGIC', tel_type='MAGIC', optics=optics, camera=geom)
self.magic_tel_descriptions = {1: self.magic_tel_description, 2: self.magic_tel_description} self.magic_tel_descriptions = {1: self.magic_tel_description, 2: self.magic_tel_description}
self.magic_subarray = SubarrayDescription('MAGIC', self.magic_tel_positions, self.magic_tel_descriptions) self._subarray_info = SubarrayDescription('MAGIC', self.magic_tel_positions, self.magic_tel_descriptions)
@staticmethod @staticmethod
def is_compatible(file_mask): def is_compatible(file_mask):
...@@ -175,6 +175,10 @@ class MAGICEventSource(EventSource): ...@@ -175,6 +175,10 @@ class MAGICEventSource(EventSource):
return run return run
@property
def subarray(self):
return self._subarray_info
def _generator(self): def _generator(self):
""" """
The default event generator. Return the stereo event The default event generator. Return the stereo event
...@@ -276,9 +280,6 @@ class MAGICEventSource(EventSource): ...@@ -276,9 +280,6 @@ class MAGICEventSource(EventSource):
data.dl0.tels_with_data = tels_with_data data.dl0.tels_with_data = tels_with_data
data.trig.tels_with_trigger = tels_with_data data.trig.tels_with_trigger = tels_with_data
# Setting the instrument sub-array
data.inst.subarray = self.magic_subarray
yield data yield data
counter += 1 counter += 1
...@@ -387,9 +388,6 @@ class MAGICEventSource(EventSource): ...@@ -387,9 +388,6 @@ class MAGICEventSource(EventSource):
data.dl0.tels_with_data = tels_with_data data.dl0.tels_with_data = tels_with_data
data.trig.tels_with_trigger = tels_with_data data.trig.tels_with_trigger = tels_with_data
# Setting the instrument sub-array
data.inst.subarray = self.magic_subarray
yield data yield data
counter += 1 counter += 1
...@@ -498,9 +496,6 @@ class MAGICEventSource(EventSource): ...@@ -498,9 +496,6 @@ class MAGICEventSource(EventSource):
data.dl0.tels_with_data = tels_with_data data.dl0.tels_with_data = tels_with_data
data.trig.tels_with_trigger = tels_with_data data.trig.tels_with_trigger = tels_with_data
# Setting the instrument sub-array
data.inst.subarray = self.magic_subarray
yield data yield data
counter += 1 counter += 1
...@@ -559,7 +554,7 @@ class MAGICEventSourceMC(EventSource): ...@@ -559,7 +554,7 @@ class MAGICEventSourceMC(EventSource):
geom = CameraGeometry.from_name('MAGICCam') geom = CameraGeometry.from_name('MAGICCam')
self.magic_tel_description = TelescopeDescription(name='MAGIC', tel_type='MAGIC', optics=optics, camera=geom) self.magic_tel_description = TelescopeDescription(name='MAGIC', tel_type='MAGIC', optics=optics, camera=geom)
self.magic_tel_descriptions = {1: self.magic_tel_description, 2: self.magic_tel_description} self.magic_tel_descriptions = {1: self.magic_tel_description, 2: self.magic_tel_description}
self.magic_subarray = SubarrayDescription('MAGIC', self.magic_tel_positions, self.magic_tel_descriptions) self._subarray_info = SubarrayDescription('MAGIC', self.magic_tel_positions, self.magic_tel_descriptions)
@staticmethod @staticmethod
def is_compatible(file_name): def is_compatible(file_name):
...@@ -600,6 +595,10 @@ class MAGICEventSourceMC(EventSource): ...@@ -600,6 +595,10 @@ class MAGICEventSourceMC(EventSource):
return is_magic_root_file return is_magic_root_file
@property
def subarray(self):
return self._subarray_info
def _generator(self): def _generator(self):
""" """
The default event generator. Return the stereo event The default event generator. Return the stereo event
...@@ -682,9 +681,6 @@ class MAGICEventSourceMC(EventSource): ...@@ -682,9 +681,6 @@ class MAGICEventSourceMC(EventSource):
data.dl0.tels_with_data = tels_with_data data.dl0.tels_with_data = tels_with_data
data.trig.tels_with_trigger = tels_with_data data.trig.tels_with_trigger = tels_with_data
# Setting the instrument sub-array
data.inst.subarray = self.magic_subarray
# mc = data.mc.tel[self.mc_file.telescope] # mc = data.mc.tel[self.mc_file.telescope]
# mc.dc_to_pe = array_event['laser_calibrations'][tel_id]['calib'] # mc.dc_to_pe = array_event['laser_calibrations'][tel_id]['calib']
# mc.pedestal = array_event['camera_monitorings'][tel_id]['pedestal'] # mc.pedestal = array_event['camera_monitorings'][tel_id]['pedestal']
...@@ -781,9 +777,6 @@ class MAGICEventSourceMC(EventSource): ...@@ -781,9 +777,6 @@ class MAGICEventSourceMC(EventSource):
data.dl0.tels_with_data = tels_with_data data.dl0.tels_with_data = tels_with_data
data.trig.tels_with_trigger = tels_with_data data.trig.tels_with_trigger = tels_with_data
# Setting the instrument sub-array
data.inst.subarray = self.magic_subarray
# mc = data.mc.tel[self.mc_file.telescope] # mc = data.mc.tel[self.mc_file.telescope]
# mc.dc_to_pe = array_event['laser_calibrations'][tel_id]['calib'] # mc.dc_to_pe = array_event['laser_calibrations'][tel_id]['calib']
# mc.pedestal = array_event['camera_monitorings'][tel_id]['pedestal'] # mc.pedestal = array_event['camera_monitorings'][tel_id]['pedestal']
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment