multipactor_detectors module
Define functions to detect where multipactor happens.
- quantity_is_above_threshold(quantity, threshold, consecutive_criterion=0, minimum_number_of_points=1, **kwargs)[source]
Detect where
quantityis above a given threshold.- Parameters:
quantity (
ndarray[tuple[Any,...],dtype[double]]) – Array of measured multipactor quantity.threshold (
float) – Quantity value above which multipactor is detected.consecutive_criterion (
int, default:0) – If provided, we gather multipactor zones that were separated byconsecutive_criterionmeasure points or less.minimum_number_of_points (
int, default:1) – If provided, the multipactor must happen on at leastminimum_number_of_pointsconsecutive points, otherwise we consider that it was a measurement flaw.kwargs (
Any)
- Return type:
- Returns:
True where multipactor was detected.
- quantity_is_above_local_average(quantity, baseline_window=300, threshold_factor=3.0, consecutive_criterion=0, minimum_number_of_points=1, **kwargs)[source]
Detect where
quantityis above the local average.Procedure is the following:
Compute running mean (slow trend).
Compute array of residuals between actual data and running mean.
Average array of residuals to get mean difference level.
Multipactor happens where residuals are above the noise level, scaled by
threshold_factor.
- Parameters:
quantity (
ndarray[tuple[Any,...],dtype[double]]) – Array of measured multipactor quantity.baseline_window (
int, default:300) – Window size (in samples) for baseline estimation. Set it to two power cycles for a good first estimation.threshold_factor (
float, default:3.0) – Multiplier for noise level above baseline. This can be negative!consecutive_criterion (
int, default:0) – If provided, we gather multipactor zones that were separated byconsecutive_criterionmeasurement points or less.minimum_number_of_points (
int, default:1) – If provided, the multipactor must happen on at leastminimum_number_of_pointsconsecutive points, otherwise we consider that it was a measurement flaw.
- Return type:
- Returns:
True where multipactor was detected.
- quantity_is_above_lower_envelope(quantity, envelope_window=150, threshold_factor=3.0, consecutive_criterion=0, minimum_number_of_points=1)[source]
Detect where
quantityis above the local average.Procedure is the following:
Compute lower envelope (slow trend without local bumps).
Compute array of residuals between actual data and lower envelope.
Average array of residuals to get mean difference level.
Multipactor happens wmin_widthhere residuals are above the noise level, scaled by
threshold_factor.
- Parameters:
quantity (
ndarray[tuple[Any,...],dtype[double]]) – Array of measured multipactor quantity.envelope_window (
int, default:150) – Window size (in samples) for lower envelope calculation. Set it to one power cycle for a good first estimation.threshold_factor (
float, default:3.0) – Multiplier for noise level above lower envelope. This can be negative!consecutive_criterion (
int, default:0) – If provided, we gather multipactor zones that were separated byconsecutive_criterionmeasurement points or less.minimum_number_of_points (
int, default:1) – If provided, the multipactor must happen on at leastminimum_number_of_pointsconsecutive points, otherwise we consider that it was a measurement flaw.
- Return type:
- Returns:
True where multipactor was detected.
- residual_threshold(data, baseline, factor=1.0)[source]
Compute residuals and a robust noise-based detection threshold.
The baseline is assumed to represent typical non-multipactor behavior. Residuals are defined as positive excursions of
dataabove this baseline. A robust estimate of the residual noise amplitude is obtained from the median absolute deviation and scaled to define a detection threshold.Notes
Noise-based limit above which residuals are classified as multipactor.
- Parameters:
data (
ndarray[tuple[Any,...],dtype[double]]) –Instrumentdata.baseline (
ndarray[tuple[Any,...],dtype[double]]) – Estimate of the non-multipactor baseline. Typically obtained withrunning_mean()orlower_envelope().factor (
float, default:1.0) – Multiplicative factor applied to the noise estimate to set the detection strictness. Higher values reduce false positives.
- Return type:
- Returns:
NDArray[np.float64] – Difference
data - baseline.float – Noise-based limit above which residuals are classified as multipactor.