mpylab.env.eut.events module

Structured EUT events, policies, and performance-criterion evaluation.

mpylab.env.eut.events.evaluate_performance_criterion(events, criterion='A')

Evaluate structured EUT observations against criterion A, B, or C.

A diagnostic retry never removes a known degradation or failure from a criterion-A result. An earlier not_evaluated attempt may, however, be superseded by a later evaluated attempt because it contains no functional observation. Criteria B and C require an explicit normal post-exposure state whenever an impairment was observed.

Parameters:
  • events (iterable of mapping) – Structured EUT observations, including any repeated attempts.

  • criterion (str, optional) – EMC performance criterion "A", "B", or "C".

Returns:

Evaluation result with status, reasons, and observation metadata.

Return type:

dict

mpylab.env.eut.events.make_eut_event(status, reason, details=None, *, timestamp=None, action='continue', phase='during_exposure', functional_state=None, after_exposure_state=None, recovery=None, operating_mode_changed=None, stored_data_lost=None, safety_action=None, source=None, event_type='status')

Return a validated, pickle-friendly EUT status event.

action is advisory. The measurement kernel remains responsible for all RF safety actions and for deciding whether a run continues or stops. safety_action is independent of that measurement-flow recommendation. It defaults to "rf_off" for failures and unevaluable states, and to "none" for passed or merely degraded observations.

Parameters:
  • status (str) – Observation status from EUT_EVENT_STATUSES.

  • reason (str) – Machine-readable reason for the observation.

  • details (object, optional) – Pickle-friendly supplemental information.

  • timestamp (float, optional) – Unix timestamp. The current time is used when omitted.

  • action (str, optional) – Advisory measurement-flow action.

  • phase (str, optional) – Exposure phase to which the observation belongs.

  • functional_state (str, optional) – Observed functional state. It is inferred from status by default.

  • after_exposure_state (str, optional) – Functional state observed after RF exposure.

  • recovery (str, optional) – Recovery mechanism observed after exposure.

  • operating_mode_changed (bool, optional) – Whether the EUT operating mode changed unexpectedly.

  • stored_data_lost (bool, optional) – Whether stored EUT data was lost.

  • safety_action (str, optional) – Requested safety action, inferred from status when omitted.

  • source (str, optional) – Identifier of the monitor that produced the event.

  • event_type (str, optional) – Event category from EUT_EVENT_TYPES.

Returns:

Normalized, validated EUT event.

Return type:

dict

mpylab.env.eut.events.validate_eut_event(event)

Validate and normalize an event returned by an EUT monitor.

Parameters:

event (mapping) – Event fields accepted by make_eut_event().

Returns:

Normalized EUT event.

Return type:

dict

mpylab.env.eut.events.validate_eut_event_policy(policy=None)

Return a complete measurement-level EUT event policy.

Parameters:

policy (mapping, optional) – Overrides for DEFAULT_EUT_EVENT_POLICY.

Returns:

Complete normalized policy.

Return type:

dict

mpylab.env.eut.events.validate_performance_criterion(criterion='A')

Return a normalized EMC immunity performance criterion.

Parameters:

criterion (str) – Performance criterion "A", "B", or "C". Input is normalized to uppercase.

Returns:

Normalized criterion.

Return type:

str