mirror of
https://github.com/jonathanhogg/scopething
synced 2025-07-14 03:02:09 +01:00
Extend README as people seem to be suddenly looking at this code; remove cruft from analysis test script.
This commit is contained in:
19
test.py
19
test.py
@ -1,26 +1,12 @@
|
||||
|
||||
import numpy as np
|
||||
from pylab import figure, plot, show
|
||||
|
||||
from analysis import annotate_series
|
||||
from scope import await_, capture, main
|
||||
from utils import DotDict
|
||||
|
||||
|
||||
await_(main())
|
||||
|
||||
# o = 400
|
||||
# m = 5
|
||||
# n = o * m
|
||||
# samples = square_wave(o)
|
||||
# samples = np.hstack([samples] * m) * 2
|
||||
# samples = np.hstack([samples[100:], samples[:100]])
|
||||
# samples += np.random.normal(size=n) * 0.1
|
||||
# samples += np.linspace(4.5, 5.5, n)
|
||||
# series = DotDict(samples=samples, sample_rate=1000000)
|
||||
|
||||
data = capture(['A'], period=20e-3, nsamples=2000)
|
||||
series = data.A
|
||||
series = capture(['A'], period=20e-3, nsamples=2000).A
|
||||
|
||||
figure(1)
|
||||
plot(series.timestamps, series.samples)
|
||||
@ -35,6 +21,7 @@ if annotate_series(series):
|
||||
print(f"Found {waveform.frequency:.0f}Hz {waveform.shape} wave, "
|
||||
f"with amplitude ±{waveform.amplitude:.2f}V and offset {waveform.offset:.2f}V")
|
||||
|
||||
plot(waveform.timestamps + waveform.capture_start - series.capture_start, waveform.samples * waveform.amplitude + waveform.offset)
|
||||
plot(waveform.timestamps + waveform.capture_start - series.capture_start,
|
||||
waveform.samples * waveform.amplitude + waveform.offset)
|
||||
|
||||
show()
|
||||
|
Reference in New Issue
Block a user