temfield_mpylab.TestSusceptibility

temfield_mpylab.TestSusceptibility.dBm2W(v)[source]

Convert a dBm input to Watt

Parameters:

v (float or array-like) – input value(s) in dBm

Returns:

input value(s) converted to Watt

Return type:

float or array-like (same as input)

class temfield_mpylab.TestSusceptibility.Measure(SearchPaths=None)[source]

Bases: object

Base class for measurements.

__init__(SearchPaths=None)[source]

constructor

wait(delay, dct, uitester, intervall=0.1)[source]

A wait function that can be interrupted.

  • delay: seconds to wait

  • dct: namespace passed to legacy handler style

  • uitester: interrupt callback; supports fn(dct) and fn()

  • intervall: seconds to sleep between callback calls

Return: None

out(item)[source]

Helper function for all output functions.

Prints item recursively all in one line.

The parameter item can be:

  • a dict of items (hasattr(item, ‘keys’)==True)

  • a list of items (hasattr(item, ‘index’)==True)

  • a sequence of items (using mpylab.tools.util.issequence())

  • or anything else (will be printed via print item,)

The return value is None.

set_autosave_interval(interval)[source]

Set the intervall between auto save.

intervall: seconds between auto save

This method returns None.

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 function out_block(). Else, the block is printed directly.

Parameter block: object to log

Return value: None

stdUserMessenger(msg: str = 'Are you ready?', but: list[str] | None = None, level: str = '', dct: dict[Any, Any] | None = None) int[source]

The standard (default) method to present messages to the user.

The behaviour depends on the value of the parameter but. If len(but) (buttons are given) the funttions waits for a user answer. Else, the msg is presented only.

The function also calls all additional logger functions given in self.logger with the same arguments.

Parameters:

  • msg: message to display

  • but: sequence with the text strings of the buttons

  • level: to indicate something (not used in the standard logger)

  • dct: a dict with further parameters (not used in the standard logger)

Return value: the index of the selected button (starting from 0), or -1 if len(but) is False.

static stdUserInterruptTester() int | None[source]

The standard (default) user interrupt tester.

Returns return value of mpylab.util.anykeyevent()

set_logfile(name)[source]

Tries to open a file with the given name with mode ‘a+’. If this fails, nothing will happen, else stdloogger() will log to this file.

Parameter name: full qualified name of the file to be used as logfile

Return: None

set_logger(logger=None)[source]

Set up the list of logger fuctions (self.logger).

If logger is None, stdlogger() is used.

Parameter logger: list of functions called to log events

Return: None

set_messenger(messenger)[source]

Set function to present messages.

Parameter messenger: the messenger (see stdUserMessenger())

Return: None

set_user_interrupt_tester(tester)[source]

Set function to test for user interrupt.

Parameter tester: callable (see stdUserInterruptTester()).

Return: None

set_user_interrupt_Tester(tester)[source]

Backward-compatible alias for set_user_interrupt_tester().

set_pre_user_event(event_cb)[source]

Set function called before user-facing UI interactions.

set_post_user_event(event_cb)[source]

Set function called after user-facing UI interactions.

set_interactive_runner(runner)[source]

Set function used for interactive user sessions.

set_autosave(name)[source]

Setter for the class attribute asname (name of the auto save file).

Parameter name: file name oif the auto save file

Return: None

do_autosave(name_or_obj=None, depth=None, prefixes=None)[source]

Serialize self using pickle.

Assuming a calling sequence like so:

script -> method of measurement class -> do_autosave

depth = 1 (default) will set self.ascmd to the command issued in the script.

If depth is too large, the outermost command is used.

Thus, the issued command in script is extracted and saved in self.ascmd. This can be used to redo the command after a crash.

Return: None

static stdPreUserEvent()[source]

stdPreUserEvent method.

static stdPostUserEvent()[source]

stdPostUserEvent method.

static stdInteractiveSession(obj, banner)[source]

Default interactive session hook for terminal usage.

set_level(mg, l, leveler=None)[source]
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)

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 returning None.

make_deslist(thedata, description)[source]

make_deslist method.

MakeDeslist(thedata, description)[source]

Backward-compatible wrapper around make_deslist().

make_whatlist(thedata, what)[source]

make_whatlist method.

MakeWhatlist(thedata, what)[source]

Backward-compatible wrapper around make_whatlist().

static stdEutStatusChecker(status)[source]

stdEutStatusChecker method.

static std_eut_status_checker(status)[source]

Backward-compatible alias for stdEutStatusChecker().

class temfield_mpylab.TestSusceptibility.TestSusceptibility(parent=None)[source]

Bases: Measure

__init__(parent=None)[source]

constructor

Init(names=None, datafunc=None, pin=None, dwell_time=None, e_target=None, dotfile=None, SearchPath=None, leveler_par=None, adjust_to_setting=None)[source]
init_measurement(am)[source]
rf_on()[source]
rf_off()[source]
am_on()[source]
am_off()[source]
adjust_level()[source]
get_waveform()[source]
do_measurement(f)[source]
quit_measurement()[source]
stdUserInterruptHandler(dct, ignorelist='')[source]