temfield_mpylab.TestSusceptibility¶
- temfield_mpylab.TestSusceptibility.am_headroom_factor(modulation_depth_percent)[source]¶
Return the peak-to-carrier field factor for sinusoidal AM.
modulation_depth_percentis expressed in percent. For the usual 80 % modulation depth, the returned factor is 1.8.
- temfield_mpylab.TestSusceptibility.format_probe_orientation_preflight(graph_name, orientation, source='default')[source]¶
Return a readable preflight summary for one probe orientation.
- Parameters:
graph_name (str) – Physical field-probe node name.
orientation (mapping, str, or None) – Orientation accepted by
parse_probe_orientation().source (str, optional) – Configuration source shown in the summary.
- Returns:
Multiline orientation and cell-from-probe matrix summary.
- Return type:
- temfield_mpylab.TestSusceptibility.map_probe_field_vector(data, orientation=None, *, data_kind='signed_vector')[source]¶
Map a three-axis field reading into cell coordinates.
- Parameters:
data (sequence of Quantity or float) – Probe x-, y-, and z-axis field components.
orientation (mapping, str, or None, optional) – Probe orientation accepted by
parse_probe_orientation().data_kind ({"signed_vector", "component_magnitudes"}, optional) –
signed_vectorapplies the complete rotation matrix. Forcomponent_magnitudesonly an axis permutation is physically identifiable; signs are ignored and general rotations are rejected.
- Returns:
cell_x,cell_y, andcell_zfield quantities.- Return type:
- temfield_mpylab.TestSusceptibility.parse_probe_axis_map(axis_map=None)[source]¶
Parse a complete signed mapping from probe axes to cell axes.
- Parameters:
axis_map (mapping of str to str, optional) – Mapping for
cell_x,cell_y, andcell_z. Values use signed probe-axis expressions such as+probe_yor-probe_x.- Returns:
Parsed probe-axis index, sign, and normalized expression for every cell axis.
- Return type:
- temfield_mpylab.TestSusceptibility.parse_probe_orientation(orientation=None)[source]¶
Parse a field-probe orientation into a cell-from-probe matrix.
- Parameters:
orientation (mapping, str, or None, optional) – Signed axis map, rotation matrix, or fixed-cell-axis rotation angles.
NoneselectsDEFAULT_PROBE_AXIS_MAP.- Returns:
Rotation
matrix, anaxis_mapwhen the rotation is a signed permutation, and itsnormalizedrepresentation.- Return type:
- temfield_mpylab.TestSusceptibility.resolve_probe_orientation(measurement_graph, graph_name, config_probe_orientations=None)[source]¶
Resolve one physical field probe’s orientation and source.
- Parameters:
measurement_graph (mpylab.tools.mgraph.MGraph or compatible object) – Graph containing the field-probe node, DOT attributes, and parsed INI sections.
graph_name (str) – Physical field-probe node name.
config_probe_orientations (mapping, optional) – Per-node or direct orientation supplied by the application.
- Returns:
orientationcontains the normalized mapping or matrix,sourceidentifies the selected source, andcandidatesretains all agreeing explicit definitions.- Return type:
- Raises:
ProbeOrientationConflictError – If explicit sources define different normalized orientations.
- temfield_mpylab.TestSusceptibility.dBm2W(inp)¶
- class temfield_mpylab.TestSusceptibility.Measure(SearchPaths=None)[source]¶
Bases:
objectBase class for measurements.
- Parameters:
SearchPaths (iterable of path-like, optional) – Directories searched for measurement configuration files. The current working directory is used by default.
- set_autosave_resume(measurement, method, description, parameter_source='current_configuration')[source]¶
Store a structured restart instruction alongside
ascmd.- Parameters:
- Returns:
Pickle-friendly structured restart instruction.
- Return type:
- wait(delay, dct, uitester, intervall=0.1)[source]¶
Wait while repeatedly polling an interrupt callback.
- out(item)[source]¶
Print a nested object recursively on one line.
- Parameters:
item (object) – Mapping, sequence, or scalar value to print.
- set_autosave_interval(interval)[source]¶
Set the minimum interval between automatic saves.
- Parameters:
interval (float) – Minimum interval in seconds.
- stdlogger(block, *args)[source]¶
The standard method to write messages to log file.
Print block to self.logfile or to stdout (if self.logfile is None). If block has attribute keys (i.e. is a
dict), the elements are processed with the local functionout_block(). Else, the block is printed directly.
- stdUserMessenger(msg: str = 'Are you ready?', but: list[str] | None = None, level: str = '', dct: dict[Any, Any] | None = None) int[source]¶
Present a message and optionally wait for a button selection.
- Parameters:
msg (str, optional) – Message shown to the operator.
but (list of str, optional) – Button labels selectable by their initial character.
level (str, optional) – Message category;
"email"enables the legacy email path.dct (mapping, optional) – Supplemental message data, including legacy email fields.
- Returns:
Selected button index, or
-1when no buttons are supplied.- Return type:
- static stdUserInterruptTester() int | None[source]¶
Poll the standard keyboard source for a user interrupt.
- Returns:
Key code from
mpylab.tools.keyboard.anykeyevent(), orNonewhen no key is available.- Return type:
int or None
- set_logfile(name)[source]¶
Open or replace the append-only measurement log file.
- Parameters:
name (path-like) – Requested log-file path. The filename component is sanitized.
- set_logger(logger=None)[source]¶
Configure the callbacks receiving measurement log messages.
- Parameters:
logger (callable or iterable of callable, optional) – Logger callbacks.
stdlogger()is used by default.
- set_messenger(messenger)[source]¶
Configure the callback used for user-facing messages.
- Parameters:
messenger (callable) – Messenger compatible with
stdUserMessenger().
- set_ui_adapter(adapter)[source]¶
Replace the complete measurement UI adapter.
- Parameters:
adapter (UIAdapter) – Adapter providing messaging, logging, and interaction hooks.
- set_user_interrupt_tester(tester)[source]¶
Configure the non-blocking user-interrupt callback.
- Parameters:
tester (callable) – Callback compatible with
stdUserInterruptTester().
- set_user_interrupt_Tester(tester)[source]¶
Call
set_user_interrupt_tester()for legacy clients.- Parameters:
tester (callable) – Non-blocking user-interrupt callback.
- set_pre_user_event(event_cb)[source]¶
Configure the callback run before user-facing interactions.
- Parameters:
event_cb (callable) – Callback invoked before an interaction begins.
- set_post_user_event(event_cb)[source]¶
Configure the callback run after user-facing interactions.
- Parameters:
event_cb (callable) – Callback invoked after an interaction finishes.
- set_interactive_runner(runner)[source]¶
Configure the callback used for interactive sessions.
- Parameters:
runner (callable) – Callback starting an interactive session.
- set_autosave(name)[source]¶
Set the autosave filename used by
do_autosave().- Parameters:
name (path-like or None) – Autosave destination, or
Noneto disable file output.
- do_autosave(name_or_obj=None, depth=None, prefixes=None)[source]¶
Serialize the measurement state using
pickle.Assuming a calling sequence like so:
script -> method of measurement class -> do_autosave
depth=1stores the command issued in the script asself.ascmd. If the requested depth is too large, the outermost command is used.Measurement methods may additionally set
self.autosave_resumeto a structured restart description.ascmdremains available as the human-readable and legacy restart instruction.- Parameters:
name_or_obj (str or binary file-like, optional) – Path-like destination or writable binary stream.
self.asnameis used by default. Path destinations are replaced atomically; caller-owned streams remain open.depth (int, optional) – Number of caller frames used to derive
ascmd.prefixes (iterable of str, optional) – Command prefixes considered when deriving the restart command.
- static stdInteractiveSession(obj, banner)[source]¶
Start the default terminal-based interactive session.
- set_level(mg, l, leveler=None)[source]¶
Set the signal-generator level, optionally respecting a leveler.
- Parameters:
mg (MGraph) – Active measurement graph containing the signal generator.
l (Quantity or float) – Requested power. Numeric values are interpreted as dBm.
leveler (Leveler, optional) – Leveler whose
MaxSafevalue limits the request.
- Returns:
Level reported as applied by the signal generator.
- Return type:
Quantity
- set_level_protected(mg, level, output=None, actor=None, leveler=None, reason=None)[source]¶
Set a signal-generator level without exceeding graph safety limits.
If
outputis given,MGraph.AmplifierProtect()is used as the hard safety check. Unsafe requests are clipped toMGraph.MaxSafeLevel(); the level is still applied and metadata is returned so measurement code can record that the requested target was unreachable due to amplifier protection.- Parameters:
mg (MGraph) – Active measurement graph.
level (Quantity or float) – Requested power. Numeric values are interpreted as dBm.
output (str, optional) – End node of the path checked for amplifier protection.
actor (str, optional) – Signal-generator node. The graph’s
sgname is used by default.leveler (Leveler, optional) – Leveler providing an additional
MaxSafeconstraint.reason (str, optional) – Operation recorded when protection limits the request.
- Returns:
Applied level and protection metadata.
max_safe_levelcontains the strictest effective limit when multiple protection sources are active.- Return type:
- setLevel(mg, level_or_names, level_or_leveler=None)[source]¶
Backward-compatible wrapper for legacy callers.
Supported call shapes: -
setLevel(mg, level_dBm)-setLevel(mg, level_dBm, leveler)-setLevel(mg, names_dict, level_dBm)(legacy TEM/Univers code)- Parameters:
- Returns:
Applied signal-generator level returned by
set_level().- Return type:
Quantity
- doLeveling(leveling, mg, names, dct)[source]¶
Backward-compatible no-op stub for removed legacy leveling API.
The legacy callers expect this method to exist and to return either a new level or
None. Current code path keeps behavior by returningNone.- Parameters:
leveling (object) – Unused legacy leveling configuration.
mg (MGraph) – Unused measurement graph.
names (mapping) – Unused instrumentation names.
dct (mapping) – Unused legacy evaluation context.
- do_leveling(leveling, mg, names, dct)[source]¶
Call the compatibility
doLeveling()implementation.- Parameters:
leveling (object) – Legacy leveling configuration.
mg (MGraph) – Active measurement graph.
names (mapping) – Instrumentation names.
dct (mapping) – Legacy evaluation context.
- Returns:
The removed legacy implementation is intentionally a no-op.
- Return type:
None
- MakeDeslist(thedata, description)[source]¶
Call
make_deslist()for legacy clients.
- MakeWhatlist(thedata, what)[source]¶
Call
make_whatlist()for legacy clients.
- static stdEutStatusChecker(status)[source]¶
Return whether a legacy EUT status denotes normal operation.
- static std_eut_status_checker(status)[source]¶
Call
stdEutStatusChecker()using the snake-case name.
- class temfield_mpylab.TestSusceptibility.TestSusceptibility(parent=None)[source]¶
Bases:
Measure- Init(names=None, datafunc=None, pin=None, dwell_time=None, e_target=None, dotfile=None, SearchPath=None, leveler_par=None, adjust_to_setting=None, probe_orientations=None)[source]¶
Configure the susceptibility measurement.
Raw field-probe readings are mapped once from probe coordinates into the final
(Ex, Ey, Ez)cell-coordinate order. Component selection and customdatafunccallbacks operate on that mapped vector.- Parameters:
names (mapping, optional) – Measurement-graph role to node-name mapping.
datafunc (callable, optional) – Custom observer function receiving an already ordered three-axis field vector. By default,
adjust_to_settingselects the value.pin (iterable of float, optional) – Initial signal-generator levels in dBm.
dwell_time (float, optional) – Exposure time in seconds; defaults to one second.
e_target (float, optional) – Requested carrier field strength in volts per metre.
dotfile (path-like, optional) – Measurement-graph DOT file.
SearchPath (iterable of path-like, optional) – Search paths used to resolve graph configuration files.
leveler_par (mapping, optional) – Explicit mpylab leveler parameters.
adjust_to_setting ({"x", "y", "z", "mag", "largest"}, optional) – Field value used for leveling. Missing and legacy
"auto"values select"y".probe_orientations (mapping, optional) – Direct or per-probe orientation configuration. Graph-node and field-probe INI metadata are used when this is omitted.
- reset_to_safe_actor_level()[source]¶
Reset the generator to its lowest configured level with RF off.
- adjust_level(target_field=None)[source]¶
Level to the target field and return the full probe field vector.
The structured
mpylab.tools.mgraph.LevelingResultis retained inlast_leveling_result. Callers must only expose the EUT to the test field when that result has statusconverged.
- prepare_am_waveform_validation(modulation_depth_percent)[source]¶
Level only to the safe CW starting field for in-loop AM validation.
- Parameters:
modulation_depth_percent (float) – Sinusoidal AM depth from 0 through 100 percent. It determines the peak-to-carrier factor used to keep the initial AM peak at or below the requested carrier field.
- Returns:
Three-axis probe field at
e_target / (1 + modulation_depth).- Return type:
Notes
TEMField deliberately does not approach
factor * e_targetas CW: the EUT is already in the test volume. Amplifier linearity is assessed later from the actual AM waveform while its level is increased from this safe starting point.