temfield_mpylab.EUT¶
temfield_mpylab.EUT re-exports the shared mpylab monitor API for existing
TEMField integrations. New code should import these objects from
mpylab.env.eut directly.
Shared monitor classes¶
- class mpylab.env.eut.EUTMonitor[source]¶
Bases:
objectMinimal interface for monitoring an EUT during one RF exposure.
Implementations must not access the measurement’s
MGraph. Polling should be non-blocking unless the monitor is wrapped inThreadedEUTMonitor.- start_exposure(context)[source]¶
Prepare monitoring for one exposure.
- Parameters:
context (mapping) – Measurement context describing the exposure.
- class mpylab.env.eut.ManualEUTMonitor(poll_key=None, keylist='sS', stop_keys='qQ')[source]¶
Bases:
EUTMonitorAlways-available manual EUT status input.
Events may be submitted from a GUI thread or generated from a configured keyboard callback. State after exposure and recovery method are accepted as separate values so that the performance criterion remains evaluable.
- Parameters:
- start_exposure(context)[source]¶
Enable manual input for a new exposure and discard stale events.
- Parameters:
context (mapping) – Measurement context describing the exposure.
- property is_active¶
Whether manual observations are currently accepted.
- property current_phase¶
Current exposure phase for newly submitted observations.
- start_phase(phase, context)[source]¶
Select the phase assigned to subsequent manual observations.
- Parameters:
phase (str) – Phase from
EUT_EVENT_PHASES.context (mapping) – Measurement context for the phase.
- submit_event(event, *, source='manual_gui')[source]¶
Queue a manually supplied event for the active exposure.
- submit_status(status, reason='operator_observation', details=None, *, source='manual_gui', **event_fields)[source]¶
Queue a manual functional status in the current exposure phase.
- Parameters:
status (str) – Observation status from
EUT_EVENT_STATUSES.reason (str, optional) – Machine-readable reason for the observation.
details (object, optional) – Supplemental operator information.
source (str, optional) – Operator interface that supplied the status.
**event_fields (object) – Additional fields accepted by
make_eut_event().
- Returns:
Normalized event placed in the queue.
- Return type:
- submit_post_exposure_state(after_exposure_state, *, recovery, reason='operator_post_exposure_observation', details=None, source='manual_gui', operating_mode_changed=None, stored_data_lost=None)[source]¶
Queue post-exposure state and recovery information.
- Parameters:
after_exposure_state (str) – Functional state observed after RF exposure.
recovery (str) – Recovery mechanism consistent with the observed state.
reason (str, optional) – Machine-readable reason for the observation.
details (object, optional) – Supplemental operator information.
source (str, optional) – Operator interface that supplied the observation.
operating_mode_changed (bool, optional) – Whether the EUT operating mode changed unexpectedly.
stored_data_lost (bool, optional) – Whether stored EUT data was lost.
- Returns:
Normalized post-exposure event placed in the queue.
- Return type:
- class mpylab.env.eut.ThreadedEUTMonitor(monitor, *, poll_interval=0.01, join_timeout=1.0)[source]¶
Bases:
EUTMonitorPoll another EUT monitor in a dedicated background thread.
The wrapped monitor’s
poll_eventmay block only for a bounded time so thatstop_exposurecan join the worker.start_exposureandstop_exposurethemselves are called outside the worker and should therefore return promptly.- Parameters:
monitor (EUTMonitor) – Monitor polled by the background worker.
poll_interval (float, optional) – Delay in seconds between polling calls.
join_timeout (float, optional) – Maximum time in seconds allowed for worker shutdown.
- property is_running¶
Whether the background polling worker is currently running.
- start_exposure(context)[source]¶
Start the wrapped monitor and its background polling worker.
- Parameters:
context (mapping) – Measurement context describing the exposure.
- start_phase(phase, context)[source]¶
Forward a phase transition while serializing monitor access.
- Parameters:
phase (str) – Phase from
EUT_EVENT_PHASES.context (mapping) – Measurement context for the phase.
- class mpylab.env.eut.CompositeEUTMonitor(manual_monitor, automatic_monitors=())[source]¶
Bases:
EUTMonitorCombine mandatory manual input with optional automatic monitors.
- Parameters:
manual_monitor (ManualEUTMonitor) – Always-available operator interaction layer.
automatic_monitors (EUTMonitor or iterable of EUTMonitor, optional) – Additional automatic observation sources.
- start_exposure(context)[source]¶
Start manual and automatic monitors for one exposure.
- Parameters:
context (mapping) – Measurement context describing the exposure.
- start_phase(phase, context)[source]¶
Forward an exposure phase transition to all active monitors.
- Parameters:
phase (str) – Phase from
EUT_EVENT_PHASES.context (mapping) – Measurement context for the phase.
- class mpylab.env.eut.EUTMonitoringSession(monitor: EUTMonitor)[source]¶
Bases:
objectManage monitors and classify their events for one EUT exposure.
The session deliberately has no access to RF hardware and does not apply retry or stop policies. Measurement kernels remain responsible for those safety and workflow decisions.
- Parameters:
monitor (EUTMonitor) – Monitor, commonly a
CompositeEUTMonitor, whose lifecycle is managed by the session.
- monitor¶
Managed monitor instance.
- Type:
- __init__(monitor: EUTMonitor) → None[source]¶
- classmethod from_monitors(manual_monitor: ManualEUTMonitor, automatic_monitors: EUTMonitor | Iterable[EUTMonitor] = ()) → EUTMonitoringSession[source]¶
Build a session with mandatory manual operator intervention.
- Parameters:
manual_monitor (ManualEUTMonitor) – Always-available manual observation and intervention source.
automatic_monitors (EUTMonitor or iterable of EUTMonitor, optional) – Additional automatic observation sources.
- Returns:
Session managing the combined monitor.
- Return type:
- property diagnostics: tuple[dict, ...]¶
Return monitor diagnostics collected during the current exposure.
- start_exposure(context: Mapping) → None[source]¶
Start a new exposure and clear records from the previous one.
- Parameters:
context (mapping) – Measurement-specific exposure context forwarded to every monitor.
- Raises:
RuntimeError – If another exposure is already active.
- start_phase(phase: str, context: Mapping) → None[source]¶
Switch all monitors to another phase of the active exposure.
- Parameters:
phase (str) – Exposure phase accepted by the EUT event schema.
context (mapping) – Measurement-specific phase context forwarded to every monitor.
- Raises:
RuntimeError – If no exposure is active.
- poll_event(diagnostic_context: Mapping | None = None)[source]¶
Return the next status event and retain diagnostics separately.
- Parameters:
diagnostic_context (mapping, optional) – Metadata added with
setdefaultto monitor diagnostics, for example the current frequency, position, or attempt number.- Returns:
Next validated status event. Diagnostics and an empty monitor queue both return
None; diagnostics are available throughdiagnosticsandpop_diagnostics().- Return type:
dict or None
- class mpylab.env.eut.RandomEUTMonitor(*, seed=None, status_weights=None, recovery_weights=None, delay=0.0, source='random_simulation', operating_mode_changed=False, stored_data_lost=False)[source]¶
Bases:
EUTMonitorGenerate reproducible random EUT observations without hardware.
This class is both a simulation helper and a compact template for custom monitors. Its
poll_event()method never blocks. Replace_make_exposure_event()with a camera, communication, or process-data check when adapting the class to real EUT monitoring.- Parameters:
seed – Seed used by an instance-local random-number generator. Equal seeds and configurations produce equal event sequences.
status_weights – Relative weights for
passed,degraded,failed, andnot_evaluatedobservations during exposure.recovery_weights – Relative weights for
automatic,operator,reset, andfailedrecovery after a degraded or failed observation.delay – Non-negative delay in seconds before an event becomes available.
source – Source label stored in every generated event.
operating_mode_changed – Simulated observations needed for performance criterion B. Both default to
False.stored_data_lost – Simulated observations needed for performance criterion B. Both default to
False.
Notes
This simulation must not be used as evidence of real EUT performance. The mandatory manual monitor remains active when this monitor is passed to
Measure_Immunityas an automaticeut_monitor.- __init__(*, seed=None, status_weights=None, recovery_weights=None, delay=0.0, source='random_simulation', operating_mode_changed=False, stored_data_lost=False)[source]¶
- start_exposure(context)[source]¶
Generate and schedule a random event for a new exposure.
- Parameters:
context (mapping) – Measurement context describing the exposure.
- start_phase(phase, context)[source]¶
Generate a post-exposure event when that phase begins.
- Parameters:
phase (str) – Phase from
EUT_EVENT_PHASES.context (mapping) – Measurement context for the phase.