Event reconstruction (protopipe.pipeline)#


protopipe.pipeline contains classes that are used in scripts to produce,

  • tables with images information (DL1), typically for g/h classifier and energy regressor,

  • tables with event information, typically used for performance estimation (DL2).

Two classes from the sub-module are used to process the events:

  • EventPreparer, which loops on events and to provide event parameters (e.g. impact parameter) and image parameters (e.g. Hillas parameters),

  • ImageCleaner, cleans the images according to different options.



The version of ctapipe used by protopipe is always the last stable version packaged on the Anaconda framework. This means that some of the more cutting-edge code needs to be hard-coded. This code should always be stored in protopipe.pipeline.temp and disappear at each newer release of ctapipe.

The following is a description of the default algorithms and settings, chosen to mimic the CTA-MARS pipeline.

Management of events, triggers and images#

  • for each event ALL images from ALL telescopes are processed up to DL1b included,

  • to define what happens after DL1b, the Reconstruction section of the analysis.yaml configuration file accepts two options,

    • LST_stereo, trigger requirement (at least 2 LST images - True by default)

    • min_tel, minimum number of telescopes from ANY telescope type to consider events,

In case LST_stereo is set to True, events with,

  • 1 LST trigger and less than 2 triggers from any other telescope type will not be processed after DL1b,

  • 1 LST trigger and at least 2 triggers from any other telescope type will get processed at DL2a without the single-LST image and provided the remaining images are still at least 2 after the image quality cuts have been taken into consideration.


The current calibration is performed using:

  • automatic gain channel selection (when more than one) above 4000 ADC counts at RO level,

  • charge and pulse times extraction via ctapipe.image.extractors.TwoPassWindowSum,

  • correction for the integration window,

  • each image is labeled with an integer status that describes if its 2nd pass extraction was successful; the default analysis up to DL2 (CTAMARS-like) will use only such images.

Explanation of ``ctapipe.image.extractors.TwoPassWindowSum``

Explanation of ctapipe.image.extractors.TwoPassWindowSum.#


The photoelectron units used later for cleaning the images are those not corrected for the average bias. Said this, thanks to the integration correction this effect is now negligible. For details on how these values are obtained, please refer to the calibration benchmarks (Mandatory checks).


Cleaning is performed using ctapipe.image.cleaning.mars_cleaning_1st_pass, but the settings are user-dependent.


To replicate CTA-MARS behaviour it is sufficient to fix a minimum number of 1 core neighbour while using the cleaning thresholds shown above.

Selection is performed by the following requirements:

  • image extraction status = 1

  • at least 50 phe (still biased units),

  • image’s center of gravity (COG) within 80% of camera radius (radii stored in protopipe.pipeline.utils),

  • ellipticity between 0.1 and 0.6,

  • at least 3 surviving pixels.

Parametrization is performed by ctapipe.image.hillas.hillas_parameters in the ctapipe.coordinates.TelescopeFrame using the effective focal lenghts values stored in protopipe.pipeline.utils.

Direction reconstruction#

Performed via ctapipe.reco.HillasReconstructor with a minimum number of 2 surviving images per event.

The camera corrections correspond to those of ctapipe and are performed inside the reconstructor.


protopipe.pipeline Package#

Classes to process and write events with ctapipe


camera_radius(camid_to_efl[, cam_id])

Get camera radii.


Provide the effective focal length for the required camera.

final_array_to_use(original_array, ...[, ...])

Infer IDs of telescopes and cameras with equivalent focal lengths.

get_camera_names([input_directory, file_name])

Read the names of the cameras.

get_cameras_radii(subarray[, frame, ctamars])

Get the radius of a camera using ctapipe.


Load a YAML configuration file.

load_models(path, cam_id_list)

Load the pickled dictionary of model from disk and fill the model dictionary.


Load object in binary


prod3b_array(file_name, site, array)

Return tel IDs and involved cameras from configuration and simtel file.

prod5N_array(file_name, site, subarray_selection)

Return tel IDs and involved cameras from configuration and simtel file.


Read a TRAINING file and extract the data per telescope type.


Read a TRAINING file and extract the data per telescope type.

save_fig(outdir, name[, fig])

Save a figure in multiple formats.

save_obj(obj, name)

Save object in binary



EventPreparer(config, subarray, ...[, ...])

Class which loop on events and returns results stored in container.

ImageCleaner(config, cameras[, mode])

Class applying image cleaning.


handles ctrl+c signals; set up via signal_handler = SignalHandler() `signal.signal(signal.SIGINT, signal_handler) # or for two step interupt: signal.signal(signal.SIGINT, signal_handler.stop_drawing)


Color definitions for standard and debug printing.



The central part of internal API.


Internal indicator of special typing constructs.