Imaging (image)#

ctapipe.image contains all algorithms 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#


hillas_parameters(geom, image)

Compute Hillas parameters for a given shower image.

camera_to_shower_coordinates(x, y, cog_x, ...)

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

timing_parameters(geom, image, peak_time, ...)

Function to extract timing parameters from a cleaned image.

leakage_parameters(geom, image, cleaning_mask)

Calculating the leakage-values for a given image.

concentration_parameters(geom, image, ...)

Calculate concentraion values.

descriptive_statistics(values[, container_class])

compute intensity statistics of an image

number_of_islands(geom, mask)

Search a given pixel mask for connected clusters.


Return number of small, medium and large islands

morphology_parameters(geom, image_mask)

Compute image morphology parameters


Find the biggest island and filter it from the image.

brightest_island(n_islands, island_labels, image)

Find the brightest island and filter it from the image.

tailcuts_clean(geom, image[, ...])

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

dilate(geom, mask)

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

mars_cleaning_1st_pass(geom, image[, ...])

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

fact_image_cleaning(geom, image, arrival_times)

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

apply_time_delta_cleaning(geom, mask, ...)

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

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 [DNR09].

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.

mean_poisson_likelihood_gaussian(prediction, ...)

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

mean_poisson_likelihood_full(prediction, ...)

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

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

Simple chi-squared statistic from Le Bohec et al 2008

kundu_chaudhuri_circle_fit(x, y, weights)

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

mean_squared_error(pixel_x, pixel_y, ...)

Calculate the weighted mean squared error for a circle

intensity_ratio_inside_ring(pixel_x, ...)

Calculate the ratio of the photons inside a given ring with coordinates (center_x, center_y), radius and width.

ring_completeness(pixel_x, pixel_y, weights, ...)

Estimate how complete a ring is.

ring_containment(radius, center_x, center_y, ...)

Estimate angular containment of a ring inside the camera (camera center is (0,0))

neighbor_average_maximum(waveforms, ...)

Obtain the average waveform built from the neighbors of each pixel

subtract_baseline(waveforms, baseline_start, ...)

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


Obtain the correction for the integration window specified.



Component to tune simulated background to overserved NSB values.


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



Abstract class for all configurable Image Cleaning algorithms.


Clean images using the standard picture/boundary technique.



Fit muon ring images with a theoretical model to estimate optical efficiency.


Different ring fit algorithms for muon rings


Takes cleaned images and extracts muon rings.



Extractor that sums the entire waveform.


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


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


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


Sliding window extractor that maximizes the signal in window_width consecutive slices.


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


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


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


Base component for data volume reducers.


Perform no data volume reduction


Reduce the time integrated shower image in 3 Steps:


An abstract base class for algorithms treating invalid pixel data in images