ctapipe is not stable yet, so expect large and rapid changes to structure and functionality as we explore various design choices before the 1.0 release.

TableLoader#

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

Bases: 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

dl1_images

load extracted images

dl1_muons

load muon ring parameters

dl1_parameters

load reconstructed image parameters

dl2

load available dl2 stereo parameters

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.

instrument

join subarray instrument information to each event

observation_info

join observation information to each event

pointing

Load pointing information and interpolate / join to events

simulated

load simulated shower information

true_images

load simulated shower images

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, dl2, ...])

Read subarray-based event information.

read_subarray_events_chunked(chunk_size, ...)

Iterate over chunks of subarray events.

read_telescope_events([telescopes, start, ...])

Read telescope-based event information.

read_telescope_events_by_id([telescopes, ...])

Read subarray-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 subarray-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

dl1_images#

load extracted images

dl1_muons#

load muon ring parameters

dl1_parameters#

load reconstructed image parameters

dl2#

load available dl2 stereo parameters

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

instrument#

join subarray instrument information to each event

observation_info#

join observation information to each event

pointing#

Load pointing information and interpolate / join to events

simulated#

load simulated shower information

true_images#

load simulated shower images

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, dl2=None, simulated=None, observation_info=None, keep_order=True)[source]#

Read subarray-based event information.

Parameters:
dl2: bool

load available dl2 stereo parameters

simulated: bool

load simulated shower information

observation_info: bool

join observation information to each event

start: int

First subarray event to read

stop: int

Last subarray event (non-inclusive)

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, dl1_images=None, dl1_parameters=None, dl1_muons=None, dl2=None, simulated=None, true_images=None, true_parameters=None, instrument=None, observation_info=None, pointing=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)

dl1_images: bool

load extracted images

dl1_parameters: bool

load reconstructed image parameters

dl1_muons: bool

load muon ring parameters

dl2: bool

load available dl2 stereo parameters

simulated: bool

load simulated shower information

true_images: bool

load simulated shower images

true_parameters: bool

load image parameters obtained from true images

instrument: bool

join subarray instrument information to each event

observation_info: bool

join observation information to each event

pointing: bool

join pointing information to each event

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, dl1_images=None, dl1_parameters=None, dl1_muons=None, dl2=None, simulated=None, true_images=None, true_parameters=None, instrument=None, observation_info=None, pointing=None) dict[int, Table][source]#

Read subarray-based event information.

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

Any list containing a combination of telescope IDs or telescope_descriptions.

dl1_images: bool

load extracted images

dl1_parameters: bool

load reconstructed image parameters

dl1_muons: bool

load muon ring parameters

dl2: bool

load available dl2 stereo parameters

simulated: bool

load simulated shower information

true_images: bool

load simulated shower images

true_parameters: bool

load image parameters obtained from true images

instrument: bool

join subarray instrument information to each event

observation_info: bool

join observation information to each event

pointing: bool

join pointing information to each event

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, dl1_images=None, dl1_parameters=None, dl1_muons=None, dl2=None, simulated=None, true_images=None, true_parameters=None, instrument=None, observation_info=None, pointing=None) dict[str, Table][source]#

Read subarray-based event information.

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

Any list containing a combination of telescope IDs or telescope_descriptions.

dl1_images: bool

load extracted images

dl1_parameters: bool

load reconstructed image parameters

dl1_muons: bool

load muon ring parameters

dl2: bool

load available dl2 stereo parameters

simulated: bool

load simulated shower information

true_images: bool

load simulated shower images

true_parameters: bool

load image parameters obtained from true images

instrument: bool

join subarray instrument information to each event

observation_info: bool

join observation information to each event

pointing: bool

join pointing information to each event

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`