mpylab.env.tem.verification_evaluation module¶
Evaluation helpers for IEC 61000-4-20 TEM-mode verification.
- mpylab.env.tem.verification_evaluation.evaluate_constant_field_strength_frequency(primary_fields, secondary_fields, forward_powers, verification_field, k_factor=1.15)
Evaluate one frequency for the constant-field-strength method.
This implements IEC 61000-4-20:2019 CDV, 5.2.2.4.2, including the logarithmic forward-power statistics and Equation (17). The effective normative reference forward power is the upper 75 % statistical power level at the verification field, not the arithmetic mean of the measured powers.
- Parameters:
primary_fields (iterable of scuq.quantities.Quantity) – Positive primary electric-field components measured at all points.
secondary_fields (iterable of pairs of scuq.quantities.Quantity) – Two secondary field components for every primary-field sample.
forward_powers (iterable of scuq.quantities.Quantity) – Positive forward-power samples required to establish the verification field at the individual points.
verification_field (scuq.quantities.Quantity) – Field strength maintained during the verification.
k_factor (float, optional) – Coverage factor for the 75 % statistical power level. The IEC default is
1.15.
- Returns:
Frequency-level result with measured power statistics, statistical reference power, field-uniformity and TEM-mode decisions.
- Return type:
dict
- Raises:
TypeError – If
verification_fieldis not a quantity.ValueError – If samples are missing, values are invalid, or the coverage factor is not finite and positive.
- 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, the 75 % quantile of the secondary-to- primary field ratio, 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_dbm(power)
Convert a power quantity to dBm.
- Parameters:
power (scuq.quantities.Quantity) – Positive power quantity.
- Returns:
Power level in dBm.
- 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 below0.5satisfy the regular TEM-mode criterion; values from0.5through 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 either
evaluate_constant_forward_power_frequency()orevaluate_constant_field_strength_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