TableLoader

class ctapipe.io.tableloader.TableLoader(**kwargs)[source]

Bases: ctapipe.core.component.Component

Load telescope-event or subarray-event data from ctapipe HDF5 files

This class provides high-level access to data stored in ctapipe HDF5 files, such as created by the ctapipe-process tool (ProcessorTool).

The following TableLoader methods load data from all relevant tables, depending on the options, and joins them into single tables: * TableLoader.read_subarray_events * TableLoader.read_telescope_events

TableLoader.read_telescope_events_by_type retuns a dict with a table per telescope type, which is needed for e.g. DL1 image data that might have different shapes for each of the telescope types as tables do not support variable length columns.

Attributes Summary

input_url

A path Trait for input/output files.

load_dl1_images

A boolean (True, False) trait.

load_dl1_parameters

A boolean (True, False) trait.

load_dl2_geometry

A boolean (True, False) trait.

load_instrument

A boolean (True, False) trait.

load_simulated

A boolean (True, False) trait.

load_trigger

A boolean (True, False) trait.

load_true_images

A boolean (True, False) trait.

load_true_parameters

A boolean (True, False) trait.

Methods Summary

close()

Close the underlying hdf5 file

read_subarray_events()

Read subarray-based event information.

read_telescope_events([telescopes])

Read telescope-based event information.

read_telescope_events_by_type([telescopes])

Read telescope-based event information.

Attributes Documentation

input_url

A path Trait for input/output files.

Attributes
exists: boolean or None

If True, path must exist, if False path must not exist

directory_ok: boolean

If False, path must not be a directory

file_ok: boolean

If False, path must not be a file

load_dl1_images

A boolean (True, False) trait.

load_dl1_parameters

A boolean (True, False) trait.

load_dl2_geometry

A boolean (True, False) trait.

load_instrument

A boolean (True, False) trait.

load_simulated

A boolean (True, False) trait.

load_trigger

A boolean (True, False) trait.

load_true_images

A boolean (True, False) trait.

load_true_parameters

A boolean (True, False) trait.

Methods Documentation

close()[source]

Close the underlying hdf5 file

read_subarray_events()[source]

Read subarray-based event information.

Returns
table: astropy.io.Table

Table with primary index columns “obs_id” and “event_id”.

read_telescope_events(telescopes=None)[source]

Read telescope-based event information.

If the corresponding traitlets are True, also subarray event information is joined onto the table.

Parameters
telescopes: Optional[List[Union[int, str, TelescopeDescription]]]

A list containing any combination of telescope IDs and/or telescope descriptions. If None, all available telescopes are read.

Returns
events: astropy.io.Table

Table with primary index columns “obs_id”, “event_id” and “tel_id”.

read_telescope_events_by_type(telescopes=None)Dict[str, astropy.table.table.Table][source]

Read telescope-based event information.

Parameters
telescopes: List[Union[int, str, TelescopeDescription]]

Any list containing a combination of telescope IDs or telescope_descriptions.

Returns
tables: dict(astropy.io.Table)

Dictionary of tables organized by telescope types Table with primary index columns “obs_id”, “event_id” and “tel_id”.