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.

ImPACTReconstructor#

class ctapipe.reco.ImPACTReconstructor(**kwargs: Any)[source]#

Bases: HillasGeometryReconstructor

This class is an implementation if the impact_reco Monte Carlo Template based image fitting method from parsons14. This method uses a comparison of the predicted image from a library of image templates to perform a maximum likelihood fit for the shower axis, energy and height of maximum.

Besides the image information, there is also the option to use the time gradient of the pixels across the image as additional information in the fit. This requires an additional set of templates

Because this application is computationally intensive the usual advice to use astropy units for all quantities is ignored (as these slow down some computations), instead units within the class are fixed:

  • Angular units in radians

  • Distance units in metres

  • Energy units in TeV

Parameters:
subarrayctapipe.instrument.SubarrayDescription

The telescope subarray to use for reconstruction

atmosphere_profilectapipe.atmosphere.AtmosphereDensityProfile

Density vs. altitude profile of the local atmosphere

dummy_reconstructorbool, optional

Option to use a set of dummy templates. This can be used for testing the algorithm, but for any actual reconstruction should be set to its default False

References

[parsons14]

Parsons & Hinton, Astroparticle Physics 56 (2014), pp. 26-34

Attributes Summary

ped_table

property

root_dir

Directory containing ImPACT tables

spe

use_time_gradient

Use time gradient in ImPACT reconstruction.

Methods Summary

__call__(event)

Perform the full shower geometry reconstruction on the input event.

get_hillas_mean()

This is a simple function to find the peak position of each image in an event which will be used later in the Xmax calculation.

get_likelihood(source_x, source_y, core_x, ...)

Get the likelihood that the image predicted at the given test position matches the camera image.

get_shower_max(source_x, source_y, core_x, ...)

Function to calculate the depth of shower maximum geometrically under the assumption that the shower maximum lies at the brightest point of the camera image.

image_prediction(tel_type, zenith, azimuth, ...)

Creates predicted image for the specified pixels, interpolated from the template library.

initialise_templates(tel_type)

Check if templates for a given telescope type has been initialised and if not do it and add to the dictionary

minimise(params, step, limits)

Parameters:

predict(hillas_dict, subarray, ...[, ...])

Predict method for the ImPACT reconstructor.

predict_time(tel_type, zenith, azimuth, ...)

Creates predicted image for the specified pixels, interpolated from the template library.

reset_interpolator()

This function is needed in order to reset some variables in the interpolator at each new event.

set_event_properties(hillas_dict, ...)

The setter class is used to set the event properties within this class before minimisation can take place.

Attributes Documentation

ped_table = {'ASTRICam': 0.5, 'CHEC': 0.5, 'FlashCam': 1.3, 'LSTCam': 1.4, 'NectarCam': 1.3, 'SST-Camera': 0.5, 'UNKNOWN-960PX': 1.0, 'dummy': 0.01}#
property = 3#
root_dir#

Directory containing ImPACT tables

spe = 0.6#
use_time_gradient#

Use time gradient in ImPACT reconstruction. Requires an extra set of time gradient templates

Methods Documentation

__call__(event)[source]#

Perform the full shower geometry reconstruction on the input event.

Parameters:
eventcontainer

ctapipe.containers.ArrayEventContainer

get_hillas_mean()[source]#

This is a simple function to find the peak position of each image in an event which will be used later in the Xmax calculation. Peak is found by taking the average position of the n hottest pixels in the image.

get_likelihood(source_x, source_y, core_x, core_y, energy, x_max_scale, goodness_of_fit=False)[source]#

Get the likelihood that the image predicted at the given test position matches the camera image.

Parameters:
source_x: float

Source position of shower in the nominal system (in deg)

source_y: float

Source position of shower in the nominal system (in deg)

core_x: float

Core position of shower in tilted telescope system (in m)

core_y: float

Core position of shower in tilted telescope system (in m)

energy: float

Shower energy (in TeV)

x_max_scale: float

Scaling factor applied to geometrically calculated Xmax

goodness_of_fit: boolean

Determines whether expected likelihood should be subtracted from result

Returns
——-
float: Likelihood the model represents the camera image at this position
get_shower_max(source_x, source_y, core_x, core_y, zen)[source]#

Function to calculate the depth of shower maximum geometrically under the assumption that the shower maximum lies at the brightest point of the camera image.

Parameters:
source_x: float

Event source position in nominal frame

source_y: float

Event source position in nominal frame

core_x: float

Event core position in telescope tilted frame

core_y: float

Event core position in telescope tilted frame

zen: float

Zenith angle of event

Returns:
float: Depth of maximum of air shower
image_prediction(tel_type, zenith, azimuth, energy, impact, x_max, pix_x, pix_y)[source]#

Creates predicted image for the specified pixels, interpolated from the template library.

Parameters:
tel_type: string

Telescope type specifier

energy: float

Event energy (TeV)

impact: float

Impact diance of shower (metres)

x_max: float

Depth of shower maximum (num bins from expectation)

pix_x: ndarray

X coordinate of pixels

pix_y: ndarray

Y coordinate of pixels

Returns:
ndarray: predicted amplitude for all pixels
initialise_templates(tel_type)[source]#

Check if templates for a given telescope type has been initialised and if not do it and add to the dictionary

Parameters:
tel_type: dictionary

Dictionary of telescope types in event

Returns:
boolean: Confirm initialisation
minimise(params, step, limits)[source]#
Parameters:
params: ndarray

Seed parameters for fit

step: ndarray

Initial step size in the fit

limits: ndarray

Fit bounds

Returns
——-
tuple: best fit parameters and errors
predict(hillas_dict, subarray, array_pointing, shower_seed, energy_seed, telescope_pointings=None, image_dict=None, mask_dict=None, time_dict=None)[source]#

Predict method for the ImPACT reconstructor. Used to calculate the reconstructed ImPACT shower geometry and energy.

Parameters:
shower_seed: ReconstructedShowerContainer

Seed shower geometry to be used in the fit

energy_seed: ReconstructedEnergyContainer

Seed energy to be used in fit

Returns:
ReconstructedShowerContainer, ReconstructedEnergyContainer:
predict_time(tel_type, zenith, azimuth, energy, impact, x_max)[source]#

Creates predicted image for the specified pixels, interpolated from the template library.

Parameters:
tel_type: string

Telescope type specifier

energy: float

Event energy (TeV)

impact: float

Impact diance of shower (metres)

x_max: float

Depth of shower maximum (num bins from expectation)

Returns:
ndarray: predicted amplitude for all pixels
reset_interpolator()[source]#

This function is needed in order to reset some variables in the interpolator at each new event. Without this reset, a new event starts with information from the previous event.

set_event_properties(hillas_dict, image_dict, time_dict, mask_dict, subarray, array_pointing, telescope_pointing)[source]#

The setter class is used to set the event properties within this class before minimisation can take place. This simply copies a bunch of useful properties to class members, so that we can use them later without passing all this information around.

Parameters:
hillas_dict: dict

dictionary with telescope IDs as key and HillasParametersContainer instances as values

image_dict: dict

Amplitude of pixels in camera images

time_dict: dict

Time information per each pixel in camera images

mask_dict: dict

Event image masks

subarray: dict

Type of telescope

array_pointing: SkyCoord[AltAz]

Array pointing direction in the AltAz Frame

telescope_pointing: SkyCoord[AltAz]

Telescope pointing directions in the AltAz Frame

Returns
——-
None