Generate, visualise and analyse Lissajous figures using python and oscilloscope.
Project description
lisspyscope
A compact Python library for synthesising, visualising and analysing Lissajous figures.
Overview
lisspyscope produces phase–accurate, gap-free stereo signals whose x-y trace on an oscilloscope forms a mathematically closed Lissajous curve.
It was developed to support undergraduate laboratories on coupled oscillations and phase relationships. The library provides reproducible, phase-accurate audio–visual stimuli that align with learning objectives in introductory and intermediate physics courses.
Installation
# audio only
pip install lisspyscope
# audio + plotting support
pip install lisspyscope[plot]
All wheels are pure-Python; no compilation step is required.
Core Features
- Auto-closing buffers The generator computes the least-common-multiple of channel periods so every trace starts and ends at identical phase.
- Exact single-buffer looping Continuous playback uses the same closed buffer, ensuring no clicks, drifts or cumulative phase error.
- Lightweight dependency stack
- Deterministic output – Given identical parameters and NumPy version, the generated buffer is bit-for-bit reproducible.
API Summary
| Function | Purpose | Key Parameters |
|---|---|---|
generate_lissajous() |
Return (buffer, sr)—float32 stereo NumPy array. |
base_freq, l_fact, r_fact, phase_deg, sr |
play_lissajous() |
Loop the buffer indefinitely (blocking). | as above |
plot_lissajous() |
Render the trace with Matplotlib. | as above |
Parameter Reference
| Name | Type | Default | Meaning |
|---|---|---|---|
base_freq |
float | 1,000 Hz | Base frequency |
l_fact |
int | 1 | Left/X multiplier f_x = l_fact . base_freq |
r_fact |
int | 1 | Right/Y multiplier f_y = r_fact . base_freq |
phase_deg |
float | 90° | Phase offset of f_y. |
sr |
int | 48,000 | Sample rate (samples s⁻¹). |
Minimal Working Examples
import lisspyscope as ls
# 1. Classic circle (1 : 1, 90°)
ls.plot_lissajous() # non-blocking figure
ls.play_lissajous() # endless tone, Ctrl-C to stop
# 2. Generate waves with 1 : 3 frequency ratio with 45° phase
ls.plot_lissajous(base_freq=500, l_fact=1, r_fact=3, phase_deg=45)
# 3. Retrieve closed buffer for custom analysis
buf, sr = ls.generate_lissajous(base_freq=250, l_fact=1, r_fact=4, phase_deg=0)
# buf.shape → (192, 2) for 250 Hz at 48 kHz
License
MIT—you are free to use, modify and distribute, provided the copyright notice is retained.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lisspyscope-0.1.1.tar.gz.
File metadata
- Download URL: lisspyscope-0.1.1.tar.gz
- Upload date:
- Size: 22.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1842404cd99cc573a2aac8dc586deb1de2fcd3605c18160fdaecccc314e4ed15
|
|
| MD5 |
d9b3976c66b8d12c79b38a13d6501360
|
|
| BLAKE2b-256 |
ad7e81b3d510d29ab9b6b96a0b19856c71507437bf745de381a04957666d4a42
|
File details
Details for the file lisspyscope-0.1.1-py3-none-any.whl.
File metadata
- Download URL: lisspyscope-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3189f14b700c32a7b9007dff0971484cbed2432bb1482c11e41cee075a3d6d5
|
|
| MD5 |
ca2f0de661b1df7299847417e3ba08b4
|
|
| BLAKE2b-256 |
8221fa9bde06fbffb20dfe70ae6265230062b3dcd0d803d620dc1b6a2423afb2
|