An oscilloscope for python that just works™
Project description
Oscilloscope
An oscilloscope for python that just works™
Features
Simple to use
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.
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.
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
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
pip install oscilloscope
MIT Licence
Python 3.6+ only.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file oscilloscope-0.0.3.tar.gz
.
File metadata
- Download URL: oscilloscope-0.0.3.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50b269560d11d90c2b6b3ed428f4f88a17f7a9a55cdce9eca473164333c6af1e |
|
MD5 | 441e6ed2a9240dd73bd0291dadfb9689 |
|
BLAKE2b-256 | cdd5595c821e50887d889cec3711b2cd4c22c3492fdeb20f40dcd9d6ddf70028 |
File details
Details for the file oscilloscope-0.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: oscilloscope-0.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ed16c8098a0f28bb039538a41bea989724e4d223d50e401a56078818c5dba47 |
|
MD5 | 74251c3de09bc64030defd4a631c1189 |
|
BLAKE2b-256 | 2cd17cc9c47cc36e55b3c72e85c995257485c738ef8a64e8262c6223ae099207 |