conducted_emissions_mpylab.ce

This is the conducted_emission.ce module.

author:

Hans Georg Krauthäuser (main author)

license:

GPLv3 or higher

class conducted_emission_mpylab.ce.Stdout_Logger[source]

Bases: object

Stdout_Logger class.

Simply prints the message to stdout.

class conducted_emission_mpylab.ce.File_Logger(logger)[source]

Bases: object

File_Logger class.

A logger intended to log to file.

levels = {'critical': 50, 'debug': 10, 'error': 40, 'info': 20, 'warning': 30}
__init__(logger)[source]

Constructor :param logger: Instance of the logging object

class conducted_emission_mpylab.ce.ConductedEmission(description: str | None = None, log_fn: Callable[[str], None] | None = None, export_pre_fn: Callable[[None], None] | None = None, export_fin_fn: Callable[[None], None] | None = None, output_path: str | None = None, prefix_prescan: str | None = None, finscan_prefix: str | None = None)[source]

Bases: object

Conducted Emission class

Used to perform conducted emission EMC measurements using an EMC-Receiver and a Line-Impedance Stabilized Network (LISN)

__init__(description: str | None = None, log_fn: Callable[[str], None] | None = None, export_pre_fn: Callable[[None], None] | None = None, export_fin_fn: Callable[[None], None] | None = None, output_path: str | None = None, prefix_prescan: str | None = None, finscan_prefix: str | None = None) None[source]

Constructor

Parameters:
  • description – str; general description of the measurement

  • log_fn – callback for logging messages

  • export_pre_fn – callback for exporting conducted emission prescan measurements

  • export_fin_fn – callback for exporting conducted emission final measurements

  • output_path – file save path if internal export functions are used

  • prefix_prescan – file prefix for prescan measurements if internal export functions are used

  • finscan_prefix – file prefix for finscan measurements if internal export functions are used

prepare_scan(dot: str | TextIO, names: dict | None = None, searchpaths: Iterable[str] | None = None, paths: Iterable[str] | None = None, freqs: Iterable[float] | None = None, limitline: limitline = None, dut_description: str | None = None) None[source]

Prepare conducted emission measurement

Parameters:
  • dot – filename, file-like object or data; the graph dot file

  • names – dict; maps internal used names ‘eut’, ‘lisn’, ‘rec’ to the names in dot file

  • searchpaths – list; search paths for ini-files and data-files

  • paths – list or tuple; the different measurent paths, e.g. “(‘L’, ‘N’)”, or “(‘L1’, ‘L2’, ‘L3’, ‘N’)”

  • freqs – list; the frequencies

  • limitline – callable or None; gives the actual limit at freq

  • dut_description – str; description of the device under test (DUT)

Returns:

None

uniquify(path)[source]

Method to uniquify a path: append three digit counter until unique filemame is sanitized first.

Parameters:

path – str: full path to uniquify

Returns:

str: uniquified path

export_prescan()[source]

Method to export prescan data to csv file :return: None

export_finscan()[source]

Method to export finscan data to csv file :return: None

do_pre_scan(paths: Iterable[str] | None = None, detector: str = 'PEAK', should_stop: Callable[[], bool] | None = None, wait_if_paused: Callable[[], bool] | None = None, progress: Callable[[object], None] | None = None)[source]

Perform a pre scan (PEAK or AVERAGE-Detector) conducted emission measurement

Parameters:
  • paths – list or tuple; e.g. “(‘L, ‘N’)”, or “(‘L1’, ‘L2’, ‘L3’, ‘N’)”

  • detector – str; either ‘PEAK’ or ‘AVERAGE’

Returns:

None

init_prescan(detector: str = 'PEAK') None[source]

Setup pre-scan

Parameters:

detector – str; either ‘PEAK’ or ‘AVERAGE’

Returns:

None

pre_scan_set_path(path: str) None[source]

Set measurement path for pre scan

Parameters:

path – str; in ‘(‘L’, ‘N’)’, or ‘(‘L1’, ‘L2’, ‘L3’, ‘N’)

Returns:

None

pre_scan_do_freq(freq: float) Quantity[source]

Perform pre scan for one frequency

Parameters:

freq – float; the frequency

Returns:

data; scuq object with pre scan data for this frequency

do_final_scan(paths: Iterable[str] | None = None, margin: float = 6, detector: str | None = None, should_stop: Callable[[], bool] | None = None, wait_if_paused: Callable[[], bool] | None = None, progress: Callable[[object], None] | None = None) None[source]

Perform a final conducted emission measurement

QPEAK measurements are performed at frequencies and paths where prescan is larger that limit - margin (on dB scale) :param paths: list or tuple; e.g. [‘L’, ‘N’] :param margin: float; dB value below limit :return: None

init_finscan(margin: float = 6, detector: str | None = None) None[source]

Setup final conducted emission measurement

Parameters:

margin – float; dB value below limit

Returns:

None

finscan_set_path(path: str) None[source]

Set measurement path for final conducted emission

Parameters:

path – str; e.g. from [‘L’, ‘N’]

Returns:

None

finscan_do_freq(freq: float) tuple[Quantity | None, Quantity | None][source]

Perform final conducted emission measurement for one frequency

Parameters:

freq – float; the frequency

Returns:

data; scuq object with final conducted emission data for this frequency

quit(log: Callable[[str], None] | None = None) None[source]

Exit the conducted emission measurement

Quits all devices in Graph :return: None

class conducted_emission_mpylab.ce.ce_plot(paths: Iterable[str] | None = None, limit_dct: dict | None = None, limit_legend: str | None = None, unit: str | None = None, margin: float = 6, fmin: float | None = None, fmax: float | None = None)[source]

Bases: object

Class providing plot facilities for Conducted Emission Measurement

__init__(paths: Iterable[str] | None = None, limit_dct: dict | None = None, limit_legend: str | None = None, unit: str | None = None, margin: float = 6, fmin: float | None = None, fmax: float | None = None) None[source]

Constructor for class ce_plot

Parameters:
  • paths – list or tuple; e.g. [‘L’, ‘N’]

  • limit_dct – dictionary with keys ‘freq’ and ‘limit’; both are lists (limit is a dB value)

  • limit_legend – str; provides the legend for the limit

  • unit – str; provides the unit of measurement

  • margin – float; dB value below limit

update_data_plot(typ: str, path: str, freqs: Iterable[float], data: Iterable[float]) None[source]

Update the plot with (freq, data) tuples for all freq in freqs

Parameters:
  • typ – str; ‘pre’ or ‘fin’ to indicate pre scan or final scan

  • path – str; e.g. ‘L’ or ‘N’

  • freqs – iterable; the frequencies

  • data – iterable; the data (dB values)

Returns:

None

quit() None[source]

Quit: set interactive mode off

Returns:

None

class conducted_emission_mpylab.ce.limitline(*args, **kwargs)[source]

Bases: Protocol

__init__(*args, **kwargs)