Metadata-Version: 2.4
Name: temfield_mpylab
Version: 0.0.11
Summary: Radiated Susceptibility in (G)TEM cells using MpyLab
Author-email: Hans Georg Krauthäuser <hgk@ieee.org>
Maintainer-email: Hans Georg Krauthäuser <hgk@ieee.org>
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://www.tu-dresden.de/et/tet
Project-URL: Repository, https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/TEMField.git
Project-URL: Documentation, https://temfield-1012e2.gp.hrz.tu-chemnitz.de/
Keywords: pyvisa,gpib,measurements,laboratory
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matplotlib>=3.9.4
Requires-Dist: mpylab>=1.0.17
Requires-Dist: numpy>=2.0.2
Requires-Dist: pyside6>=6.10.1
Requires-Dist: scuq>=0.9.1
Provides-Extra: docs
Requires-Dist: sphinx>=8.0; extra == "docs"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Provides-Extra: release
Requires-Dist: build>=1.2; extra == "release"
Requires-Dist: twine>=6.2; extra == "release"
Requires-Dist: wheel; extra == "release"
Dynamic: license-file

# TemField

Radiated EMC susceptibility measurements in (G)TEM waveguides using **mpylab**

This software is distributed unter GPL-3 or higher. See LICENSE for details.

## Installation

```bash
pip install temfield-mpylab
```

For an isolated application-style installation, `pipx` is also useful:

```bash
pipx install temfield-mpylab
```

This installs the package in its own environment and exposes the command line
tools `temfield` and `temfield-info` on your `PATH`.

## Command line

Start the GUI with:

```bash
temfield
```

Show installation and dependency information with:

```bash
temfield-info
```

Use `temfield-info --json` for machine-readable output.

## AM headroom safety check

Before modulation is enabled, TEMField first levels the unmodulated field to
the AM peak factor. For 80 % AM this is `1.8 * E_target`. It then reduces the
signal-generator output by 5.1 dB and checks the resulting decrease. A
configured forward-power meter provides the normative IEC 61000-4-20 check;
otherwise the field probe is used as an explicitly non-normative proxy. After
a passed check, TEMField levels once more to the requested carrier field and
only then enables AM. Failed leveling or headroom checks keep AM off and switch
RF off for that frequency.

TEMField asks `mpylab.tools.am_headroom` to apply the
`uncertainty_overlap` decision with coverage factor `k = 2` to both methods.
The nominal accepted interval is not widened. Instead, mpylab propagates the
uncertainty of the high-to-reduced ratio and classifies an outside nominal
value as `passed_with_uncertainty` only when its expanded interval overlaps
the accepted interval. An expanded interval wholly below or above the
accepted range remains a failure. Shared calibration contributions are
retained as correlated SCUQ components and can cancel in the ratio;
independent acquisition scatter remains.

The log and JSON result distinguish `passed`, `passed_with_uncertainty`,
`failed_below_interval`, and `failed_above_interval` and record the standard
and expanded asymmetric uncertainties, decision interval, rule, coverage
factor, method, and normative flag.

## Field-probe orientation

TEMField interprets `x`, `y`, and `z` in the GUI, leveling, waveform plot, and
result files as **TEM-cell axes**. The physical probe orientation can be
defined on its DOT node:

```dot
prb [ini="fieldprobe.ini"
     probe_axis_map="cell_x:+probe_y,cell_y:+probe_x,cell_z:-probe_z"]
```

The same `probe_axis_map` may be placed in the `DESCRIPTION` or `Init_Value`
section of a `FIELDPROBE` INI file. Programmatic users can pass a direct or
per-node `probe_orientations` mapping to `TEMFieldWorker` or
`TestSusceptibility.Init`. TEMField examines configuration, DOT, and INI
sources together. Equal definitions are accepted and retained as provenance;
contradictory definitions stop the run before hardware initialization. The
selected source and cell-from-probe transformation are written to the log and
stored with each disturbance record.

Current field-probe drivers return unsigned component magnitudes. Therefore
TEMField supports axis permutations (including `+`/`-` syntax, with signs
ignored for magnitudes), but deliberately rejects arbitrary rotation matrices.
Such rotations require synchronous signed vector data and cannot be recovered
from three component magnitudes.

## EUT monitoring

TEMField uses the shared `mpylab.env.eut` API. Manual EUT reporting is
always available in the GUI and may be supplemented by automatic monitors for
cameras, communication links, or process data. Automatic monitors run behind
`ThreadedEUTMonitor`; they never access `MGraph` or switch RF themselves.

During exposure, the operator can report `Degraded`, `Failed`, or `Not
evaluable`. After an impairment, TEMField switches AM and RF off and separately
records the post-exposure state and recovery method. The table reports the
result for performance criterion A, B, or C and includes the structured events
in its tooltip. The post-exposure timeout is configurable in the EUT panel. A
safety event is routed immediately through the measurement worker's RF-off
path.

`RandomEUTMonitor` provides reproducible hardware-independent simulations and
a starting point for custom automatic monitors. It must not be used as evidence
of real EUT performance.

An application embedding the window can configure an automatic monitor before
the measurement starts:

```python
from mpylab.env.eut import RandomEUTMonitor

window.set_automatic_eut_monitor(RandomEUTMonitor(seed=42))
```

## Structured results

Saving the measurement table writes both the selected CSV file and a JSON file
with the same stem. The JSON document preserves quantities as `value`,
`uncertainty`, and `unit` and includes the EUT event history and performance
assessment.

The shared `mpylab.env.immunity_result` schema calls the applied test quantity
`disturbance`. Its
`quantity_kind`, `target`, and freely named `measured_components` are not tied
to an electric field. TEMField currently records `electric_field_strength`
with its measured probe components. The same format can represent, for
example, `injected_current` in A or an applied voltage in a future conducted
immunity application.

## License

GPL-3 or higher

## Repository

[https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/TEMField.git](https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/TEMField.git)

## Documentation

[https://temfield-1012e2.gp.hrz.tu-chemnitz.de/](https://temfield-1012e2.gp.hrz.tu-chemnitz.de/)


## Contact

Prof. Dr. Hans Georg Krauthäuser (hgk@ieee.org)  
Chair for Electromagnetic Theory and Compatibility  
Technische Universität Dresden, Dresden, Germany
