Commit 175672ae authored by Moritz Huetten's avatar Moritz Huetten
Browse files

reader working with latest ctapipe version

parent 48182ed3
Pipeline #60869 failed with stage
/build/
/ctapipe_io_magic.egg-info/
/dist/
/.project
/.pydevproject
ctapipe_io_magic/__pycache__/__init__.cpython-36.pyc
\ No newline at end of file
...@@ -78,7 +78,7 @@ class MAGICEventSource(EventSource): ...@@ -78,7 +78,7 @@ class MAGICEventSource(EventSource):
# MAGIC telescope description # MAGIC telescope description
optics = OpticsDescription.from_name('MAGIC') optics = OpticsDescription.from_name('MAGIC')
geom = CameraGeometry.from_name('MAGICCam') geom = CameraGeometry.from_name('MAGICCam')
self.magic_tel_description = TelescopeDescription(name='MAGIC', 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.magic_subarray = SubarrayDescription('MAGIC', self.magic_tel_positions, self.magic_tel_descriptions)
...@@ -540,6 +540,9 @@ class MAGICEventSourceMC(EventSource): ...@@ -540,6 +540,9 @@ class MAGICEventSourceMC(EventSource):
self.log.error(msg) self.log.error(msg)
raise raise
if len(glob.glob(kwargs['input_url'])) > 1:
raise ImportError('MC data can no be loaded with wildcards. Please load them run by run')
self.file_name = kwargs['input_url'] self.file_name = kwargs['input_url']
super().__init__(**kwargs) super().__init__(**kwargs)
...@@ -554,7 +557,7 @@ class MAGICEventSourceMC(EventSource): ...@@ -554,7 +557,7 @@ class MAGICEventSourceMC(EventSource):
# MAGIC telescope description # MAGIC telescope description
optics = OpticsDescription.from_name('MAGIC') optics = OpticsDescription.from_name('MAGIC')
geom = CameraGeometry.from_name('MAGICCam') geom = CameraGeometry.from_name('MAGICCam')
self.magic_tel_description = TelescopeDescription(name='MAGIC', 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.magic_subarray = SubarrayDescription('MAGIC', self.magic_tel_positions, self.magic_tel_descriptions)
...@@ -626,7 +629,7 @@ class MAGICEventSourceMC(EventSource): ...@@ -626,7 +629,7 @@ class MAGICEventSourceMC(EventSource):
data = DataContainer() data = DataContainer()
data.meta['origin'] = "MAGIC MC" data.meta['origin'] = "MAGIC MC"
data.meta['input_url'] = self.input_url data.meta['input_url'] = self.input_url
data.meta['is_simulation'] = False data.meta['is_simulation'] = True
tels_with_data = {self.mc_file.telescope, } tels_with_data = {self.mc_file.telescope, }
...@@ -721,7 +724,7 @@ class MAGICEventSourceMC(EventSource): ...@@ -721,7 +724,7 @@ class MAGICEventSourceMC(EventSource):
data = DataContainer() data = DataContainer()
data.meta['origin'] = "MAGIC MC" data.meta['origin'] = "MAGIC MC"
data.meta['input_url'] = self.input_url data.meta['input_url'] = self.input_url
data.meta['is_simulation'] = False data.meta['is_simulation'] = True
tels_with_data = {self.mc_file.telescope, } tels_with_data = {self.mc_file.telescope, }
...@@ -1384,7 +1387,12 @@ class MarsMCFile: ...@@ -1384,7 +1387,12 @@ class MarsMCFile:
self.mc_file = mc_file self.mc_file = mc_file
self.telescope = int(re.findall(r'.*_M(\d)_.*', mc_file)[0]) self.telescope = int(re.findall(r'.*_M(\d)_.*', mc_file)[0])
try:
self.run_number = int(re.findall(r'.*_M\d_za\d+to\d+_\d_(\d+)_Y_.*', mc_file)[0]) self.run_number = int(re.findall(r'.*_M\d_za\d+to\d+_\d_(\d+)_Y_.*', mc_file)[0])
except:
self.run_number = int(re.findall(r'.*_M\d_\d_(\d+)_.*', mc_file)[0])
msg = "WARNING: MAGIC MC file format is unusual."
print(msg)
# Reading the event data # Reading the event data
self.event_data = self.load_events(self.mc_file) self.event_data = self.load_events(self.mc_file)
......
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