Metadata-Version: 2.4
Name: mpylab
Version: 1.0.33
Summary: A framework to simplify development of measurement 'scripts' for measurements in laboratories over e.g pyvisa.
Author: Christian Albrecht, Stephan Pfennig, Oscar Rivera, Mathias Magdowski, Sophie Rautschek, Frank Schröder, Luzia Tesar, Yu Yu
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/mpylab.git
Project-URL: Documentation, https://mpylab-75fcff.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.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: bidict>=0.23.1
Requires-Dist: gpib-ctypes>=0.3.0
Requires-Dist: levenshtein>=0.27.1
Requires-Dist: matplotlib>=3.7.5
Requires-Dist: numpy>=1.24.4
Requires-Dist: pathvalidate>=3.3.1
Requires-Dist: ply>=3.11
Requires-Dist: psutil>=7.2.2
Requires-Dist: pydot>=4.0.1
Requires-Dist: pyparsing>=3.1.4
Requires-Dist: pyserial>=3.5
Requires-Dist: pyusb>=1.2.1
Requires-Dist: pyvisa>=1.14.1
Requires-Dist: pyvisa-py>=0.7.2
Requires-Dist: requests>=2.32.5
Requires-Dist: scipy>=1.10.1
Requires-Dist: scipy-stubs>=1.16.1
Requires-Dist: scuq>=1.0.10
Requires-Dist: simpleeval>=0.9.13
Requires-Dist: sphinx>=9.0.4
Requires-Dist: typing-extensions>=4.16.0
Requires-Dist: zeroconf>=0.148.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: coverage[toml]>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: black==26.5.1; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Provides-Extra: release
Requires-Dist: build; extra == "release"
Requires-Dist: twine; extra == "release"
Provides-Extra: docs
Requires-Dist: sphinx>=8.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: breathe; extra == "docs"
Provides-Extra: gui
Requires-Dist: PySide6>=6.9.2; extra == "gui"
Dynamic: license-file

# mpylab

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab/-/raw/155f092842168f1dbbf6cab13c2bf6d0d75bace9/docs/next/source/_static/branding/projects/mpylab/logo-inverse.svg">
  <img src="https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab/-/raw/155f092842168f1dbbf6cab13c2bf6d0d75bace9/docs/next/source/_static/branding/projects/mpylab/logo.svg" alt="MPyLab — Graph-Based Lab Measurements" width="480">
</picture>

<!-- project-badges:start -->
[![pipeline status](https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab/badges/main/pipeline.svg)](https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab/-/pipelines)
[![coverage](https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab/badges/main/coverage.svg?job=test)](https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab/-/jobs/artifacts/main/browse/htmlcov/?job=test)
[![PyPI version](https://img.shields.io/pypi/v/mpylab.svg)](https://pypi.org/project/mpylab/)
[![tested Python](https://img.shields.io/badge/tested%20Python-3.11%20--%203.15-blue.svg)](https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab/-/blob/main/ci/python-series.json)
[![documentation](https://img.shields.io/badge/docs-GitLab%20Pages-blue.svg)](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/)
<!-- project-badges:end -->

mpylab connects laboratory instruments, measurement procedures, and traceable results.

## Overview

Use mpylab to:

- describe instruments and signal paths in configurable measurement graphs;
- run TEM/GTEM, mode-stirred chamber, and amplifier measurements;
- retain physical units, uncertainties, and measurement history;
- try measurement workflows with virtual devices before using laboratory hardware;
- inspect configurations, convert calibration data, and generate reports.

mpylab is a Python framework. Applications such as
[TEMField](https://temfield-1012e2.gp.hrz.tu-chemnitz.de/) provide a graphical
measurement interface built on it.

Device test windows and the limit explorer include a project icon and a
nonmodal About dialog with version and documentation links. Quit follows each
tool's existing device shutdown path. See the
[GUI integration guide](docs/source/en/framework/gui-branding.rst) for using the
same pattern in an application.

## Installation

mpylab requires **Python 3.11 or newer**. Create and activate a virtual environment:

```sh
python -m venv .venv
source .venv/bin/activate
```

On Windows PowerShell, activate it with `.venv\Scripts\Activate.ps1` instead.
Install the published package and its Python dependencies:

```sh
python -m pip install mpylab
```

For the limit explorer, device test windows and Qt measurement interfaces,
install the optional GUI dependencies:

```sh
python -m pip install "mpylab[gui]"
```

The base installation supports non-GUI workflows without PySide6 or Shiboken.

The [installation guide](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/en/getting-started/index.html)
covers platform-specific steps and installation from GitLab. Communication
backends for real instruments depend on the laboratory setup.

## First steps

Try a complete measurement and evaluation with virtual instruments. The example
scripts and configurations are provided in the repository; obtaining them requires Git.
Keep the virtual environment activated, then run:

```sh
git clone https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab.git
cd mpylab
python script/tem-verification.py script/conf/tem-gtem-verification-virtual/conf.py
```

The example needs no instruments or operator input. A successful measurement ends with:

```text
End of TEM verification. Status: 0
```

Results and logs are written below `script/conf/tem-gtem-verification-virtual/output/`.
Inspect the available report sections in the resulting history:

```sh
mpylab-tem-report script/conf/tem-gtem-verification-virtual/output/tem-verification-virtual.p --list-sections
```

Continue with the [first-run guide](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/en/getting-started/index.html#a-safe-first-run)
for output files, reporting, and the steps required before real hardware use.

## Command-line interface

Installing mpylab provides the following commands. Replace example input paths
with your own files; run any command with `--help` for its complete options.

| Command | Purpose | Example |
|---|---|---|
| `mpylab-config-show` | Display the effective configuration without running a measurement. | `mpylab-config-show measurement.py setup.py` |
| `mpylab-config-check` | Validate an inventoried configuration package without hardware access. | `mpylab-config-check config-checks.toml` |
| `mpylab-dot-migrate` | Check or migrate legacy DOT condition identifiers. | `mpylab-dot-migrate --check setup.dot` |
| `mpylab-nport-migrate` | Check or migrate legacy NPORT INI settings. | `mpylab-nport-migrate --check cable.ini` |
| `mpylab-nport-check` | Check NPORT frequency coverage, sampling, and interpolation. | `mpylab-nport-check cable.ini --json-report nport-quality.json` |
| `mpylab-vna2dat` | Convert VNA CSV or Touchstone exports into correction-data files. | `mpylab-vna2dat cable.s2p --parameter S21 --dry-run` |
| `mpylab-tem-report` | Inspect TEM history sections or generate measurement reports. | `mpylab-tem-report history.p --list-sections` |
| `mpylab-limit-explorer` | Open the graphical browser for emission limits (requires `[gui]`). | `mpylab-limit-explorer` |
| `mpylab-visa-probe` | Open one explicitly selected VISA instrument, optionally sending a query. | `mpylab-visa-probe --help` |

The migration commands show a dry-run diff by default; `--check` checks without
writing, and `--write` applies changes. `mpylab-visa-probe` accesses real hardware
when given an instrument resource; its example above only displays help.

## Documentation

- [Getting started — English](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/en/getting-started/index.html)
  / [Deutsch](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/de/getting-started/index.html)
  — installation and a first virtual measurement.
- [Measurement workflows](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/en/measurements/index.html)
  — TEM/GTEM, mode-stirred chamber, and amplifier procedures.
- [Configurations](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/en/configuration/index.html)
  — DOT graphs, device INIs, calibration data, validation, and VNA conversion.
- [Results and reports](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/en/results/index.html)
  — history files, evaluated data, immunity interchange, and report generation.
- [Framework guide](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/en/framework/index.html)
  and [API reference](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/api/index.html)
  — architecture, drivers, measurement classes, and extension points.

## Help and contributing

Start with [troubleshooting](https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/en/help/troubleshooting.html)
or report a problem through the [issue tracker](https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab/-/issues).
For development setup and checks, see [CONTRIBUTING.md](CONTRIBUTING.md).

Original author and principal developer: **Hans Georg Krauthäuser**
([hgk@ieee.org](mailto:hgk@ieee.org)), Chair for Electromagnetic Theory and
Compatibility, Technische Universität Dresden.
See [CONTRIBUTORS.md](CONTRIBUTORS.md) for contributor acknowledgements and roles.

## License

mpylab is distributed under [GPL-3.0-or-later](LICENSE).
