Metadata-Version: 2.1
Name: fluke5440b-async
Version: 1.0.3
Summary: A Python asyncio library for the Fluke 5440B voltage calibrator.
Author-email: Patrick Baus <patrick.baus@physik.tu-darmstadt.de>
License: GNU General Public License v3 (GPLv3)
Project-URL: Homepage, https://github.com/PatrickBaus/pyAsyncFluke5440B
Project-URL: Bug Tracker, https://github.com/PatrickBaus/pyAsyncFluke5440B/issues
Project-URL: Download, https://github.com/PatrickBaus/pyAsyncFluke5440B/releases
Keywords: Fluke 5440B,GPIB,API
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Topic :: Home Automation
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typing-extensions; python_version < "3.11"
Provides-Extra: linux-gpib
Requires-Dist: async-gpib; extra == "linux-gpib"
Requires-Dist: gpib-ctypes; extra == "linux-gpib"
Provides-Extra: prologix-gpib
Requires-Dist: prologix-gpib-async; extra == "prologix-gpib"
Provides-Extra: dev
Requires-Dist: async-gpib; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: gpib-ctypes; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: prologix-gpib-async; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Requires-Dist: twine; extra == "dev"
Provides-Extra: doc
Requires-Dist: myst-parser; extra == "doc"
Requires-Dist: sphinx; extra == "doc"
Provides-Extra: test
Requires-Dist: mypy; extra == "test"
Requires-Dist: pylint; extra == "test"
Requires-Dist: gpib-ctypes; extra == "test"
Requires-Dist: prologix-gpib-async; extra == "test"
Requires-Dist: setuptools; extra == "test"

[![pylint](../../actions/workflows/pylint.yml/badge.svg)](../../actions/workflows/pylint.yml)
[![PyPI](https://img.shields.io/pypi/v/fluke5440b_async)](https://pypi.org/project/fluke5440b_async/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/fluke5440b_async)
![PyPI - Status](https://img.shields.io/pypi/status/fluke5440b_async)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](LICENSE)
[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
# fluke5440b-async
Python3 asyncio Fluke 5440B driver. This library requires Python [asyncio](https://docs.python.org/3/library/asyncio.html) and asyncio library for the GPIB adapter.

The library is fully type-hinted.

> :warning: The following features are not supported (yet):
> - External calibration: I do not have the means to test this. If you want to help, open a ticket and we can get this done
> - Setting and retrieving DUUT tolerances and errors. I believe this is best done in software on the host computer and not done internally in the calibrator. If you really need that featuer open a ticket.

## Supported GPIB Hardware
| Device                                                                              |Supported|Tested|Comments|
|-------------------------------------------------------------------------------------|--|--|--|
| [asyncio Prologix GPIB library](https://github.com/PatrickBaus/pyAsyncPrologixGpib) |:heavy_check_mark:|:heavy_check_mark:|  |
| [asyncio linux-gpib wrapper](https://github.com/PatrickBaus/pyAsyncGpib)            |:heavy_check_mark:|:heavy_check_mark:|  |

Tested using Linux, but should work on Mac OSX, Windows or any OS with Python support.

## Documentation
The full documentation can be found on GitHub Pages:
[https://patrickbaus.github.io/pyAsyncFluke5440B/](https://patrickbaus.github.io/pyAsyncFluke5440B/). I use the
[Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) style for documentation and
[Sphinx](https://www.sphinx-doc.org/en/master/index.html) for compiling it.

# Setup
To install the library in a virtual environment (always use venvs with every project):
```bash
python3 -m venv env  # virtual environment, optional
source env/bin/activate  # only if the virtual environment is used
pip install fluke5440b-async
```

All examples assume that a GPIB library is installed as well. Either run
```bash
pip install prologix-gpib-async    # or alternatively
# pip install async-gpib
```

# Usage
> :warning: The calibrator does not like excessive serial polling. So, when using the Prologix adapter, one might see warnings like this:
> *Got error during waiting: ErrorCode.GPIB_HANDSHAKE_ERROR. If you are using a Prologix adapter, this can be safely ignored at this point.*
> These are harmless and can be ignored.

The library uses an asynchronous context manager to make cleanup easier. You can use either the
context manager syntax or invoke the calls manually:

```python
async with Fluke_5440B(connection=gpib_device) as fluke5440b:
    # Add your code here
    ...
```

```python
try:
    fluke5440b = Fluke_5440B(connection=gpib_device)
    await fluke5440b.connect()
    # your code
finally:
    await fluke5440b.disconnect()
```


A simple example for setting the output voltage.
```python
from pyAsyncFluke5440B.Fluke_5440B import Fluke_5440B

from pyAsyncGpib.pyAsyncGpib.AsyncGpib import AsyncGpib


# This example will print voltage data to the console
async def main():
    # The default GPIB address is 7.
    async with Fluke_5440B(connection=AsyncGpib(name=0, pad=7)) as fluke5440b:
        # No need to explicitely bring up the GPIB connection. This will be done by the instrument.
        await fluke5440b.set_output(10.0)
        await fluke5440b.set_output_enabled(True)


try:
    asyncio.run(main(), debug=True)
except KeyboardInterrupt:
    # The loop will be canceled on a KeyboardInterrupt by the run() method, we just want to suppress the exception
    pass
```

See [examples/](examples/) for more working examples.

## Versioning

I use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](../../tags).

## Authors

* **Patrick Baus** - *Initial work* - [PatrickBaus](https://github.com/PatrickBaus)

## License


This project is licensed under the GPL v3 license - see the [LICENSE](LICENSE) file for details
