# pydwf
This is *pydwf*, a Python wrapper for the Digilent Waveforms library to control their line of
multi-function lab devices. It fully implements all functionality offered by the underlying
C library (over 400 functions!) in an easy-to-use Python API.
The package offers a convenient command line tool that can be used, among other things, to list
the available Digilent devices and their configurations. The package comes with documentation
(still sparse, but improving) and ready-to-run, well-written examples (already very useful),
demonstrating how to use *pydwf* to perform common measurements.
Like the DWF library, the *pydwf* package supports Windows, Linux (Intel and AMD), and macOS.
## Supported devices
The *pydwf* package has been extensively tested with the Analog Discovery 2 and Digital Discovery
devices. It should also work with other devices, like the legacy Analog Discovery, the Analog Discovery
Studio (formerly known as the *Electronics Explorer*), and the new Analog Discovery Pro devices,
but these haven't been tested.
If you have such a device and encounter problems, please report an issue on the
[Github issue tracker](https://github.com/sidneycadot/pydwf/issues).
## Dependencies
The *pydwf* package requires Python 3.6 or higher.
In order for *pydwf* to work, recent versions of the the Digilent Adept and Digilent Waveforms packages
must be installed. These provide the C libraries that *pydwf* uses to interact with devices. Generally
speaking, if the Waveforms GUI application provided by Digilent works on your system, you're good to go.
*pydwf* depends on the *numpy* package to handle the considerable amount of data travelling between the
PC and Digilent devices when doing high-speed signal generation or capture.
Some of the examples depend on the *matplotlib* library, but *pydwf* itself will work without it.
## Project hosting
The project repository and issue tracker are hosted on github:
https://github.com/sidneycadot/pydwf/
## Installation using *pip*
The installable package is hosted on PyPI:
https://pypi.org/project/pydwf/
This allows installation using the standard *pip* (or *pip3*) tool:
```
pip install pydwf
```
After installing *pydwf*, the following command will show the version of *pydwf* and the
underlying DWF library:
```
python -m pydwf version
```
The following command will list all Digilent devices connected to the system, and list
their configurations:
```
python -m pydwf list -c
```
## Documentation
The project documentation is hosted on *readthedocs* and can be reached via the following link:
https://pydwf.readthedocs.io/en/latest/
If desired, the documentation can also be installed locally after installing the package by
executing the following command:
```
python -m pydwf extract-html-docs
```
This will create a local directory called *pydwf-docs-html* containing the project documentation
in HTML format.
Please note that the documentation is not yet complete — it's a big API!
## Examples
The Python examples can easily be installed locally after installing the package
by executing the following command:
```
python -m pydwf extract-examples
```
This will create a local directory called *pydwf-examples* containing the Python examples that
demonstrate many of the capabilities of the Digilent devices and *pydwf*.
These examples are intended as a useful starting point for your own Python scripts.