You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
7 years ago
|
#!/bin/env python3
|
||
|
import time
|
||
|
|
||
|
import gex
|
||
|
import numpy as np
|
||
|
from matplotlib import pyplot as plt
|
||
|
import datetime
|
||
|
|
||
|
from scipy.io import wavfile
|
||
|
|
||
7 years ago
|
# this script captures lightnings and stores them to npy files
|
||
|
|
||
7 years ago
|
# ADC channel 1 -> 100n -> o -> long wire (antenna)
|
||
|
# |
|
||
|
# '-> 10k -> GND
|
||
|
|
||
7 years ago
|
led = None
|
||
|
|
||
7 years ago
|
def capture(tr):
|
||
|
now=datetime.datetime.now()
|
||
|
now.isoformat()
|
||
|
data = tr.data
|
||
|
print("Capture! ")
|
||
|
print(data)
|
||
|
np.save("lightning-%s"%now.isoformat(), data)
|
||
7 years ago
|
led.pulse_ms(1000, confirm=False)
|
||
7 years ago
|
|
||
|
with gex.Client(gex.TrxRawUSB()) as client:
|
||
|
adc = gex.ADC(client, 'adc')
|
||
7 years ago
|
led = gex.DOut(client, 'led')
|
||
|
|
||
|
adc.set_sample_rate(60000)
|
||
7 years ago
|
|
||
|
adc.on_trigger(capture)
|
||
|
adc.setup_trigger(1,
|
||
7 years ago
|
level=2600,
|
||
|
count=5000,
|
||
7 years ago
|
edge='rising',
|
||
7 years ago
|
pretrigger=500,
|
||
7 years ago
|
holdoff=500,
|
||
|
auto=True)
|
||
|
|
||
|
adc.arm()
|
||
|
|
||
|
sec = 0
|
||
|
while True:
|
||
|
print('%d s' % sec)
|
||
|
sec += 1
|
||
|
time.sleep(1)
|