Observables Module
Provides functions to calculate various observables from shower data and to add them to shower data files. This can be useful for analyzing the fidelity of generative shower models or for training two-stage models (e.g. layer-wise properties first, then point clouds).
- showerdata.observables.compute_threshold_mask(showers, detector_config=None)[source]
Compute a mask for the shower points based on detector thresholds.
- showerdata.observables.calc_num_points_per_layer(showers, num_layers=-1, detector_config=None)[source]
Calculate the number of points per layer for each shower.
- Parameters:
- Returns:
- A 2D array of shape (num_showers, num_layers) containing the number of
points per layer for each shower.
- Return type:
- showerdata.observables.calc_energy_per_layer(showers, num_layers=-1, detector_config=None)[source]
Calculate the total energy per layer for each shower.
- showerdata.observables.calc_energy_per_radial_bin(showers, bin_edges=None, detector_config=None)[source]
Calculate the total energy per radial bin for each shower.
- Parameters:
- Returns:
- A 2D array of shape (num_showers, num_bins) containing the total energy
per radial bin for each shower.
- Return type:
- showerdata.observables.calc_center_of_energy(showers, detector_config=None)[source]
Calculate the center of energy for each shower.
- class showerdata.observables.ObservableInfo(key, shape, dtype, function)[source]
Bases:
object- dtype: DTypeLike
- showerdata.observables.add_observables_to_file(path, batch_size=1000, overwrite=False, detector_config=None)[source]
Calculate and add observables to an existing HDF5 file containing shower data.
- showerdata.observables.save_observables_to_file(path, observables, overwrite=False)[source]
Save observables to an HDF5 file.
- showerdata.observables.read_observables_from_file(path, observables=None, start=0, stop=None)[source]
Read observables from an HDF5 file. The default observables are:
num_points_per_layer
energy_per_layer
energy_per_radial_bin
center_of_energy
total_energy
total_num_points
incident_energies
incident_pdg
incident_directions
shower_ids
- Parameters:
- Returns:
A dictionary containing the observables.
- Return type:
- showerdata.observables.read_point_energies(path, start=0, stop=None)[source]
Read point energies from an HDF5 file.
- Parameters:
- Returns:
- A 1D array containing the point energies of all showers in the
specified range.
- Return type:
- showerdata.observables.save(path, observables, overwrite=False)
Alias for
save_observables_to_file().- Return type:
- showerdata.observables.load(path, observables=None, start=0, stop=None)
Alias for
read_observables_from_file().