Git Product home page Git Product logo

dwfpy's Introduction

Python Bindings for Digilent WaveForms API

build docs

DwfPy is a Python package that allows you to access Digilent WaveForms devices via Python. It provides a low-level API with complete access to the Digilent WaveForms API, and also a simple but powerful high-level API, which allows you to configure WaveForms devices with a single statement.

For instance, to output a 1kHz sine-wave on a Analog Discovery 2, you can simply write:

import dwfpy as dwf

with dwf.AnalogDiscovery2() as device:
    print('Generating a 1kHz sine wave on WaveGen channel 1...')
    device.analog_output['ch1'].setup('sine', frequency=1e3, amplitude=1, start=True)
    input('Press Enter key to exit.')

Features

  • Pythonic abstraction of Digilent Waveforms API.
  • Low-level API with complete access to the Digilent Waveforms API.
  • Powerful high-level API that supports one-line configuration statements.
  • Supports all sub-modules, such as oscilloscope, arbitrary waveform generator, logic analyzer, pattern generator, digital I/O, and power supplies.
  • Works with all WaveForms devices, such as the Analog Discovery 2 or the Digital Discovery.

Installing DwfPy

You can install the DwfPy package from PyPI using pip:

pip install dwfpy

In order to use the DwfPy package, you need Python 3.6 or higher.

As DwfPy builds on top of the WaveForms API, you need to install the WaveForms software, which includes the required runtime components to access the WaveForms devices.

The source code for the DwfPy package can be found at GitHub at https://github.com/mariusgreuel/dwfpy.

Examples

You can find Python examples using DwfPy in the dwfpy GitHub repository at https://github.com/mariusgreuel/dwfpy/tree/main/examples.

Documentation

You can find the DwfPy user's guide at https://dwfpy.readthedocs.io/.

Detailed information about the Digilent Waveforms API is available from the Digilent WaveForms SDK Reference Manual.

Getting help

For issues with DwfPy, please visit the dwfpy issue tracker.

dwfpy's People

Contributors

evanblum avatar mariusgreuel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dwfpy's Issues

Use of Digital Trigger for Analog Acquisition

Is it possible to use the digital input trigger to start the acquisition of the analog channels? I know this is possible via Waveforms, but I would like to acquire data in a more defined fashion. The analog_in_record.py example uses either channel 0 or 1 for the trigger:

  scope[0].setup(range=5)
  scope.setup_edge_trigger(
      mode='normal', channel=0, slope='rising', level=0, hysteresis=0.01, position=-0.25
  )
  recorder = scope.record(sample_rate=100e3, length=2, configure=True, start=True)

Is there a way to change the trigger channel source to logic.setup_trigger(source='detector-digital-in') or an equivalent digital pin?

Data recording on specific channels

Hi @mariusgreuel! Could you please confirm the functionality of data recording on dwfpy?
I would like to simultaneously record information for 7 digital input channels.
From what I can understand, the following line of code:
logic.record(sample_rate=10e3, sample_format=32,sample_count=SAMPLE_COUNT // 2,prefill=SAMPLE_COUNT // 2, start=True) records only a single np.ndarray with the number of specified samples. How does the API decide which channel to record, and how do I selectively record a specific digital-input.

Your help would be highly appreciated.

Inclusion of Analog Discovery 3

After downloading the source and trying to make edits to duplicate instances of AnalogDiscovery2 and ANALOG_DISCOVERY2 to include references to the new AD3, I still wound up with some issues access the device with the dwfpy package. With that said, all is not lost. For those interested the core functionality appears to still be maintained with the core dwf.Device class. I'm sure there is some functionality that is lost but it can still work to some degree.

I didn't go through all of the examples, but for my limited usage (i.e., just the waveform out channels and the scope functions), the following appears to work:

with dwf.Device() as device:    
    print(f'Found device: {device.name} ({device.serial_number})')

    scope = device.analog_input
    wavegen = device.analog_output
    ##....Do your thing....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.