Giter VIP home page Giter VIP logo

delta-sigma-py's Introduction

StreamTestBench

A Python Test Bench for prototyping and visualizing stream-based Signal Processing Blocks.

isolated

While exploring some simple signal processing concepts on a small flash based 8bit microcontroller I found I was loosing momentum spinning in the burn-and-learn cycle. Derived from Harnesser's delta-sigma-py project, StreamTestBench attempts to isolate the signal processing block under investigation from both the testbench and the hardware so the developer can stay focused on the algorithm itself.

Instruments

  • function generator with sine, square, triangle, and random stream generation.
  • spectrum analyzer for displaying a single stream.
  • xy display for scope like visualization of a single stream.
  • testpoints for multi-stream display with a shared time axis.

Blocks

A Block is a single element in a signal processing chain that processes a stream of data. It is a container for the algorithms and code that the investigator is exploring. Inherit from it and add code necessary to explore the algorithm needed. The example blocks will give a good starting point.

example blocks

  • blocks/dsm.py Various Delta Sigma Modulators
  • blocks/math.py Multiply, addition, and inversion
  • blocks/filters.py Single pole IIR low pass filters

Data

Streams

All blocks get their input from and send their output to streams. The Stream class contains a numpy time array, a sample array, and the metadata needed by the blocks for processing the stream data. In addition, the Stream class is derived from a Listener which handles the work of shuffling the streams between blocks using an event system, placing very few requirements on the prototype.

Both float and integer sample data types are currently supported. The integer type is included to help identify rollover and rollover prevention techniques when porting to C on small microcontrollers.

Parameters

A Parameter is analogous to a single element stream. Parameters contain a single value that remains constant through the processing of a stream of samples. Corner frequency or filter coefficients would be good examples of parameters. Like the Stream class, Parameter is derived from a Listener and will alert its users to change. The filter.py example makes use of a slider parameter for setting corner frequency.

install

Altho installing isnt necessary, it allows a user's test-bench to be associated with their project rather than the clone.

  • activate a venv
  • pip install matplotlib
  • git clone https://github.com/coburnw/StreamTestBench.git
  • cd StreamTestBench
  • pip install --editable . # note the trailing dot to indicate current directory
  • pip uninstall StreamTestBench # to remove

Installing as editable make any changes to the repository, including git pull updates, take effect immediately.

use

All wiring and configuration of the testbench is done at the python level. Use the included example applications as a starting point.

A Reset Button is provided to reload the modulators.py module, so a small bit of live-coding can happen without having to kill and reload the Matplotlib window. Altho the reset button functions as expected, the importlib.reload does not fit with the new structure. This is a nice feature that needs to be reimplemented.

caveats

  • fft and snr code is from the original dsm focused project. Blindly applying it to a generic stream as attempted here may not be wise.
  • signal processing, or math for that matter, are not of my strong suits. The user would be remiss to think their results might represent reality without serious validation on their part.

Acknowlegements

  • StreamTestBench is derived from delta-sigma-py without which I would still be downloading to flash and cursing with each slip of the scope probe.

todo

  • reimplement the reload button
  • Investigate allowing stream meta change in gui
  • Generalize spectrum analyzer and validate
  • Plot a zoom-in of the baseband
  • Calculate the SNR over the baseband
  • Allow to store a previous FFT, and plot with the latest for easy comparisons

delta-sigma-py's People

Contributors

coburnw avatar harnesser avatar

delta-sigma-py's Issues

Licence

@Harnesser

Would you be open to a licence change on this fork of your project?

Ive made gross changes that make it easier to add new instruments and signal processing blocks and am thinking of posting them, but am a bit uncomfortable about giving up rights to the time spent. I was thinking of the AGPL, but would of course defer to you.

Regardless, ive made good progress on my projects due to your simulator. Thank you.

Coburn.

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.