Coder Social home page Coder Social logo

oscilloscope's Introduction

Oscilloscope

An oscilloscope for python that just works™

Features

Simple to use

This

import random
from time import sleep

from oscilloscope import Osc

osc = Osc()


@osc.signal
def simple_random_signal(state):
    while True:
        state.draw(random.random())
        sleep(0.1)


osc.start()

Gives you this

Parallel compute

Each osc.signal gets it's own process.

This

import random
from time import sleep

from oscilloscope import Osc


osc = Osc(nrows=2, ncols=3)


@osc.signal
def signal1(state):
    while True:
        state.draw((random.random())
        sleep(0.1)


@osc.signal
def signal2(state):
    while True:
        state.draw(random.random(), row=1, col=2)
        sleep(0.1)


osc.start()

Gives you this

P.S. Don't worry about race conditions, state.draw() is atomic. (See zproc)

Dynamic axis scale

The Y-axis's scale is dynamic, meaning that the graph's y axis scales with your signal.

This

import random
from time import sleep

from oscilloscope import Osc


# adjust window_sec and intensity to improve visibility
osc = Osc(window_sec=10, intensity=1)


@osc.signal
def increasing_signal(state):
    delta = 1

    while True:
        state.draw(random.randint(-delta, delta))
        delta += 5
        sleep(0.01)


osc.start()

Gives you this

Automatic normalization

This

import random
from time import sleep

from oscilloscope import Osc


# turn on normalization
osc = Osc(normalize=True)


@osc.signal
def increasing_signal(state):
    delta = 1

    while True:
        state.draw(random.randint(-delta, delta))
        delta += 5
        sleep(0.01)


osc.start()

Gives you this

This was the same signal as the [earlier](#Automatic normalization) one, but it looks a lot like the simple example, because we turned on normalization!

The Y-axis will now show, % max-amplitude encountered at the time, not the raw value.

Install

PyPI

pip install oscilloscope

MIT Licence
Python 3.6+ only.


🐍🏕️

oscilloscope's People

Contributors

devxpy avatar

Watchers

James Cloos avatar

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.