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
Hashes for eventio-1.13.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c20d206597f8349c93886cc2e12fe11bacc4125a92318ef8e09daaf9fb043214 |
|
MD5 | 32fb2a3117f32d21cc61056f71659042 |
|
BLAKE2b-256 | 41496c2ea2b7bde7ef68b29224e8e146c21787dac27a178d44cfb44b6b337ac6 |
Hashes for eventio-1.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c744a6303862d89735009d0d08e39784a0d78990bce62cd347f0c9c1ff9c25 |
|
MD5 | 297dafb1c5685c43133aa54732a01b39 |
|
BLAKE2b-256 | 122edc5675d1047f1e696cc4821db0b237052c82ec757b95876bc6e392d57590 |
Hashes for eventio-1.13.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b26fd8bd7bd5b18605fdaa6b7693136d1923e30adab10039b3cfaa17ac73030e |
|
MD5 | d4f992ddbbc9da18216bbdfba856602e |
|
BLAKE2b-256 | 627af1dea7ad0f18766189cddb3a39f007b699e1ca22f672a58de4f6fd611cee |
Hashes for eventio-1.13.0-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6bad395a19de94d4fe939bb05e826470736f8ad4efd5f4dacc8e62e214611d6 |
|
MD5 | ad6a692864f0ac1f6eac768d6b36920e |
|
BLAKE2b-256 | ddc992de4f2e1280952d1f26b4e5eb149f56e46f9b303c78ee7df78141bc772e |
Hashes for eventio-1.13.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f770a9461dff59317ff252c8c07a9e6f272c03707b50a3e23e360fe91ebada3 |
|
MD5 | 5fa283302913c062bd792e37a22bf621 |
|
BLAKE2b-256 | b9759ec62bed805d7c8297f2b84dda99f08f30b17f6c146923950f2e5140e027 |
Hashes for eventio-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c4fa82842a968b753a14c1027694a535023bd94b52892e83e7db87a7b68d996 |
|
MD5 | bd6dfa40947062fc9e0ef77aa85e1e15 |
|
BLAKE2b-256 | f1d74d2bc9a0ef727c3c1eb93a5af910642d15b4fa223dfb02888bd0d41c75c7 |
Hashes for eventio-1.13.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b29cba2aa98c6ba26e61bf29f0f6fbe9a0831b46cb03fea059d88951a08ff5c |
|
MD5 | 31c8bfe26f9ee60c391469a0fc4cf329 |
|
BLAKE2b-256 | a8a3259d6dca28eb3df8886e91c6dad459808fcaf423e59b791363a3b50eee64 |
Hashes for eventio-1.13.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49f6a7c6892c192093cbdeae076a431d7f2d543db558aac24c643e5b1b825a40 |
|
MD5 | aeb5e5972c9dae3ac5991853d3d47171 |
|
BLAKE2b-256 | 2f027453b225b2238acee857ad13db38488020d197b5539773d2f902f0049114 |
Hashes for eventio-1.13.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3ba05551f38274ed36206d0b85ff13a860fabec52ad55e3838f2467104de066 |
|
MD5 | df136318f8271f1291efe1613e622de2 |
|
BLAKE2b-256 | 58ffbf84fdf7a710b2d869a1c30c2f9d8f84d52789aa00839d14df06176e50d6 |
Hashes for eventio-1.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f050a1a83503020f8fa66c68f2c7c94463703d28877fb5276927a334f5dbdea |
|
MD5 | 7b7ddab11aceec55680306c8f6b0f24e |
|
BLAKE2b-256 | 6252cc7cc18ce2ec46a5d3a36b897bf967193da3e953f6ce8ee53fde8b27ae57 |
Hashes for eventio-1.13.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a910bd000c436d33f8ef0d24e8cf9c5b2951402516fd3ea1727e3d6c44851a35 |
|
MD5 | ff672fced85d5db4e0af1b1945a2a59a |
|
BLAKE2b-256 | b9ec365844cb29cc19da313c70a3d5a71699061f7c73976e30373ac6021383df |
Hashes for eventio-1.13.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09ecc39073e3a7048e18d10a0d797986fcdd3d6f4c14fb494978d0acb0d78b92 |
|
MD5 | e87f9ec488287e1b345d02466d828af9 |
|
BLAKE2b-256 | f480150bea73435e79245fe106e70b038dd4e911b45c571688d00c2cf18b32d6 |
Hashes for eventio-1.13.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea14cc36bfd94375dd2b61f07e450aff8c598e9dd0a6fa6ffc778a144cbca287 |
|
MD5 | 189e911930e46a04d334f64826643865 |
|
BLAKE2b-256 | 53fc4e8af355aece977d5e01a2a8d417ebb0713484d51f7c5bfa94867d3bd9e5 |
Hashes for eventio-1.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 433c1d84257e2ba31f1849b2a715fff8daced559a02724385e88d63ed14acc2c |
|
MD5 | 3fe43ebadf748f8991681a7cd2dbfd03 |
|
BLAKE2b-256 | 98cb6f35f1fff82fd1013a2772f9bdd23488c2b6918c2baf4c436c913b148e58 |
Hashes for eventio-1.13.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 515eae7ca0f5a244959ce7c8f06e4e1ebb337a4c17ff786bf99d6a6d9380328c |
|
MD5 | cc73a29fa75bae5ea125627c838c0972 |
|
BLAKE2b-256 | fb2a4f5f7f69b5ab1b756a5330d09c6c2eaf3d7afc8d4c486f3e4484e10b59ef |
Hashes for eventio-1.13.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac6ea8f99b12a95e9ec961e4748dbf7296f65834f9daaf3e3f637aa144074a13 |
|
MD5 | 141559bc008748f4c7f3190141b3d09f |
|
BLAKE2b-256 | 20960caebd695f34b65ad7873e0b3ba935838f1934e30baf2b0c1ddd715cf7de |