mpylab.env.tem.verification_evaluation module¶
Evaluation helpers for IEC 61000-4-20 TEM-mode verification.
- mpylab.env.tem.verification_evaluation.evaluate_constant_forward_power_frequency(primary_fields, secondary_fields, forward_powers, k_factor=1.15, field_uniformity_scale='all', selected_field_uniformity_scale='db')
Evaluate one frequency for the constant-forward-power verification method.
- Parameters:
primary_fields (iterable of scuq.quantities.Quantity) – Positive primary electric-field components measured at all points of the uniform area.
secondary_fields (iterable of pairs of scuq.quantities.Quantity) – Two secondary electric-field components for every primary-field sample. The larger component at each point enters the TEM-mode test.
forward_powers (iterable of scuq.quantities.Quantity) – Positive forward-power samples recorded during verification.
k_factor (float, optional) – Coverage factor used to derive the statistical reference field from the mean and sample standard deviation. The default is
1.15.field_uniformity_scale ({"db", "linear", "coverage", "both", "all"}, optional) – Field-uniformity evaluations to calculate.
"coverage"retains the historical 75 % method, while"all"calculates every supported variant.selected_field_uniformity_scale ({"db", "linear", "coverage"}, optional) – Evaluation whose reference field and pass flags are exposed at the top level of the result. A single-scale
field_uniformity_scaleoverrides this selection.
- Returns:
Frequency-level verification result. It contains all requested field-uniformity evaluations, the selected reference field, measured forward-power statistics,
tem_mode_q75, and separate regular and exception-band flags for field uniformity and TEM-mode dominance.- Return type:
dict
- Raises:
ValueError – If required samples are missing, field or power values are invalid, secondary samples are not pairs, or a scale selection is unsupported.
- mpylab.env.tem.verification_evaluation.field_strength_db(field)
Convert an electric field strength to dB(V/m).
- Parameters:
field (scuq.quantities.Quantity) – Positive electric field strength.
- Returns:
Field strength in dB relative to 1 V/m.
- Return type:
float
- Raises:
ValueError – If the absolute expectation value is zero.
- mpylab.env.tem.verification_evaluation.power_db(power)
Convert a power quantity to dB(W).
- Parameters:
power (scuq.quantities.Quantity) – Positive power quantity.
- Returns:
Power in dB relative to 1 W.
- Return type:
float
- Raises:
ValueError – If the absolute expectation value is zero.
- mpylab.env.tem.verification_evaluation.quantity_value(quantity, unit)
Extract an absolute numerical value from a quantity.
- Parameters:
quantity (scuq.quantities.Quantity) – Quantity whose expectation value is required.
unit (scuq.units.Unit) – Unit to which
quantityis reduced before extracting the value.
- Returns:
Absolute expectation value expressed in
unit.- Return type:
float
- mpylab.env.tem.verification_evaluation.ratio_db(numerator, denominator)
Convert a positive field-strength ratio to decibels.
- Parameters:
numerator (float) – Linear numerator of the amplitude ratio.
denominator (float) – Linear denominator of the amplitude ratio.
- Returns:
numerator / denominatorexpressed using the amplitude-ratio convention,20 * log10(ratio).- Return type:
float
- Raises:
ValueError – If either operand is not positive.
- mpylab.env.tem.verification_evaluation.rayleigh_q75_from_ratios(ratios)
Estimate the 75 % Rayleigh quantile of field-component ratios.
- Parameters:
ratios (iterable of float) – Finite, non-negative ratios of the largest secondary field component to the primary field component at each verification point.
- Returns:
Estimated 75 % quantile
Q75. Values up to0.5satisfy the regular TEM-mode criterion; values up to approximately0.794lie in the normative exception band.- Return type:
float
- Raises:
ValueError – If no ratio is supplied or a ratio is negative or non-finite.
- mpylab.env.tem.verification_evaluation.sample_mean(values)
Calculate the arithmetic mean of scalar values.
- Parameters:
values (iterable of float) – Values to average.
- Returns:
Arithmetic mean of
values.- Return type:
float
- Raises:
ValueError – If
valuesis empty.
- mpylab.env.tem.verification_evaluation.sample_std(values)
Calculate the sample standard deviation of scalar values.
- Parameters:
values (iterable of float) – Values for which the standard deviation is required.
- Returns:
Sample standard deviation with
N - 1degrees of freedom. A sequence containing fewer than two values yields0.0.- Return type:
float
- mpylab.env.tem.verification_evaluation.summarize_verification_results(results_by_frequency, exception_fraction=0.05)
Summarize verification criteria over all measured frequencies.
Frequencies outside both the regular criterion and its exception band cause immediate failure. Results in an exception band remain acceptable only while their number does not exceed
exception_fractionof all frequencies, with at least one exception permitted.- Parameters:
results_by_frequency (mapping) – Mapping from frequency keys to dictionaries returned by
evaluate_constant_forward_power_frequency().exception_fraction (float, optional) – Maximum fraction of frequencies permitted in either normative exception band. The IEC 61000-4-20 value is
0.05.
- Returns:
Aggregate field-uniformity, TEM-mode, and overall pass flags. For a non-empty input, the dictionary also contains the exception counts and the permitted count. Empty input is reported as failed.
- Return type:
dict