Store CORSIKA data as HDF5

Store CORSIKA simulation data in HDF5 file

This module reads the CORSIKA binary ground particles file and stores each particle individually in a HDF5 file, using PyTables. This file can then be used as input for the detector simulation.

The syntax and options for calling this script can be seen with:

$ store_corsika_data --help

For example to convert a CORSIKA file in the current directory called DAT000000 to a HDF5 called corsika.h5 with a progress bar run:

$ store_corsika_data --progress DAT000000 corsika.h5
sapphire.corsika.store_corsika_data.save_particle(row, p)

Write the information of a particle into a row

sapphire.corsika.store_corsika_data.save_thinned_particle(row, p)

Write the information of a thinned particle into a row

sapphire.corsika.store_corsika_data.store_and_sort_corsika_data(source, destination, overwrite=False, progress=False, thin=False)

First convert the data to HDF5 and create a sorted version

sapphire.corsika.store_corsika_data.store_corsika_data(source, destination, table_name='groundparticles', progress=False, thin=False)

Store particles from a CORSIKA simulation in a HDF5 file

  • source – CorsikaFile instance of the source DAT file.
  • destination – PyTables file instance of the destination file.
  • table_name – table name in which particles are stored.
  • progress – if True show progressbar when saving particles.
  • thin – if True assume the data contains thinned particles.
sapphire.corsika.store_corsika_data.create_index(hdf_data, table_name='groundparticles', progress=False)

Create a completely sorted index for the x column

This can speed up queries to select data based on the x column.

sapphire.corsika.store_corsika_data.copy_and_sort_node(hdf_temp, hdf_data, table_name='groundparticles', progress=False)

Sort the data in the tables by the x column

This speeds up queries to select data based on the x column.


Create a temporary file, close it, and return the path