lightnings demo
This commit is contained in:
@@ -7,6 +7,8 @@ __javascript__/
|
|||||||
|
|
||||||
*.wav
|
*.wav
|
||||||
.idea/
|
.idea/
|
||||||
|
*.npy
|
||||||
|
*.npz
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/env python3
|
||||||
|
import time
|
||||||
|
|
||||||
|
import gex
|
||||||
|
import numpy as np
|
||||||
|
from matplotlib import pyplot as plt
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from scipy.io import wavfile
|
||||||
|
|
||||||
|
# ADC channel 1 -> 100n -> o -> long wire (antenna)
|
||||||
|
# |
|
||||||
|
# '-> 10k -> GND
|
||||||
|
|
||||||
|
def capture(tr):
|
||||||
|
now=datetime.datetime.now()
|
||||||
|
now.isoformat()
|
||||||
|
data = tr.data
|
||||||
|
print("Capture! ")
|
||||||
|
print(data)
|
||||||
|
np.save("lightning-%s"%now.isoformat(), data)
|
||||||
|
|
||||||
|
with gex.Client(gex.TrxRawUSB()) as client:
|
||||||
|
adc = gex.ADC(client, 'adc')
|
||||||
|
|
||||||
|
adc.on_trigger(capture)
|
||||||
|
adc.setup_trigger(1,
|
||||||
|
level=500,
|
||||||
|
count=1000,
|
||||||
|
edge='rising',
|
||||||
|
pretrigger=250,
|
||||||
|
holdoff=500,
|
||||||
|
auto=True)
|
||||||
|
|
||||||
|
adc.arm()
|
||||||
|
|
||||||
|
sec = 0
|
||||||
|
while True:
|
||||||
|
print('%d s' % sec)
|
||||||
|
sec += 1
|
||||||
|
time.sleep(1)
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/env python3
|
||||||
|
import time
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import gex
|
||||||
|
import numpy as np
|
||||||
|
from matplotlib import pyplot as plt
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from scipy.io import wavfile
|
||||||
|
|
||||||
|
data = np.load(sys.argv[1])
|
||||||
|
plt.plot(data, 'r-', lw=1)
|
||||||
|
plt.show()
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#!/bin/env python3
|
|
||||||
import time
|
|
||||||
|
|
||||||
import gex
|
|
||||||
import numpy as np
|
|
||||||
from matplotlib import pyplot as plt
|
|
||||||
|
|
||||||
from scipy.io import wavfile
|
|
||||||
|
|
||||||
# def show(tr):
|
|
||||||
# data = tr.data
|
|
||||||
# data = np.add(data / 4096, -0.5)
|
|
||||||
# plt.plot(data, 'r-', lw=1)
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
with gex.Client(gex.TrxRawUSB()) as client:
|
|
||||||
adc = gex.ADC(client, 'adc')
|
|
||||||
|
|
||||||
adc.on_trigger(lambda tr: print(tr.data))
|
|
||||||
adc.setup_trigger(1,
|
|
||||||
level=3500,
|
|
||||||
count=500,
|
|
||||||
edge='rising',
|
|
||||||
pretrigger=100,
|
|
||||||
holdoff=100,
|
|
||||||
auto=True)
|
|
||||||
|
|
||||||
adc.arm()
|
|
||||||
|
|
||||||
while True:
|
|
||||||
print('tick')
|
|
||||||
time.sleep(1)
|
|
||||||
Reference in New Issue
Block a user