Compare commits
No commits in common. "d8164d120f1a0abb968240fc8f739b59aa966427" and "638afadf11fcccb35e424cf0e87f5e8d712c08f9" have entirely different histories.
d8164d120f
...
638afadf11
12
test/fft.py
Executable file
12
test/fft.py
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/env python3
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
data = []
|
||||
|
||||
with open("test", "rb") as f:
|
||||
data = np.fromfile(f, dtype=np.int16)
|
||||
|
||||
plt.psd(data, Fs=1e6)
|
||||
plt.show()
|
Binary file not shown.
Before Width: | Height: | Size: 37 KiB |
Binary file not shown.
Before Width: | Height: | Size: 59 KiB |
Binary file not shown.
Before Width: | Height: | Size: 62 KiB |
@ -1,32 +0,0 @@
|
||||
# this script helps to verify if the 2 channels of
|
||||
# the picoscope are sampled synchronously (as stated in the datasheet)
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# the input is the same square wave on both channels
|
||||
# stored as an array of pairs of float32-s
|
||||
data = np.fromfile("sync_test.bin", dtype=np.float32)
|
||||
|
||||
# if the i and q channels are perfectly indetical and in sync
|
||||
# their difference should be const 0
|
||||
diff = data[0::2] - data[1::2]
|
||||
plt.plot(diff[:10000], label="I - Q")
|
||||
plt.title("Difference of channels")
|
||||
plt.legend()
|
||||
plt.show()
|
||||
# this is not exactly the case, channel b seems to be
|
||||
# a higher value at the changes in the signal
|
||||
# maybe the two channels are sampled synchronously
|
||||
# but with a small delay (less than a sample length)
|
||||
|
||||
# if the signals are sampled with
|
||||
plt.figure()
|
||||
corr = np.correlate(data[0::2][:10000], data[1::2][:10000], mode="full")
|
||||
print(f"Index of maximum (starting from 0, to 10000):", np.argmax(corr))
|
||||
# 9999 -> index of last element in the array -> complete overlap without offset
|
||||
plt.plot(corr)
|
||||
plt.title("Correlation")
|
||||
plt.show()
|
||||
# the maximum of the correlation is when the two signals perfectly overlap without
|
||||
# and offset, this means that they are sampled at the same time
|
12
test/view.py
Executable file
12
test/view.py
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/env python3
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
data = []
|
||||
|
||||
with open("test", "rb") as f:
|
||||
data = np.fromfile(f, dtype=np.int16)
|
||||
|
||||
plt.plot(data[:10000])
|
||||
plt.show()
|
Loading…
Reference in New Issue
Block a user