summaryrefslogtreecommitdiff
path: root/liboctopus/python/demos/reader/test.py
blob: 7ecdec05c52d97cfc58c9440c692444f506045bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
import time
import numpy as np
from octopus import *


op=octopus_context()
octopus_init(op)
octopus_open(op)
octopus_adc_init(op, 33)
octopus_adc_ref(op, 2)



buf = []
for i in range(200):
    buf.append( octopus_adc_get(op, 33) )
    time.sleep(0.01)
    print i, buf[-1]

signal = np.array(buf)
fourier = np.fft.fft(signal)
n = signal.size
freq = np.fft.fftfreq(n, 0.1)
print fourier
print freq