Imaging (image)

ctapipe.image contains all algortihms that operate on Cherenkov camera images.

A Cherenkov image is defined as two pieces of data:

  • a numpy array of pixel values (which can either be 1D, or 2D if time samples are included)

  • a description of the Camera geometry (pixel positions, etc), usually a ctapipe.instrument.CameraGeometry object

This module contains the following sub-modules, but the most important functions of each are imported into the ctapipe.image namespace


ctapipe.image Package


apply_time_delta_cleaning(geom, mask, …)

Identify all pixels from selection that have less than N neighbors that arrived within a given timeframe.


Transforms the 2D ASTRI image back to 1D


astri_to_2d_array(input_img[, img_map])

Convert images comming form “ASTRI” telescopes in order to get regular 2D “rectangular” images directly usable with most image processing tools.

camera_to_shower_coordinates(x, y, cog_x, …)

Return longitudinal and transverse coordinates for x and y for a given set of hillas parameters

chec_to_2d_array(input_img[, img_map])

Convert images comming form “CHEC” cameras in order to get regular 2D “rectangular” images directly usable with most image processing tools.

chi_squared(image, prediction, pedestal[, …])

Simple chi-squared statistic from Le Bohec et al 2008

concentration_parameters(geom, image, …)

Calculate concentraion values.

convert_geometry_hex1d_to_rect2d(geom, signal)

converts the geometry object of a camera with a hexagonal grid into a square grid by slanting and stretching the 1D arrays of pixel x and y positions and signal intensities are converted to 2D arrays.

convert_geometry_rect2d_back_to_hexe1d(geom, …)

reverts the geometry distortion performed by convert_geometry_hexe1d_to_rect_2d back to a hexagonal grid stored in 1D arrays

descriptive_statistics(values[, container_class])

compute intensity statistics of an image

dilate(geom, mask)

Add one row of neighbors to the True values of a pixel mask and return the new mask.

fact_image_cleaning(geom, image, arrival_times)

Clean an image by selection pixels that pass the fact cleaning procedure.

hillas_parameters(geom, image)

Compute Hillas parameters for a given shower image.


Obtain the correction for the integration window specified.

kundu_chaudhuri_circle_fit(x, y, weights)

Fast and reliable analytical circle fitting method previously used in the H.E.S.S.


Find the biggest island and filter it from the image.

leakage_parameters(geom, image, cleaning_mask)

Calculating the leakage-values for a given image.

mars_cleaning_1st_pass(geom, image[, …])

Clean an image by selection pixels that pass a three-threshold tail-cuts procedure.

mean_poisson_likelihood_full(prediction, …)

Calculation of the mean likelihood for a give expectation value of pixel intensity using the full numerical integration.

mean_poisson_likelihood_gaussian(prediction, …)

Calculation of the mean likelihood for a give expectation value of pixel intensity in the gaussian approximation.

morphology_parameters(geom, image_mask)

Compute image morphology parameters

neg_log_likelihood(image, prediction, …[, …])

Safe implementation of the poissonian likelihood implementation, adaptively switches between the full solution and the gaussian approx depending on the prediction.

neg_log_likelihood_approx(image, prediction, …)

Calculate negative log likelihood for telescope.

neg_log_likelihood_numeric(image, …[, …])

Calculate likelihood of prediction given the measured signal, full numerical integration from [denaurois2009].


Obtain the average waveform built from the neighbors of each pixel


Return number of small, medium and large islands

number_of_islands(geom, mask)

Search a given pixel mask for connected clusters.

subtract_baseline(waveforms, baseline_start, …)

Subtracts the waveform baseline, estimated as the mean waveform value in the interval [baseline_start:baseline_end]

tailcuts_clean(geom, image[, …])

Clean an image by selection pixels that pass a two-threshold tail-cuts procedure.

timing_parameters(geom, image, peak_time, …)

Function to extract timing parameters from a cleaned image.



Extractor that first subtracts the baseline before summing in a window about the peak defined by the wavefroms in neighboring pixels.

DataVolumeReducer(subarray[, config, parent])

Base component for data volume reducers.

FixedWindowSum(subarray[, config, parent])

Extractor that sums within a fixed window defined by the user.

FullWaveformSum(subarray[, config, parent])

Extractor that sums the entire waveform.

GlobalPeakWindowSum(subarray[, config, parent])

Extractor which sums in a window about the peak from the global average waveform.


ImageCleaner(subarray[, config, parent])

Abstract class for all configurable Image Cleaning algorithms.

ImageExtractor(subarray[, config, parent])

ImageProcessor(subarray, is_simulation[, …])

Takes DL1/Image data and cleans and parametrizes the images into DL1/parameters.

LocalPeakWindowSum(subarray[, config, parent])

Extractor which sums in a window about the peak in each pixel’s waveform.

MuonIntensityFitter(subarray[, config, parent])

MuonRingFitter([config, parent])

Different ring fit algorithms for muon rings

NeighborPeakWindowSum(subarray[, config, parent])

Extractor which sums in a window about the peak defined by the wavefroms in neighboring pixels.

NullDataVolumeReducer(subarray[, config, parent])

Perform no data volume reduction


TailCutsDataVolumeReducer(subarray[, …])

Reduce the time integrated shower image in 3 Steps:

TailcutsImageCleaner(subarray[, config, parent])

Clean images using the standard picture/boundary technique.

TwoPassWindowSum(subarray[, config, parent])

Extractor based on [R51f2a41efcc4-1] which integrates the waveform a second time using a time-gradient linear fit.