Пример #1
0
    # choose random fstop
    req_fstop = req_fstart + int(random.random() * (8e9 - req_fstart))

    # choose random fin between fstart and fstop
    fin = req_fstart + int(random.random() * (req_fstop - req_fstart))

    # choose a random rbw between 3kHz and 500 kHz
    req_rbw = int((random.random() * (500e3 - 3e3)) + 3e3)

    # print test summary
    print "Test #%4d - fstart: %11d, fstop: %11d, rbw: %6d, fin: %11d, mode: %s" % (
        t, req_fstart, req_fstop, req_rbw, fin, mode),

    # do test
    sd.logstr = ''
    sd.logtype = 'LOG'
    sg.freq(fin)
    time.sleep(0.250)
    try:
        (act_fstart, act_fstop,
         psd) = sd.capture_power_spectrum(req_fstart, req_fstop, req_rbw, {},
                                          mode)
    except Exception as detail:
        print sd.logstr
        print "\n\n%s" % detail
        break

    act_rbw = float(act_fstop - act_fstart) / len(psd)
    (pfreq, pamp) = do_peakfind(act_fstart, act_fstop, act_rbw, psd)

    # calculate deltas from expected values
Пример #2
0
Файл: test.py Проект: pyrf/pyrf
    fin = float(sys.argv[5])

if save_data:
    reqstart = fstart
    reqstop = fstop
    reqrbw = rbw

# connect to wsa
dut = WSA()
dut.connect(ip)
dut.scpiset("*RST")
dut.flush()

# create sweep device
sd = SweepDevice(dut)
sd.logtype = 'PRINT'

# setup siggen
if fin:
    sg = N5183("10.126.110.19")
    sg.amplitude(pin)
    sg.freq(fin)
    sg.output(1)
    time.sleep(0.05)

# capture spectrum
(fstart, fstop, data) = sd.capture_power_spectrum(fstart, fstop, rbw, { }, mode)
calcrbw = (fstop - fstart) / len(data)
print "fstart = %d, fstop = %d, datalen = %d, calculated rbw = %f" % (fstart, fstop, len(data), calcrbw)

# search for max
Пример #3
0
    # choose random fstop
    req_fstop = req_fstart + int(random.random() * (8e9 - req_fstart))

    # choose random fin between fstart and fstop
    fin = req_fstart + int(random.random() * (req_fstop - req_fstart))

    # choose a random rbw between 3kHz and 500 kHz
    req_rbw = int((random.random() * (500e3 - 3e3)) + 3e3)

    # print test summary
    print "Test #%4d - fstart: %11d, fstop: %11d, rbw: %6d, fin: %11d, mode: %s" % (t, req_fstart, req_fstop, req_rbw, fin, mode), 

    # do test
    sd.logstr = ''
    sd.logtype = 'LOG'
    sg.freq(fin)
    time.sleep(0.250)
    try:
        (act_fstart, act_fstop, psd) = sd.capture_power_spectrum(req_fstart, req_fstop, req_rbw, { }, mode)
    except Exception as detail:
        print sd.logstr
        print "\n\n%s" % detail
        break

    act_rbw = float(act_fstop - act_fstart) / len(psd)
    (pfreq, pamp) = do_peakfind(act_fstart, act_fstop, act_rbw, psd)

    # calculate deltas from expected values
    dfreq = abs(pfreq - fin)
    damp = abs(pamp - pin)
Пример #4
0
    fin = float(sys.argv[5])

if save_data:
    reqstart = fstart
    reqstop = fstop
    reqrbw = rbw

# connect to wsa
dut = WSA()
dut.connect(ip)
dut.scpiset("*RST")
dut.flush()

# create sweep device
sd = SweepDevice(dut)
sd.logtype = 'PRINT'

# setup siggen
if fin:
    sg = N5183("10.126.110.19")
    sg.amplitude(pin)
    sg.freq(fin)
    sg.output(1)
    time.sleep(0.05)

# capture spectrum
(fstart, fstop, data) = sd.capture_power_spectrum(fstart, fstop, rbw, {}, mode)
calcrbw = (fstop - fstart) / len(data)
print "fstart = %d, fstop = %d, datalen = %d, calculated rbw = %f" % (
    fstart, fstop, len(data), calcrbw)