Create an overview of CORSIKA simulations

Generate an overview table of the CORSIKA simulations

This script will look for all completed and converted CORSIKA simulations in the given data path. Information about each simulation is collected and then summarized in a new h5 file as an overview.

The given source path should contain subdirectories named after the seeds used for the simulation in the format {seed1}_{seed2}, e.g. 821280921_182096636. These in turn should contain converted CORSIKA simulation results called corsika.h5.

sapphire.corsika.generate_corsika_overview.write_row(table, seeds, header, end)

Write the information of one simulation into a row

Parameters:
  • table – the table where the new data should be appended.
  • seeds – the unique id consisting of the two seeds.
  • header,end – the event header and end for the simulation.
sapphire.corsika.generate_corsika_overview.read_seeds(simulations_table, source, seeds)

Read the header and end of a simulation and write to overview.

Parameters:
  • simulations_table – PyTables table in which the simulation overview is stored.
  • source – directory containing the CORSIKA simulations.
  • seeds – directory name of a simulation, format: ‘{seed1}_{seed2}’.
sapphire.corsika.generate_corsika_overview.get_simulations(source, simulations, overview, progress=False)

Get the information of the simulations and create a table.

sapphire.corsika.generate_corsika_overview.prepare_output(n)

Create a temporary file in which to store the overview

Parameters:n – the number of simulations, i.e. expected number of rows.
Returns:path to the temporary file and a PyTables handler for the file.
sapphire.corsika.generate_corsika_overview.create_tempfile_path()
sapphire.corsika.generate_corsika_overview.move_tempfile_to_destination(tmp_path, destination)
sapphire.corsika.generate_corsika_overview.all_seeds(source)

Get set of all seeds in the corsika data directory

sapphire.corsika.generate_corsika_overview.generate_corsika_overview(source, destination, progress=False)

Create an overview of CORSIKA simulations for use by CorsikaQuery

Parameters:
  • source – directory containing the CORSIKA simulations.
  • destination – path of the HDF5 output file.
  • progress – if True show a progressbar while processing simulations.
sapphire.corsika.generate_corsika_overview.main()