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

Support for type 2033, pixel monitoring #243

Closed maxnoe closed 2 years ago

maxnoe commented 2 years ago

Quick prototyping:

from eventio import EventIOFile
from eventio.base import EventIOObject
for e in EventIOFile('./Data/sim_telarray/cta-prod5-lapalma/0.0deg/Data/gamma_20deg_180deg_run6___cta-prod5-lapalma-2158m-LaPalma-dark.simtel.zst'):
    if type(e) is EventIOObject:
        break

from io import BytesIO

stream = BytesIO(e.read())

from eventio import tools as io
flags = io.read_int(stream)
num_pixels = io.read_int(stream)
num_gains = io.read_short(stream)

print(flags, num_pixels, num_gains)

import numpy as np

nsb_rate = io.read_array(stream, np.float32, num_pixels)
nsb_rate = io.read_array(stream, np.float32, num_pixels)
qe_rel = io.read_array(stream, np.float32, num_pixels)
gain_rel = io.read_array(stream, np.float32, num_pixels)
hv_rel = io.read_array(stream, np.float32, num_pixels)
current = io.read_array(stream, np.float32, num_pixels)
fadc_amp_highgain = io.read_array(stream, np.float32, num_pixels)
fadc_amp_lowgain = io.read_array(stream, np.float32, num_pixels)
disabled = io.read_array(stream, np.uint8, num_pixels)