Skip to main content

Python read-only implementation of the EventIO file format

Project description

A Python (read-only) implementation of the EventIO data format invented by Konrad Bernloehr as used for example by the IACT extension for CORSIKA: https://www.ikp.kit.edu/corsika

Documentation of the file format: https://www.mpi-hd.mpg.de/hfm/~bernlohr/sim_telarray/Documentation/eventio_en.pdf

Most blocks of the IACT extension and SimTel are implemented. The following blocks are known, but reading their data is not (yet) implemented, because we do not have any test files containing these objects.

If you want support for these objects, please open an issue.

Code

Description

1206

IACT Camera Layout

1207

IACT Trigger Time

2017

SimTel Pixel Calibriation

2024

SimTel Run Statistics

2025

SimTel MC Run Statisitics

2029

SimTel Auxiliary Digital Traces

2030

SimTel Auxiliary Analog Traces

2031

SimTel FSPhot

install with

pip install eventio

Open a file produced by the IACT CORSIKA extension

First Example

One may iterate over an instance of IACTFile class in order to retrieve events. Events have a small number of fields. The most important one is the photon_bunches field, which is dictionary mapping telescope ids to a simple structured np.array, containing the typical parameters Cherenkov photon bunches in CORSIKA have, like:

  • x, y coordinate in the observation plane (in cm)

  • direction cosine cx, cy in x and y direction of the incident angle of the photon

  • wavelength lambda of the photon (in nm)

  • number of photons associated with this bunch

  • the time since the first interaction (in ns, I believe)

  • the production height of the photon bunch (called zem)

  • a bool flag, whether the photon was scattered in the atmosphere

An event has the following attributes: * header: a namedtuple containing the Corsika Event Header data * end_block: a numpy array containing the Corsika Event End data * time_offset, x_offset, y_offsett, the offset of the array

This prints energy and the number of photons for the first telescope in every event:

import eventio

with eventio.IACTFile('eventio/resources/one_shower.dat') as f:
    for event in f:
        print(event.header["total_energy"])
        print(event.photon_bunches[0]['photons'].sum())

Second Example

If you like to plot the origin of the Cherenkov photons of the first event in file eventio/resources/one_shower.data for the first telescope, have a look into this example

It might look similar to this picture:

an example shower

an example shower

Open a file produced by simtel_array

import eventio

with eventio.SimTelFile('eventio/resources/gamma_test.simtel.gz') as f:

    print(len(f.telescope_descriptions))
    for array_event in f:
        print(array_event['mc_shower']['energy'])

Commandline Tools

We provide a few commandline tools to look into eventio files.

eventio_print_structure

To get an overview over the structure of a file, use eventio_print_structure, for larger files, you might want to pipe its output into e.g. less:

$ eventio_print_structure eventio/resources/gamma_test.simtel.gz
History[70]
    HistoryCommandLine[71]
    HistoryConfig[72]
    HistoryConfig[72]
    And 127 objects more of the same type
...
RunHeader[2000](run_id=31964)
MCRunHeader[2001]
MCRunHeader[2001]
InputCard[1212]
InputCard[1212]
CameraSettings[2002](telescope_id=1)
CameraOrganization[2003](telescope_id=1)
PixelSettings[2004](telescope_id=1)
DisabledPixels[2005](telescope_id=1)
CameraSoftwareSettings[2006](telescope_id=1)
DriveSettings[2008](telescope_id=1)
PointingCorrection[2007](telescope_id=1)
CameraSettings[2002](telescope_id=2)
CameraOrganization[2003](telescope_id=2)

eventio_print_object_information

To get table of all object versions and counts in a file, use eventio_print_object_information, it can also print json if given the --json option

$ eventio_print_object_information eventio/resources/gamma_test.simtel.gz
 Type | Version | Level | #Objects | eventio-class
------------------------------------------------------------
   70 |       1 |     0 |        3 | simtel.objects.History
   71 |       1 |     1 |        3 | simtel.objects.HistoryCommandLine
   72 |       1 |     1 |    32840 | simtel.objects.HistoryConfig
 1212 |       0 |     0 |        2 | iact.objects.InputCard
 2000 |       2 |     0 |        1 | simtel.objects.RunHeader
 2001 |       4 |     0 |        2 | simtel.objects.MCRunHeader
 2002 |       2 |     0 |       98 | simtel.objects.CameraSettings
 2002 |       3 |     0 |       28 | simtel.objects.CameraSettings
 2003 |       1 |     0 |      126 | simtel.objects.CameraOrganization
 2004 |       2 |     0 |      126 | simtel.objects.PixelSettings
 2005 |       0 |     0 |      126 | simtel.objects.DisabledPixels
 2006 |       0 |     0 |      126 | simtel.objects.CameraSoftwareSettings
 2007 |       0 |     0 |      126 | simtel.objects.PointingCorrection
 2008 |       0 |     0 |      126 | simtel.objects.DriveSettings
 2009 |       2 |     1 |       10 | simtel.objects.TriggerInformation
 2010 |       0 |     0 |       10 | simtel.objects.ArrayEvent
 2011 |       1 |     2 |       50 | simtel.objects.TelescopeEventHeader
 2013 |       3 |     2 |       50 | simtel.objects.ADCSamples
 2014 |       5 |     2 |       44 | simtel.objects.ImageParameters
 2016 |       1 |     2 |       49 | simtel.objects.PixelTiming
 2020 |       1 |     0 |      122 | simtel.objects.MCShower
 2021 |       1 |     0 |     1214 | simtel.objects.MCEvent
 2022 |       0 |     0 |      126 | simtel.objects.CameraMonitoring
 2023 |       2 |     0 |      126 | simtel.objects.LaserCalibration
 2026 |       2 |     0 |       21 | simtel.objects.MCPhotoelectronSum
 2027 |       0 |     2 |       93 | simtel.objects.PixelList
 2100 |       0 |     1 |       42 | simtel.objects.TrackingPosition
 2200 |       1 |     1 |       50 | simtel.objects.TelescopeEvent
------------------------------------------------------------

eventio_plot_histograms

To plot histograms stored in an eventio file (Type 100), use eventio_plot_histograms.

$ eventio_plot_histograms gamma_20deg_180deg_run99___cta-prod3_desert-2150m-Paranal-merged_cone10.simtel.gz
First histogram of a prod3b file

Histogram of Impact distance vs log10(E / TeV)

eventio_print_simtel_metaparams

To print the metaparameters stored in an eventio file (the values of the parameters used in the simulation), use eventio_print_simtel_metaparams.

$ eventio_print_simtel_metaparams tests/resources/history_meta_75.simtel.zst

Global METAPARAMs
-----------------
CONFIG_RELEASE = Release "2021-12-16 (development beyond prod-5)" from 2021-12-25T19:33:19 UTC.
CONFIG_VERSION =
ARRAY_CONFIG_NAME = LaPalma-baseline-prod5
ARRAY_CONFIG_VARIANT = LST/MST-NectarCam (including other MST camera type) at CTA North prod-5/prod-5b (extended)
ARRAY_CONFIG_VERSION = 2020-11-20
RANDOM_GENERATOR = mt19937
RANDOM_STATE = auto
RANDOM_SEED = auto
SIMTEL_VERSION = 2021-12-16 18:31:13 CET (konrad@wizard4)
SIMTEL_RELEASE = 2021-12-16 (development beyond prod-5)
SIMTEL_BASE_RELEASE = 2021-12-16 (development beyond prod-5)

METAPARAMs for telescope=1
--------------------------
OPTICS_CONFIG_NAME = LST
OPTICS_CONFIG_VARIANT = LST-1 prototype
OPTICS_CONFIG_VERSION = 2020-04-29
CAMERA_CONFIG_NAME = LST
CAMERA_CONFIG_VARIANT = LST-1 prototype, with nsb_autoscale_airmass
CAMERA_CONFIG_VERSION = 2020-11-24

METAPARAMs for telescope=2
--------------------------
OPTICS_CONFIG_NAME = LST
OPTICS_CONFIG_VARIANT =
OPTICS_CONFIG_VERSION = 2020-04-29
CAMERA_CONFIG_NAME = LST
CAMERA_CONFIG_VARIANT = LST camera, with nsb_autoscale_airmass
CAMERA_CONFIG_VERSION = 2020-11-24

METAPARAMs for telescope=3
--------------------------
OPTICS_CONFIG_NAME = LST
OPTICS_CONFIG_VARIANT =
OPTICS_CONFIG_VERSION = 2020-04-29
CAMERA_CONFIG_NAME = LST
CAMERA_CONFIG_VARIANT = LST camera, with nsb_autoscale_airmass
CAMERA_CONFIG_VERSION = 2020-11-24

...

Low level access

For more low level access to the items of an EventIO file (or to implement a higher level abstraction like IACTFile) one can use the EventIOFile class which gives access to the objects and subobjects in EventIO files.

This is how our test file looks like in the low level view:

In [3]: with EventIOFile('eventio/resources/one_shower.dat') as f:
   ...:     for obj in f:
   ...:         print(obj)
   ...:         if obj.header.only_subobjects:
   ...:             for subobj in obj:
   ...:                 print('   ', subobj)
CORSIKARunHeader[1200](size=1096, only_subobjects=False, first_byte=16)
CORSIKAInputCard[1212](size=448, only_subobjects=False, first_byte=1128)
CORSIKATelescopeDefinition[1201](size=20, only_subobjects=False, first_byte=1592)
CORSIKAEventHeader[1202](size=1096, only_subobjects=False, first_byte=1628)
CORSIKAArrayOffsets[1203](size=16, only_subobjects=False, first_byte=2740)
CORSIKATelescopeData[1204](size=6136, only_subobjects=True, first_byte=2772)
    IACTPhotons(length=6124, n_bunches=382)
CORSIKAEventEndBlock[1209](size=1096, only_subobjects=False, first_byte=8924)
CORSIKARunEndBlock[1210](size=16, only_subobjects=False, first_byte=10036)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eventio-1.16.0.tar.gz (878.1 kB view details)

Uploaded Source

Built Distributions

eventio-1.16.0-cp313-cp313-win_amd64.whl (269.4 kB view details)

Uploaded CPython 3.13Windows x86-64

eventio-1.16.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

eventio-1.16.0-cp313-cp313-macosx_11_0_arm64.whl (782.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

eventio-1.16.0-cp313-cp313-macosx_10_13_x86_64.whl (802.4 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

eventio-1.16.0-cp312-cp312-win_amd64.whl (270.1 kB view details)

Uploaded CPython 3.12Windows x86-64

eventio-1.16.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

eventio-1.16.0-cp312-cp312-macosx_11_0_arm64.whl (785.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

eventio-1.16.0-cp312-cp312-macosx_10_13_x86_64.whl (805.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

eventio-1.16.0-cp311-cp311-win_amd64.whl (267.6 kB view details)

Uploaded CPython 3.11Windows x86-64

eventio-1.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

eventio-1.16.0-cp311-cp311-macosx_11_0_arm64.whl (785.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

eventio-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl (803.0 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

eventio-1.16.0-cp310-cp310-win_amd64.whl (267.5 kB view details)

Uploaded CPython 3.10Windows x86-64

eventio-1.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

eventio-1.16.0-cp310-cp310-macosx_11_0_arm64.whl (783.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

eventio-1.16.0-cp310-cp310-macosx_10_9_x86_64.whl (801.0 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

File details

Details for the file eventio-1.16.0.tar.gz.

File metadata

  • Download URL: eventio-1.16.0.tar.gz
  • Upload date:
  • Size: 878.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eventio-1.16.0.tar.gz
Algorithm Hash digest
SHA256 e6ae44b92209d62d9e378369030e292f3eba772bf15ca91cf096a75dcbfdb37c
MD5 7fb3e6608292f23d13b1afb2e0569d27
BLAKE2b-256 923e26deeee48537566ca406b824cd03ee797bebb1b76e8111978273db43a247

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: eventio-1.16.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 269.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eventio-1.16.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f48439359631a716c8ff9c39bdf5c4eae477388f019ab2166fafb9cef6b10516
MD5 0487d44fdb71ecd1962101118d7c70e7
BLAKE2b-256 123c778a16b8e41a5e5520adafc3892470e31a9e1221e5b4c8298616fa9a7c8a

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba25259f49af9477c13489a2a85d163ff7d5fd6b5d171253647b165cc9e777e3
MD5 6ca9c916d647412ac4b635e69a2eafa1
BLAKE2b-256 38ac707fc4775408919725f8d10b21962230f5b4c0cc776076a88dc236470db2

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0da8bcc5f48faa7bc6b74decfd05cc9b65c2eb67b224cd8162aab09d3355e00d
MD5 83a37de1276baeb455e3e5f4e9fcf0b0
BLAKE2b-256 0efad47cca85a70f9d671c7afe43eeefe4deaec1c1f6f27b37efc265fccd57be

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 770d951078d993a2704075ae03ec44ddb34054d171cd9d68bfcf9476521a0854
MD5 38f6cd14dbddc97f3a43a7c5ef868216
BLAKE2b-256 319c3cb6ad2ac8376ff0703f81afdf2f1d1db415e64086da09b7eca80ff91e57

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: eventio-1.16.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 270.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eventio-1.16.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8269df3ed4c5c939c805739502c69c258964fc6792f2e11b2dff4e7c005a12ca
MD5 b9d58913f0b65560c0bd8ccdbaa14d22
BLAKE2b-256 858d2f637a7c970b892da42c0b163afd50625f6ddcb5fa04e6dbcec368001bf8

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4fb16f3d8efdd31fd453e836fd2f816fa4a692a5fc75d19417a41f362c87ac7e
MD5 82a09df165661ebc2dd404707be7146c
BLAKE2b-256 7a5ead2ba14aa60fa1efd073e0de0ebec057e629b19dffa5d257119867d16620

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 af29e1eb3a6ca70c343c816923fd1aa79f08ea734a326aca50da49c573d844da
MD5 12260ae1e29c405dd6cabcff1c63bcd5
BLAKE2b-256 d102f86e6ccda2024053662d70fd0060ab0f1fcfc8ad9912a5fd798724c5a610

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 8d582dd7f19a27ec0fe77ecddffc49efef6a68060af012612c0f0fed817d8c3d
MD5 6387580c64ae154175d79555c42ae6c2
BLAKE2b-256 5285c936ed70636e9691f37b6519b90a2c2d5155c890b06d118eb8b1af0399c1

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: eventio-1.16.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 267.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eventio-1.16.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b210ffb734834599d8a3c57b0c96b28df2064526f98e90ad8bb6bc8a941e429a
MD5 4ddbeff8e2ebea49746eeea6f1ebbb39
BLAKE2b-256 ff23c7a8dc7a8b072bc83cf363635b4f1c672e1f81aea3f1a5ade3de3f87481a

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 954c41d791c6e6a75a8ade33157af1803b16759915c0285596c33ecdd7e187eb
MD5 9bea5804142cdb20279fa785a206e1f3
BLAKE2b-256 2c809fe7a4d69f1e397971410de8c726741dea75286b5ffdd5637e224f5b23fd

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e5c55678845c34d94323fa1aa7f02ac29b425c8bef0b87c288f9ab5dc82b869
MD5 0378a3ee4a25f005219911d53192497a
BLAKE2b-256 b48c15aa706000bb0508e7ba996a261510d535dd430cb6d16d43142c413a14a8

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d50e981ab98bd044f47924d6a2a115105b48b5deeef4aaaafa1cc3e321f1ecb1
MD5 1eac77f5d98c426b42cc1a40c7d3dada
BLAKE2b-256 0cc3051b8325043227fb784ef5d7d6c3d59856031400f2922abaf453a7fbf1ab

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: eventio-1.16.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 267.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for eventio-1.16.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d4c5a06f53386dff066a6b1b335ebb45eb2ef6242bd4b1b3e0686364c60a1df7
MD5 4571d5d135aba05a60b6281d1924b5e5
BLAKE2b-256 fd66af74f944211cb33010b47cab3435319b81b0f29ea6867010cd69eb4a9c67

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ddc26924e95b954deaeb3258e0f639a2cd959c5b34fbb60ca07de7b0dd2b556d
MD5 5acadd1455a0e057e7ca5d48eef79477
BLAKE2b-256 bd4f95dfb3e32640f94bf5336bfabfce34d599ace35216929fbf8a786e77464f

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7d5cd32e0f273af2f9efa90995b645e3ef513aa7789ae764b9811e208cefd648
MD5 8131c4b465e592c44e8dba9850fdd9c9
BLAKE2b-256 249f4939968f457757a1e022214f793cd799fd5517373391d1165456afe383b6

See more details on using hashes here.

File details

Details for the file eventio-1.16.0-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for eventio-1.16.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4cf2675920b21cc20cb7e8d443a7464b70af9a3dad41ab907b4995cbef132bcb
MD5 b04e5a4adacb304015f6983a293b1b1f
BLAKE2b-256 3f6a2fc025a4ca5632a8e7de8aaec6afb4a8c50a8bc1d33208401f86cc6e97d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page