Skip to content
Snippets Groups Projects
Commit 175672ae authored by Moritz Huetten's avatar Moritz Huetten
Browse files

reader working with latest ctapipe version

parent 48182ed3
Branches
Tags
No related merge requests found
Pipeline #60869 failed
/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):
# MAGIC telescope description
optics = OpticsDescription.from_name('MAGIC')
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_subarray = SubarrayDescription('MAGIC', self.magic_tel_positions, self.magic_tel_descriptions)
......@@ -540,6 +540,9 @@ class MAGICEventSourceMC(EventSource):
self.log.error(msg)
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']
super().__init__(**kwargs)
......@@ -554,7 +557,7 @@ class MAGICEventSourceMC(EventSource):
# MAGIC telescope description
optics = OpticsDescription.from_name('MAGIC')
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_subarray = SubarrayDescription('MAGIC', self.magic_tel_positions, self.magic_tel_descriptions)
......@@ -626,7 +629,7 @@ class MAGICEventSourceMC(EventSource):
data = DataContainer()
data.meta['origin'] = "MAGIC MC"
data.meta['input_url'] = self.input_url
data.meta['is_simulation'] = False
data.meta['is_simulation'] = True
tels_with_data = {self.mc_file.telescope, }
......@@ -721,7 +724,7 @@ class MAGICEventSourceMC(EventSource):
data = DataContainer()
data.meta['origin'] = "MAGIC MC"
data.meta['input_url'] = self.input_url
data.meta['is_simulation'] = False
data.meta['is_simulation'] = True
tels_with_data = {self.mc_file.telescope, }
......@@ -1384,7 +1387,12 @@ class MarsMCFile:
self.mc_file = mc_file
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])
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
self.event_data = self.load_events(self.mc_file)
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment