HDF5EventSource

class ctapipe.io.hdf5eventsource.HDF5EventSource(input_url=traitlets.Undefined, config=None, parent=None, **kwargs)[source]

Bases: ctapipe.io.eventsource.EventSource

Event source for files in the ctapipe DL1 format. For general information about the concept of event sources, take a look at the parent class ctapipe.io.EventSource.

To use this event source, create an instance of this class specifying the file to be read.

Looping over the EventSource yields events from the _generate_events method. An event equals an ArrayEventContainer instance. See ctapipe.containers.ArrayEventContainer for details.

Attributes
input_url: str

Path to the input event file.

file: tables.File

File object

obs_ids: list

Observation ids of te recorded runs. For unmerged files, this should only contain a single number.

subarray: ctapipe.instrument.SubarrayDescription

The subarray configuration of the recorded run.

datalevels: Tuple

One or both of ctapipe.io.datalevels.DataLevel.DL1_IMAGES and ctapipe.io.datalevels.DataLevel.DL1_PARAMETERS depending on the information present in the file.

is_simulation: Boolean

Whether the events are simulated or observed.

simulation_configs: Dict

Mapping of obs_id to ctapipe.containers.SimulationConfigContainer if the file contains simulated events.

has_simulated_dl1: Boolean

Whether the file contains simulated camera images and/or image parameters evaluated on these.

Attributes Summary

atmosphere_density_profile

atmosphere density profile that can be integrated to convert between h_max and X_max.

datalevels

The datalevels provided by this event source

focal_length_choice

If both nominal and effective focal lengths are available, which one to use for the CameraFrame attached to the CameraGeometry instances in the SubarrayDescription which will be used in CameraFrame to TelescopeFrame coordinate transforms.

has_muon_parameters

True for files that contain muon parameters

has_simulated_dl1

True for files with telescope-wise event information in the simulation group

is_simulation

True for files with a simulation group at the root of the file.

obs_ids

The observation ids of the runs located in the file Unmerged files should only contain a single obs id.

observation_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

scheduling_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

simulation_config

Returns the simulation config(s) as a dict mapping obs_id to the respective config.

subarray

Obtain the subarray from the EventSource

Methods Summary

close()

Close this event source.

is_compatible(file_path)

Abstract method to be defined in child class.

Attributes Documentation

atmosphere_density_profile
datalevels
focal_length_choice

If both nominal and effective focal lengths are available, which one to use for the CameraFrame attached to the CameraGeometry instances in the SubarrayDescription which will be used in CameraFrame to TelescopeFrame coordinate transforms. The ‘nominal’ focal length is the one used during the simulation, the ‘effective’ focal length is computed using specialized ray-tracing from a point light source

has_muon_parameters

True for files that contain muon parameters

has_simulated_dl1

True for files with telescope-wise event information in the simulation group

is_simulation

True for files with a simulation group at the root of the file.

obs_ids
observation_blocks
scheduling_blocks
simulation_config

Returns the simulation config(s) as a dict mapping obs_id to the respective config.

subarray

Methods Documentation

close()[source]

Close this event source.

No-op by default. Should be overriden by sources needing a cleanup-step

static is_compatible(file_path)[source]

Abstract method to be defined in child class.

Perform a set of checks to see if the input file is compatible with this file event_source.

Parameters
file_pathstr

File path to the event file.

Returns
compatiblebool

True if file is compatible, False if it is incompatible