mpylab.env.msc.ImmunityThreshold module

Susceptibility-threshold search kernel for MSC immunity measurements.

class mpylab.env.msc.ImmunityThreshold.ImmunityThresholdKernel(*, frequencies: Iterable[float], tuner_positions: Mapping[float, Sequence[Any]] | None, field_levels: Iterable[float | Quantity] | None = None, dwell: float = 1.0, messenger: Callable[[...], int] | None = None, poll_key: Callable[[], int | None] | None = None, keylist: str = 'sS', eut_monitor: EUTMonitor | Iterable[EUTMonitor] | None = None, manual_eut_monitor: ManualEUTMonitor | None = None, resume_state: Mapping[str, Any] | None = None, backtrack_levels: int = 5)

Bases: object

Generate commands for an MSC susceptibility-threshold search.

The kernel owns no measurement hardware and never accesses an MGraph. It emits commands which are executed by mpylab.env.msc.MSC.MSC.Measure_Immunity().

Parameters:
  • frequencies (iterable of float) – Test frequencies in hertz.

  • tuner_positions (mapping or None) – Tuner positions indexed by frequency. None selects stirred mode with one exposure per field level.

  • field_levels (iterable of float or scuq.Quantity, optional) – Increasing threshold-search levels. Numeric values are interpreted as V/m. Defaults to 10 V/m through 100 V/m in 10 V/m steps.

  • dwell (float, optional) – EUT observation time per exposure in seconds.

  • messenger (callable, optional) – User-message callback.

  • poll_key (callable, optional) – Non-blocking keyboard polling callback for mandatory manual EUT input.

  • keylist (str, optional) – Keys marking an EUT failure.

  • eut_monitor (EUTMonitor or sequence of EUTMonitor, optional) – Additional automatic EUT monitors.

  • manual_eut_monitor (ManualEUTMonitor, optional) – Manual intervention monitor. A default monitor is always created when this argument is omitted.

  • resume_state (mapping, optional) – Persisted threshold-search state. completed contains measured (frequency, tuner-position, field-value) keys and results may contain completed frequency results.

  • backtrack_levels (int, optional) – Number of field levels to step back for the next frequency.

close() None

Stop the exposure and release all EUT-monitor resources.

test(stat: Any) tuple[str, str, dict[str, Any]]

Return the next command for the MSC immunity dispatcher.

Parameters:

stat (object) – Result of the previously executed command.

Returns:

(command, message, parameters) for the measurement loop.

Return type:

tuple

class mpylab.env.msc.ImmunityThreshold.ThresholdFieldSequence(levels: Iterable[float | Quantity], backtrack_levels: int = 5)

Bases: object

Validated, increasing electric-field levels for a threshold search.

Parameters:
  • levels (iterable of float or scuq.Quantity) – Strictly increasing, finite electric-field levels. Numeric values are interpreted as V/m.

  • backtrack_levels (int, optional) – Number of sequence entries to step back after completing one frequency. This allows the next frequency to start near the preceding threshold while still checking lower levels.

next_start_index(last_index: int) int

Return the first level index for the following frequency.

Parameters:

last_index (int) – Field-level index last tested at the preceding frequency.

Returns:

Bounded start index after applying backtrack_levels.

Return type:

int