PixelStatisticsCalculator#

class ctapipe.monitoring.calculator.PixelStatisticsCalculator(**kwargs: Any)[source]#

Bases: TelescopeComponent

Component to calculate statistics from calibration events.

The PixelStatisticsCalculator is responsible for calculating various statistics from calibration events, such as pedestal and flat-field data. It aggregates statistics, detects outliers, and handles faulty data periods. This class holds two functions to conduct two different passes over the data with and without overlapping aggregation chunks. The first pass is conducted with non-overlapping chunks, while overlapping chunks can be set by the chunk_shift parameter for the second pass. The second pass over the data is only conducted in regions of trouble with a high fraction of faulty pixels exceeding the threshold faulty_pixels_fraction.

Attributes Summary

chunk_shift

Number of samples to shift the aggregation chunk for the calculation of the statistical values.

faulty_pixels_fraction

Minimum fraction of faulty camera pixels to identify regions of trouble.

outlier_detector_list

List of dicts containing the name of the OutlierDetector subclass to be used, the aggregated statistic value to which the detector should be applied, and the configuration of the specific detector.

stats_aggregator_type

Name of the StatisticsAggregator subclass to be used.

Methods Summary

first_pass(table, tel_id[, ...])

Calculate the monitoring data for a given set of events with non-overlapping aggregation chunks.

second_pass(table, valid_chunks, tel_id[, ...])

Conduct a second pass over the data to refine the statistics in regions with a high percentage of faulty pixels.

Attributes Documentation

chunk_shift#

Number of samples to shift the aggregation chunk for the calculation of the statistical values. Only used in the second_pass(), since the first_pass() is conducted with non-overlapping chunks (chunk_shift=None).

faulty_pixels_fraction#

Minimum fraction of faulty camera pixels to identify regions of trouble.

outlier_detector_list#

List of dicts containing the name of the OutlierDetector subclass to be used, the aggregated statistic value to which the detector should be applied, and the configuration of the specific detector. E.g. [{'apply_to': 'std', 'name': 'RangeOutlierDetector', 'config': {'validity_range': [2.0, 8.0]}}].

stats_aggregator_type#

Name of the StatisticsAggregator subclass to be used. The name of a StatisticsAggregator subclass. Possible values: [‘PlainAggregator’, ‘SigmaClippingAggregator’]

Methods Documentation

first_pass(table, tel_id, masked_pixels_of_sample=None, col_name='image') Table[source]#

Calculate the monitoring data for a given set of events with non-overlapping aggregation chunks.

This method performs the first pass over the provided data table to calculate various statistics for calibration purposes. The statistics are aggregated with non-overlapping chunks (chunk_shift set to None), and faulty pixels are detected using a list of outlier detectors.

Parameters:
tableastropy.table.Table

DL1-like table with images of shape (n_images, n_channels, n_pixels), event IDs and timestamps of shape (n_images, )

tel_idint

Telescope ID for which the calibration is being performed

masked_pixels_of_samplendarray, optional

Boolean array of masked pixels of shape (n_channels, n_pixels) that are not available for processing

col_namestr

Column name in the table from which the statistics will be aggregated

Returns:
astropy.table.Table

Table containing the aggregated statistics, their outlier masks, and the validity of the chunks

second_pass(table, valid_chunks, tel_id, masked_pixels_of_sample=None, col_name='image') Table[source]#

Conduct a second pass over the data to refine the statistics in regions with a high percentage of faulty pixels.

This method performs a second pass over the data with a refined shift of the chunk in regions where a high percentage of faulty pixels were detected during the first pass. Note: Multiple first passes of different calibration events are performed which may lead to different identification of faulty chunks in rare cases. Therefore a joined list of faulty chunks is recommended to be passed to the second pass(es) if those different passes use the same chunk_size.

Parameters:
tableastropy.table.Table

DL1-like table with images of shape (n_images, n_channels, n_pixels), event IDs and timestamps of shape (n_images, ).

valid_chunksndarray

Boolean array indicating the validity of each chunk from the first pass. Note: This boolean array can be a logical_and from multiple first passes of different calibration events.

tel_idint

Telescope ID for which the calibration is being performed.

masked_pixels_of_samplendarray, optional

Boolean array of masked pixels of shape (n_channels, n_pixels) that are not available for processing.

col_namestr

Column name in the table from which the statistics will be aggregated.

Returns:
astropy.table.Table

Table containing the aggregated statistics after the second pass, their outlier masks, and the validity of the chunks.