TableLoader

class ctapipe.io.TableLoader(**kwargs: Any)[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:

Attributes
subarraySubarrayDescription

The subarray as read from input_url.

Attributes Summary

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 ctapipe.instrument.SubarrayDescription, which will be used in CameraFrame to TelescopeFrame coordinate transforms.

input_url

A path Trait for input/output files.

load_dl1_images

load extracted images

load_dl1_muons

load muon ring parameters

load_dl1_parameters

load reconstructed image parameters

load_dl2

load available dl2 stereo parameters

load_instrument

join subarray instrument information to each event

load_observation_info

join observation information to each event

load_simulated

load simulated shower information

load_true_images

load simulated shower images

load_true_parameters

load image parameters obtained from true images

Methods Summary

close()

Close the underlying hdf5 file

read_observation_information()

Read the observation information

read_shower_distribution()

Read the simulated shower distribution histograms

read_simulation_configuration()

Read the simulation configuration table

read_subarray_events([start, stop, keep_order])

Read subarray-based event information.

read_subarray_events_chunked(chunk_size, …)

Iterate over chunks of subarray events.

read_telescope_events([telescopes, start, stop])

Read telescope-based event information.

read_telescope_events_by_id([telescopes, …])

Read telescope-based event information.

read_telescope_events_by_id_chunked(…)

Iterate over chunks of telescope events and return a dict of one table per telescope id.

read_telescope_events_by_type([telescopes, …])

Read telescope-based event information.

read_telescope_events_by_type_chunked(…)

Iterate over chunks of telescope events as dicts of telescope type to tables.

read_telescope_events_chunked(chunk_size, …)

Iterate over chunks of telescope events.

Attributes Documentation

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 ctapipe.instrument.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

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

load extracted images

load_dl1_muons

load muon ring parameters

load_dl1_parameters

load reconstructed image parameters

load_dl2

load available dl2 stereo parameters

load_instrument

join subarray instrument information to each event

load_observation_info

join observation information to each event

load_simulated

load simulated shower information

load_true_images

load simulated shower images

load_true_parameters

load image parameters obtained from true images

Methods Documentation

close()[source]

Close the underlying hdf5 file

read_observation_information()[source]

Read the observation information

read_shower_distribution()[source]

Read the simulated shower distribution histograms

read_simulation_configuration()[source]

Read the simulation configuration table

read_subarray_events(start=None, stop=None, keep_order=True)[source]

Read subarray-based event information.

Returns
table: astropy.io.Table

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

read_subarray_events_chunked(chunk_size, *args, **kwargs)[source]

Iterate over chunks of subarray events.

Parameters
chunk_size: int

Number of subarray events to load per chunk

read_telescope_events(telescopes=None, start=None, stop=None)[source]

Read telescope-based event information.

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

The start, stop parameters enable to only load parts of the file, note however, to maintain integrity of subarray events, these refer to the subarray indices in the file. E.g. start=0, stop=10 would load the telescope events corresponding to the first 10 subarray events in the input file.

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.

start: int

First subarray event to read

stop: int

Last subarray event (non-inclusive)

Returns
events: astropy.io.Table

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

read_telescope_events_by_id(telescopes=None, start=None, stop=None)Dict[int, 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 ids Table with primary index columns “obs_id”, “event_id” and “tel_id”.

read_telescope_events_by_id_chunked(chunk_size, *args, **kwargs)[source]

Iterate over chunks of telescope events and return a dict of one table per telescope id.

Parameters
chunk_size: int

Number of subarray events to load per chunk. The telescope tables might be larger or smaller than chunk_size depending on the selected telescopes.

*args, **kwargs are passed to `read_telescope_events_by_id`
read_telescope_events_by_type(telescopes=None, start=None, stop=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”.

read_telescope_events_by_type_chunked(chunk_size, *args, **kwargs)[source]

Iterate over chunks of telescope events as dicts of telescope type to tables.

Parameters
chunk_size: int

Number of subarray events to load per chunk. The telescope tables might be larger or smaller than chunk_size depending on the selected telescopes.

**kwargs are passed to `read_telescope_events`
read_telescope_events_chunked(chunk_size, *args, **kwargs)[source]

Iterate over chunks of telescope events.

Parameters
chunk_size: int

Number of subarray events to load per chunk. The telescope tables might be larger or smaller than chunk_size depending on the selected telescopes.

**kwargs are passed to `read_telescope_events`