SimTelEventSource

class ctapipe.io.simteleventsource.SimTelEventSource(input_url=traitlets.Undefined, config=None, parent=None, **kwargs)[source]

Bases: ctapipe.io.eventsource.EventSource

Read events from a SimTelArray data file (in EventIO format).

ctapipe makes use of the sim_telarray metadata system to fill some information not directly accessible from the data inside the files itself. Make sure you set this parameters in the simulation configuration to fully make use of ctapipe. In future, ctapipe might require these metadata parameters.

This includes:

  • Reference Point of the telescope coordinates. Make sure to include the

    user-defined parameters LONGITUDE and LATITUDE with the geodetic coordinates of the array reference point. Also make sure the ALTITUDE config parameter is included in the global metadata.

  • Names of the optical structures and the cameras are read from

    OPTICS_CONFIG_NAME and CAMERA_CONFIG_NAME, make sure to include these in the telescope meta.

  • The MIRROR_CLASS should also be included in the telescope meta

    to correctly setup coordinate transforms.

If these parameters are not included in the input data, ctapipe will fallback guesses these based on avaible data and the list of known telescopes for ctapipe.instrument.guess_telescope.

Attributes Summary

back_seekable

A boolean (True, False) trait.

calib_scale

A float trait.

calib_shift

A float trait.

datalevels

The datalevels provided by this event source

focal_length_choice

Use a Enum class as model for the data type description.

gain_selector_type

An enum of strings where the case should be ignored.

is_simulation

Whether the currently opened file is simulated

is_stream

Bool indicating if input is a stream.

observation_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

scheduling_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

simulation_config

The simulation configurations of all observations provided by the EventSource, or None if the source does not provide simulated data

skip_calibration_events

A boolean (True, False) trait.

subarray

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.

prepare_subarray_info(…)

Constructs a SubarrayDescription object from the telescope_descriptions given by SimTelFile

Attributes Documentation

back_seekable

A boolean (True, False) trait.

calib_scale

A float trait.

calib_shift

A float trait.

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
gain_selector_type

An enum of strings where the case should be ignored.

is_simulation
is_stream
observation_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

scheduling_blocks

Obtain the ObservationConfigurations from the EventSource, indexed by obs_id

simulation_config
skip_calibration_events

A boolean (True, False) trait.

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

prepare_subarray_info(telescope_descriptions, header)[source]

Constructs a SubarrayDescription object from the telescope_descriptions given by SimTelFile

Parameters
telescope_descriptions: dict

telescope descriptions as given by SimTelFile.telescope_descriptions

header: dict

header as returned by SimTelFile.header

Returns
SubarrayDescription

instrumental information