Immunity results and EUT assessment
An immunity result contains more than a final pass/fail value. mpylab keeps
the applied disturbance, EUT observations, operator interventions, retries,
and assessment against the selected performance criterion separate and
traceable.
Disturbance-neutral records
A record must not hard-code the disturbance as an electric field. The
disturbance mapping therefore uses a descriptive quantity_kind and
freely named measured components:
field_record = {
"frequency_hz": 80e6,
"disturbance": {
"quantity_kind": "electric_field_strength",
"target": target_field,
"measured_components": {"cell_y": measured_field},
},
"eut_events": events,
"assessment": assessment,
}
conducted_record = {
"frequency_hz": 10e6,
"disturbance": {
"quantity_kind": "injected_current",
"target": target_current,
"measured_components": {"monitor": measured_current},
},
}
Other useful identifiers include applied_voltage or bulk_current.
quantity_kind is deliberately not a closed enumeration. Applications
should nevertheless use stable, explicit names so that evaluation and report
tools can recognize compatible datasets.
SCUQ quantities remain intact inside the measurement history. JSON export
represents them through value, uncertainty, and unit. Complex
numbers are split into real and imag; NumPy scalars and arrays become
normal JSON values and lists.
EUT event contract
The shared monitoring API lives in mpylab.env.eut. New applications
import events, monitors, and virtual test helpers from this package. The
former mpylab.env.eut_monitor and mpylab.env.random_eut_monitor
modules remain available as compatibility layers for existing scripts and
pickle files.
mpylab.env.eut.make_eut_event() creates a validated,
pickle-friendly event. Important fields are:
statuspassed, degraded, failed, or not_evaluated.
event_typestatus for an EUT observation or monitor_diagnostic for a failure
of the monitoring system itself.
phasepre_exposure, during_exposure, post_exposure, or recovery.
functional_statenormal, degraded, failed, or not_evaluated during the
phase being observed.
after_exposure_state and recoveryState after removing the disturbance and method of recovery. recovery
may be not_required, automatic, operator, reset, failed,
or not_evaluated.
operating_mode_changed and stored_data_lostOptional Boolean observations relevant to assessment.
actionRecommendation to the measurement kernel: continue, retry, or
stop.
safety_actionnone or rf_off. The field expresses a safety requirement but does
not itself issue a hardware command.
reason, details, timestamp, and sourceRationale, supplementary data, timestamp, and origin of the observation.
The measurement class remains responsible for RF-off and for the workflow
action actually applied. A monitor does not access the MGraph directly.
The task-oriented EUT monitoring guide covers both existing measurement classes and
development of custom monitors.
Manual and automatic monitoring
Manual intervention is always present. ManualEUTMonitor accepts keyboard
or GUI events. CompositeEUTMonitor supplements this mandatory component
with any number of automatic monitors such as camera, communication, or
process-data monitoring.
EUTMonitoringSession provides the shared, RF-neutral lifecycle around
this monitor combination. It starts and stops exposures, forwards phase
changes, validates events, and separates monitor diagnostics from EUT status
events. RF-off actions, retries, and measurement-flow decisions deliberately
remain in the measurement kernel or worker.
EUTMonitor.poll_event should not block. Wrap a monitor with a bounded
blocking call in ThreadedEUTMonitor. A failure of an automatic monitor is
reported as monitor_diagnostic while manual fallback remains available.
VirtualEUTMonitor and RandomEUTMonitor provide reproducible
hardware-independent tests. Random events are test data only and do not
demonstrate real EUT performance.
Creating a JSON document
from mpylab.env.immunity_result import (
build_immunity_document,
write_immunity_document,
)
document = build_immunity_document(
application="my-immunity-application",
eut_description="Example EUT",
performance_criterion="A",
created_at="2026-07-16T12:00:00+02:00",
records=records,
)
output = write_immunity_document("result.json", document)
The document contains:
schema = "mpylab-immunity-result" and schema_version;
measurement_type = "immunity";
application, creation time, and EUT description;
the selected performance criterion;
the application-specific records list.
load_immunity_document validates the schema name, version, and presence
of a record list. The concrete measurement class or evaluation must still
validate domain completeness. JSON is written with allow_nan=False, so
non-finite numbers are not silently serialized.
Reports and API
The modular TEM report reads EUT assessment from the
complete pickle history and creates tables and summaries. It does not
re-evaluate the measurement.