pyhiperta.hillas.hillas

pyhiperta.hillas.hillas(waveform: ndarray, position: ndarray, nan_threshold: float = 0.0001) Tuple[ndarray, ndarray][source]

Compute hillas parameters (ellipse position, orientation, skewness, kurtosis) from shower images.

The Hillas parametrization consists in estimating the ellipse formed by a gamma-ray shower over the background noise in the telescope integrated and cleaned images (R1 data level).

The ellipse parameters are found by performing a principal component analysis (PCA) of the images pixels weighted by their charge. The ellipse center is defined as the image center of gravity ; the ellipse axis and angle with respect to the x-axis are given by the PCA eigenvectors ; the ellipse length and width are defined as twice the standard deviation along the ellipse axis. In addition, the skewness and kurtosis of the image are computed along the major axis of the ellipse.

This method works with a single image, of with a batch of images. The implementation first computes the 1st and 2nd order image moments to build the covariance matrix (PCA is computed via the covariance matrix). The ellipse parameters are deduced from the covariance matrix and finally the skewness and kurtosis are computed as 3rd and 4rd along the ellipse major axis.

This function also returns the longitudinal coordinate of the pixels along the ellipsis greater axis since it is usefull for timing parameters computation.

Notes

A gamma-ray shower is radially symmetric in the direction of arrival, therefore the distribution along the small ellipse axis should be gaussian and the skewness and kurtosis are not computed along this axis.

An ellipse with given orientation and skewness is equivalent to another ellipse with orientation + pi and opposite skewness (psi + pi, -skewness). This method consistently returns the orientation in the ]-pi/2, pi/2[ range and corresponding skewness.

The skewness and kurtosis are computed using the 3rd and 4th moments, which are biased estimators.

Hillas, A. (1985). Cerenkov Light Images of EAS Produced by Primary Gamma Rays and by Nuclei. In 19th International Cosmic Ray Conference (ICRC19), Volume 3 (pp. 445).

Parameters:
  • waveform (np.ndarray) – 1D shower image(s). If a single image is provided the shape must be (N_pixels,). If a batch of images is provided, the shape should be (N_batch, N_pixels).

  • position (np.ndarray) – Image pixel position in (x, y) coordinates. The shape must be (2, N_pixels): position[0,:] is the x coordinate, and position[1, :] the y coordinate, of the image pixels.

  • nan_threshold (float) – Threshold to set some computed values to NaN instead of leaving them with problematic values. Images with intensity smaller than the threshold will have all output set to NaN. Images with lengths smaller than the threshold will have length, skewness and kurtosis set to NaN.

Returns:

  • hillas_parameters (np.ndarray) – Image(s) hillas parameters. This is a 1D array with shape (10,) if a single image was provided, or a 2D array with shape (N_batch, 10) if a batch of images was provided. The parameters are ordered like so: hillas_parameters[…, 0]: intensity hillas_parameters[…, 1]: center of gravity x coordinate hillas_parameters[…, 2]: center of gravity y coordinate hillas_parameters[…, 3]: center of gravity radial coordinate radius (r) hillas_parameters[…, 4]: center of gravity radial coordinate angle (phi) hillas_parameters[…, 5]: ellipse length hillas_parameters[…, 6]: ellipse width hillas_parameters[…, 7]: ellipse angle with respect to x-axis (psi) in ]-pi/2, pi/2[ hillas_parameters[…, 8]: ellipse skewness hillas_parameters[…, 9]: ellipse kurtosis

  • longitudinal_coordinates (np.ndarray) – Coordinates of the pixels along the long axis of the ellipsis.