ImPACTReconstructor¶
-
class
ctapipe.reco.impact.
ImPACTReconstructor
(**kwargs: Any)[source]¶ Bases:
ctapipe.core.component.Component
This class is an implementation if the impact_reco Monte Carlo Template based image fitting method from parsons14. This method uses a comparision 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.
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
References
- parsons14
Parsons & Hinton, Astroparticle Physics 56 (2014), pp. 26-34
Attributes Summary
Methods Summary
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.
Wrapper class around likelihood function for use with scipy minimisers
get_likelihood_nlopt
(x, grad)Wrapper class around likelihood function for use with scipy minimisers
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, energy, impact, …)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
(shower_seed, energy_seed)Predict method for the ImPACT reconstructor.
predict_time
(tel_type, energy, impact, x_max)Creates predicted image for the specified pixels, interpolated from the template library.
This function is needed in order to reset some variables in the interpolator at each new event.
rotate_translate
(pixel_pos_x, pixel_pos_y, …)Function to perform rotation and translation of pixel lists
set_event_properties
(image, time, pixel_x, …)The setter class is used to set the event properties within this class before minimisation can take place.
Attributes Documentation
-
ped_table
= {'CHEC': 0.5, 'DUMMY': 0, 'FlashCam': 2.3, 'LSTCam': 2.8, 'NectarCam': 2.3}¶
-
spe
= 0.5¶
Methods Documentation
-
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_likelihood_min
(x)[source]¶ Wrapper class around likelihood function for use with scipy minimisers
- Parameters
- x: ndarray
Array of minimisation parameters
- Returns
- float: Likelihood value of test position
-
get_likelihood_nlopt
(x, grad)[source]¶ Wrapper class around likelihood function for use with scipy minimisers
- Parameters
- x: ndarray
Array of minimisation parameters
- Returns
- float: Likelihood value of test 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, 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, minimiser_name='minuit', max_calls=0)[source]¶ - Parameters
- params: ndarray
Seed parameters for fit
- step: ndarray
Initial step size in the fit
- limits: ndarray
Fit bounds
- minimiser_name: str
Name of minimisation method
- max_calls: int
Maximum number of calls to minimiser
- Returns
- ——-
- tuple: best fit parameters and errors
-
predict
(shower_seed, energy_seed)[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, 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.
-
static
rotate_translate
(pixel_pos_x, pixel_pos_y, x_trans, y_trans, phi)[source]¶ Function to perform rotation and translation of pixel lists
- Parameters
- pixel_pos_x: ndarray
Array of pixel x positions
- pixel_pos_y: ndarray
Array of pixel x positions
- x_trans: float
Translation of position in x coordinates
- y_trans: float
Translation of position in y coordinates
- phi: float
Rotation angle of pixels
- Returns
- ndarray,ndarray: Transformed pixel x and y coordinates
-
set_event_properties
(image, time, pixel_x, pixel_y, type_tel, tel_x, tel_y, array_direction, hillas)[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
- image: dict
Amplitude of pixels in camera images
- time: dict
Time information per each pixel in camera images
- pixel_x: dict
X position of pixels in nominal system
- pixel_y: dict
Y position of pixels in nominal system
- type_tel: dict
Type of telescope
- tel_x: dict
X position of telescope in TiltedGroundFrame
- tel_y: dict
Y position of telescope in TiltedGroundFrame
- array_direction: SkyCoord[AltAz]
Array pointing direction in the AltAz Frame
- hillas: dict
dictionary with telescope IDs as key and HillasParametersContainer instances as values
- Returns
- None