lightnings demo

master
Ondřej Hruška 7 years ago
parent 82ae5d9b6c
commit 5f3e47bcaa
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 2
      .gitignore
  2. 41
      demo_adc_lightnings.py
  3. 15
      show_nparray.py
  4. 32
      test_adc_trig.py

2
.gitignore vendored

@ -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)

@ -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)
Loading…
Cancel
Save