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:
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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file eventio-1.14.0.tar.gz
.
File metadata
- Download URL: eventio-1.14.0.tar.gz
- Upload date:
- Size: 859.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d81e922863d7e0f3a2517678382f5b91e44917a9dce03abd0fea245b963432b3 |
|
MD5 | 9a1a5a1fa6a4e9ff2a3b905d2c474646 |
|
BLAKE2b-256 | 689d874b115ef5222ab173c5b764c52ef8e26c4bd6455aae1ca727da74ea19ff |
File details
Details for the file eventio-1.14.0-cp313-cp313-win_amd64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 286.3 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 523047e1b8941098244d68382abc1c55c9022af7fec049ed2b8cc4542b20bf45 |
|
MD5 | 13a32e8fc74b09bebd5b9a02e469546e |
|
BLAKE2b-256 | 656e425961d56da0206fb188564c86940a0d6570212c360327da5b1a0dcaccc5 |
File details
Details for the file eventio-1.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5525ace323f1393ee20583e57fae06ff5fae24e1a95edc829f8e5e68f4ca09d7 |
|
MD5 | 09ba0999214baa1a75c4799347a0c65b |
|
BLAKE2b-256 | d5da0e5cbf995fb6b8da0d4f69a598471a0640396964ce4316ef9d20abed0ca4 |
File details
Details for the file eventio-1.14.0-cp313-cp313-macosx_11_0_arm64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 782.8 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a98821fc9418004487ac643f0be9e1b95922a3aa586572c1eae086623f57b9d6 |
|
MD5 | 04de5e7c269c7b1aed2c1d23d8fe3642 |
|
BLAKE2b-256 | 71fbd60a900ddec4ce7bffaecc2e07f280039fcb83c47b1308a5f98d3f20ee03 |
File details
Details for the file eventio-1.14.0-cp313-cp313-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp313-cp313-macosx_10_13_x86_64.whl
- Upload date:
- Size: 800.0 kB
- Tags: CPython 3.13, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 882a836dec333fc07a1ebf8f44fdaafaf809ce7a16a737ac9445a6cc9d366be8 |
|
MD5 | eaf794edb7933620a41561bd2167114a |
|
BLAKE2b-256 | 2d7d8650a7f5414cd68d6b2c22cd656c9a50a66823819f5716e843ee02228dca |
File details
Details for the file eventio-1.14.0-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 286.8 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f0d4c5aa850ad365606aaac4be41dc745d6b69f314e23e7b32e59ee295a2205 |
|
MD5 | e011051d870df295ede543ab3785e892 |
|
BLAKE2b-256 | a88a02182545094bdb8398eb95ee73c4d5a7e43c3fe11b1d64406c9da1e8e074 |
File details
Details for the file eventio-1.14.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8694fc7ee17282d254676316d645dd44f2ff8cea52b22203d13e88561ed73303 |
|
MD5 | 4ac1ab35f40bf40f06847f2d338bb909 |
|
BLAKE2b-256 | cf3cec9c225d3575d0b6e093f7667289c02cea3592f4e084bf2dcfefc1ce7ad8 |
File details
Details for the file eventio-1.14.0-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 785.7 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df02a8468b98d7c60f11211a15576a4e6c2ed56b2d1ef26f6591c5197a18cba2 |
|
MD5 | 10bc439795706ec3e7340107c6c50e46 |
|
BLAKE2b-256 | d13ff6dfd876fb9be254a2b7dbc2fb6c18d0ee013945c5009b60d3f5f1120030 |
File details
Details for the file eventio-1.14.0-cp312-cp312-macosx_10_13_x86_64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp312-cp312-macosx_10_13_x86_64.whl
- Upload date:
- Size: 803.1 kB
- Tags: CPython 3.12, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1c033a0f67c316012d9c803d0c54232d0992b6350c214ac233308e219fa9959 |
|
MD5 | e55f0575b77f509da9db7921e5c5dfed |
|
BLAKE2b-256 | 57ca42f4e43629f2b374f711b78f3e85695090fea1bbaec715d1ccb45ffb43d4 |
File details
Details for the file eventio-1.14.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 284.3 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f26653852b21da509f97e29c651da7db26a4b595d9e02c9c7d860cbda90a335e |
|
MD5 | 345ef767d7bd7ea24abc59db7985e625 |
|
BLAKE2b-256 | 9f72fffd04da5eac3e1c87db3a2af5900b52455bac5531c4b8539cdb8a0ca995 |
File details
Details for the file eventio-1.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3201040cd1ac4c161edb6abe52c068d86e5e30cd5beced87740cc1c6f0641579 |
|
MD5 | b36939a43629d0ae93e18204a68648b1 |
|
BLAKE2b-256 | 53cec9fab5f6c81d772d17bcf1278e25492f82a98ec76339613c2512ce930643 |
File details
Details for the file eventio-1.14.0-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 781.8 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0680cd06984d141b43883a338d8736cfc1ef909b08b17017b8cb59fa8eda48f4 |
|
MD5 | dc479f350f90619af7977dd809383c0c |
|
BLAKE2b-256 | f1d567bc6ec79338c30de9a2915184f04a9df7228ead9ce20d255cdd08395429 |
File details
Details for the file eventio-1.14.0-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 797.8 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15910c7e329e32222ca6807763cb90d07ad1d2cde2a98b98665c1a2ae24a6624 |
|
MD5 | 0c5ccda1ab80b1a4430dc6013b862316 |
|
BLAKE2b-256 | 645655f7a05c065712a652e6497fd2e0041df263438c2fccb53f1d7809df7f77 |
File details
Details for the file eventio-1.14.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 284.0 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e3c7d05328d2628d5c44e2c63df04814cbdca0b532204305bfbec19d3a54469 |
|
MD5 | 1fdc0fadf715075e1aac452d508c1ff1 |
|
BLAKE2b-256 | 851ab324968ef58782729496ac5deb02d8a2596a1a508139b003971693a53e9a |
File details
Details for the file eventio-1.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e025a2fd8169d248c7c0f5c670179cf8f02e1e74d4eb95b00319da3a7368d4ef |
|
MD5 | 85ef490cdebf38a1304d21fb66784255 |
|
BLAKE2b-256 | a66debec8bb62c4e83e07591a8a276c03044b34f2a4338690d624ea03b71366c |
File details
Details for the file eventio-1.14.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 781.9 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05579658480570bc39b12b9fdf32d6e31876d10dd8f761121774265597e456f3 |
|
MD5 | 1b91ecc4ebab2c331aab611707551871 |
|
BLAKE2b-256 | be9b320e534fc8385fca1748abab499e979c19cdbef786427ead6207dcd426e7 |
File details
Details for the file eventio-1.14.0-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: eventio-1.14.0-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 797.4 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2e5c8a4f705efa3038cb21f042952263a9697ec547143d5a33033c4f8277d47 |
|
MD5 | 5844d80f90265edb12fbb0d69896d8f8 |
|
BLAKE2b-256 | 85949d95adc7a046f85c4ba5d48a77c6d4855e87186ca2860a1cfd93a25caa1b |