DL2EventLoader#
- class ctapipe.io.DL2EventLoader(**kwargs: Any)[source]#
 Bases:
ComponentComponent for loading events and simulation metadata, applying preselection and optional derived column logic.
Attributes Summary
Function of TableLoader used to read event chunks.
Extra keyword arguments passed to the event reading function, e.g., {'path': '/dl2/event/telescope/Reconstructor'}
Methods Summary
get_simulation_information(loader, obs_time)Extract simulation information from the input file.
load_preselected_events(chunk_size, obs_time)Load and filter events from the file.
make_derived_columns(events)Add derived quantities (e.g., theta, FOV offsets) to the table.
make_event_weights(events, spectrum, kind[, ...])Compute event weights to match the target spectrum.
Attributes Documentation
- classes = [<class 'ctapipe.io.dl2_tables_preprocessing.DL2EventPreprocessor'>]#
 
- event_reader_function#
 Function of TableLoader used to read event chunks. E.g., ‘read_subarray_events_chunked’ or ‘read_telescope_events_chunked’.
- event_reader_kwargs#
 Extra keyword arguments passed to the event reading function, e.g., {‘path’: ‘/dl2/event/telescope/Reconstructor’}
Methods Documentation
- get_simulation_information(loader: TableLoader, obs_time: Quantity) tuple[SimulatedEventsInfo, PowerLaw][source]#
 Extract simulation information from the input file.
- Parameters:
 - loaderTableLoader
 Loader object for reading from the input file.
- obs_timeQuantity
 Total observation time.
- Returns:
 - sim_infoSimulatedEventsInfo
 Metadata about the simulated events.
- spectrumPowerLaw
 Power-law model derived from simulation configuration.
- Raises:
 - NotImplementedError
 If simulation parameters vary across runs.
- load_preselected_events(chunk_size: int, obs_time: Quantity) tuple[QTable, int, dict][source]#
 Load and filter events from the file.
- Parameters:
 - chunk_sizeint
 Size of chunks to read from the file.
- obs_timeQuantity
 Observation time to scale weights.
- Returns:
 - tableQTable
 Filtered and processed event table.
- n_raw_eventsint
 Number of events before selection.
- metadict
 Metadata dictionary with simulation info and input spectrum.
- make_derived_columns(events: QTable) QTable[source]#
 Add derived quantities (e.g., theta, FOV offsets) to the table.
- Parameters:
 - eventsQTable
 Table containing normalized events.
- Returns:
 - QTable
 Table with added derived columns.
- make_event_weights(events: QTable, spectrum: PowerLaw, kind: str, fov_offset_bins: Quantity | None = None) QTable[source]#
 Compute event weights to match the target spectrum.
- Parameters:
 - eventsQTable
 Input events.
- spectrumPowerLaw
 Spectrum from simulation.
- kindstr
 Type of events (“gammas”, etc.).
- fov_offset_binsQuantity, optional
 Offset bins for integrating the diffuse flux into point source bins.
- Returns:
 - QTable
 Table with updated weights.
- Raises:
 - ValueError
 If
fov_offset_binsis required but not provided.