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
The datalevels provided by this event source
Use a Enum class as model for the data type description.
True for files with telescope-wise event information in the simulation group
True for files with a simulation group at the root of the file.
The observation ids of the runs located in the file Unmerged files should only contain a single obs id.
Obtain the ObservationConfigurations from the EventSource, indexed by obs_id
Obtain the ObservationConfigurations from the EventSource, indexed by obs_id
Returns the simulation config(s) as a dict mapping obs_id to the respective config.
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
-
datalevels
¶
-
focal_length_choice
¶ Use a Enum class as model for the data type description. Note that if no default-value is provided, the first enum-value is used as default-value.
# -- SINCE: Python 3.4 (or install backport: pip install enum34) import enum from traitlets import HasTraits, UseEnum class Color(enum.Enum): red = 1 # -- IMPLICIT: default_value blue = 2 green = 3 class MyEntity(HasTraits): color = UseEnum(Color, default_value=Color.blue) entity = MyEntity(color=Color.red) entity.color = Color.green # USE: Enum-value (preferred) entity.color = "green" # USE: name (as string) entity.color = "Color.green" # USE: scoped-name (as string) entity.color = 3 # USE: number (as int) assert entity.color is Color.green
-
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