cta-observatory / pyeventio

Python read-only implementation for the EventIO data format used by the CORSIKA 7 IACT extension and sim_telarray
MIT License
10 stars 12 forks source link

PixelTiming unsupported version #268

Closed lheckmann closed 1 year ago

lheckmann commented 1 year ago

SIMTEL_VERSION = 2022-12-15 19:19:16 UTC (konrad@wizard4) SIMTEL_RELEASE = 2022.349.1 from 2022-12-15 (moving on ...) SIMTEL_BASE_RELEASE = 2022.349.1 from 2022-12-15 (moving on ...)

Error when investigating the output of a custom (non-CTA design) simtel array file:


NotImplementedError                       Traceback (most recent call last)
Input In [194], in <cell line: 15>()
     ---> 15 for i,event in enumerate(source):
     16     print(event.count)

File /remote/pcmagic18/heckmann/anaconda2/envs/revoll/lib/python3.9/site-packages/ctapipe/io/eventsource.py:323, in EventSource.__iter__(self)
    314 def __iter__(self):
    315     """
    316     Generator that iterates through `_generator`, but keeps track of
    317     `self.max_events`.
   (...)
    321     generator
    322     """
--> 323     for event in self._generator():
    324         yield event
    325         if self.max_events and event.count >= self.max_events - 1:

File /remote/pcmagic18/heckmann/anaconda2/envs/revoll/lib/python3.9/site-packages/ctapipe/io/simteleventsource.py:710, in SimTelEventSource._generator(self)
    707     warnings.warn("Backseeking to start of file.")
    709 try:
--> 710     yield from self._generate_events()
    711 except EOFError:
    712     msg = 'EOFError reading from "{input_url}". Might be truncated'.format(
    713         input_url=self.input_url
    714     )

File /remote/pcmagic18/heckmann/anaconda2/envs/revoll/lib/python3.9/site-packages/ctapipe/io/simteleventsource.py:722, in SimTelEventSource._generate_events(self)
    718 def _generate_events(self):
    719     # for events without event_id, we use negative event_ids
    720     pseudo_event_id = 0
--> 722     for counter, array_event in enumerate(self.file_):
    724         event_id = array_event.get("event_id", 0)
    725         if event_id == 0:

File /remote/pcmagic18/heckmann/anaconda2/envs/revoll/lib/python3.9/site-packages/eventio/simtel/simtelfile.py:291, in SimTelFile.iter_array_events(self)
    288     yield next_event
    290 try:
--> 291     self.next_low_level()
    292 except StopIteration:
    293     break

File /remote/pcmagic18/heckmann/anaconda2/envs/revoll/lib/python3.9/site-packages/eventio/simtel/simtelfile.py:163, in SimTelFile.next_low_level(self)
    160     self.current_mc_shower_id = o.header.id
    162 elif isinstance(o, ArrayEvent):
--> 163     self.current_array_event = parse_array_event(
    164         o,
    165         self.allowed_telescopes
    166     )
    168 elif isinstance(o, iact.TelescopeData):
    169     event_id, photons, emitter, photoelectrons = parse_telescope_data(o)

File /remote/pcmagic18/heckmann/anaconda2/envs/revoll/lib/python3.9/site-packages/eventio/simtel/simtelfile.py:428, in parse_array_event(array_event, allowed_telescopes)
    426 elif isinstance(o, TelescopeEvent):
    427     if allowed_telescopes is None or o.telescope_id in allowed_telescopes:
--> 428         telescope_events[o.telescope_id] = parse_telescope_event(o)
    430 elif isinstance(o, TrackingPosition):
    431     if allowed_telescopes is None or o.telescope_id in allowed_telescopes:

File /remote/pcmagic18/heckmann/anaconda2/envs/revoll/lib/python3.9/site-packages/eventio/simtel/simtelfile.py:487, in parse_telescope_event(telescope_event)
    484     event['adc_sums'] = o.parse()
    486 elif isinstance(o, PixelTiming):
--> 487     event['pixel_timing'] = o.parse()
    489 elif isinstance(o, ImageParameters):
    490     event['image_parameters'] = o.parse()

File /remote/pcmagic18/heckmann/anaconda2/envs/revoll/lib/python3.9/site-packages/eventio/simtel/objects.py:1288, in PixelTiming.parse(self)
   1287 def parse(self):
-> 1288     assert_exact_version(self, supported_version=1)
   1289     self.seek(0)
   1290     byte_stream = BytesIO(self.read())

File /remote/pcmagic18/heckmann/anaconda2/envs/revoll/lib/python3.9/site-packages/eventio/version_handling.py:3, in assert_exact_version(self, supported_version)
      1 def assert_exact_version(self, supported_version):
      2     if self.header.version != supported_version:
----> 3         raise NotImplementedError(
      4             (
      5                 'Unsupported version of {name}:'
      6                 ' only supports version {supported_version}'
      7                 ', got {given_version}'
      8             ).format(
      9                 name=self.__class__.__name__,
     10                 supported_version=supported_version,
     11                 given_version=self.header.version,
     12             )
     13         )

NotImplementedError: Unsupported version of PixelTiming: only supports version 1, got 2
lheckmann commented 1 year ago

Testfile: hess_raw.simtel.gz