コード例 #1
0
ファイル: MXA.py プロジェクト: asqum/PYQUM_SEEDS
def test(detail=True):
    S = {}
    S['x'] = Initiate()
    s = S['x']
    if s is "disconnected":
        pass
    else:
        if debug(mdlname, detail):
            print(Fore.RED + "Detailed Test:")
            # print('SCPI TEST:')
            # s.write("*SAV 00,1")
            model(s)
            frequency(s)
            frequency(s, action=['Set', '5.5GHz'])
            fspan(s)
            fspan(s, action=['Set', '150MHz'])
            preamp(s, action=['Set', 'ON'])
            preamp_band(s, action=['Set', 'FULL'])
            attenuation(s, action=['Set', '0dB'])
            attenuation_auto(s, action=['Set', 'ON'])
            print('Power at 5.5GHz is %s' % fpower(s, '5.5GHz'))

        else:
            print(Fore.RED + "Basic IO Test")
    if not bool(input("Press ENTER (OTHER KEY) to (skip) reset: ")):
        state = True
    else:
        state = False
    close(s, reset=state)
    return
コード例 #2
0
def test(detail=True):
    S = {}
    S['x'] = Initiate()
    s = S['x']
    if s is "disconnected":
        pass
    else:
        if debug(mdlname, detail):
            print(Fore.RED + "Detailed Test:")
            # print('SCPI TEST:')
            # s.write("*SAV 00,1")
            model(s)
            channel_voltage(s, 1)
            channel_voltage(s, 1, action=['Set', '28'])
            channel_current(s, 1)
            channel_current(s, 1, action=['Set', '0.125'])
            output(s, action=['Set', '1'])
            # sleep(1)
            output(s, action=['Set', '0'])

        else:
            print(Fore.RED + "Basic IO Test")
    if not bool(input("Press ENTER (OTHER KEY) to (skip) reset: ")):
        state = True
    else:
        state = False
    close(s, reset=state)
    return
コード例 #3
0
def test(detail=True):
    s = Initiate()
    if s is "disconnected":
        pass
    else:
        if debug(mdlname, detail):
            print(Fore.RED + "Detailed Test:")
            model(s)

            tdrchannel(s, 3, action=['Set','Volt',' '])
            tdrstep(s, 3, action=['Set','ON','PLUS'])
            # waveformdb(s, 3, action=['Set',"","","ON"])

            tdrchannel(s, 4, action=['Set','Volt',' '])
            tdrstep(s, 4, action=['Set','ON','PLUS'])
            # waveformdb(s, 4, action=['Set',"","","ON"])
            
            tdr(s, action=['Set','LOCKExt'])
            trigger(s, action=['Set','TDR',25e3,''])

            acquire(s, action=['Set','ON','SAMPLE'])
            display(s, action=['Set','NORMAL','ON'])

            # stat = s.write('ACQuire:DATA:CLEar')
            # print('write status: %s' %stat[0])

        else: print(Fore.RED + "Basic IO Test")
    if not bool(input("Press ENTER (OTHER KEY) to (skip) reset: ")):
        state = True
    else: state = False
    close(s, reset=state)
    return

# test()
コード例 #4
0
ファイル: ENA.py プロジェクト: RuRu110307/PYQUM
def test(detail=True):
    bench = Initiate()
    if bench is "disconnected":
        pass
    else:
        model(bench)
        if debug(mdlname, detail):
            # print(setrace(bench, window='D12_34'))
            print(setrace(bench, Mparam=['S12'], window='D1'))
            power(bench, action=['Set', -73.1])
            power(bench)
            N = 7000
            sweep(bench, action=['Set', 'OFF 10', N])
            # sweep(bench, action=['Set', 'ON', N])
            f_start, f_stop = 0.7e9, 18e9
            linfreq(bench, action=['Set', f_start, f_stop])  #F-sweep
            stat = linfreq(bench)
            fstart, fstop = stat[1]['START'], stat[1]['STOP']
            # Building X-axis
            fstart, fstop = float(fstart), float(fstop)
            X = list(linspace(fstart, fstop, N))
            noisefilfac = 2000
            IFB = abs(float(fstart) - float(fstop)) / N / noisefilfac
            ifbw(bench, action=['Set', IFB])
            ifbw(bench)
            averag(bench, action=['Set', 1])  #optional
            averag(bench)
            # start sweeping
            stat = sweep(bench)
            print("Time-taken would be: %s (%spts)" %
                  (stat[1]['TIME'], stat[1]['POINTS']))
            print("Ready: %s" % measure(bench)[1])
            autoscal(bench)

            # cwfreq(bench, action=['Set', 5.25e9])
            # cwfreq(bench)
            # power(bench, action=['Set', '', -75.3, -40.3])
            # power(bench)
            # stat = sweep(bench)
            # print("Time-taken would be: %s (%spts)" %(stat[1]['TIME'], stat[1]['POINTS']))
            # print("Ready: %s" %measure(bench)[1])

            autoscal(bench)

            dataform(bench, action=['Set', 'REAL32'])
            selectrace(bench, action=['Set', 'para 1 calc 1'])
            # print(sdata(bench))

            rfports(bench, action=['Set', 'OFF'])
            rfports(bench)
        else:
            print(Fore.RED + "Basic IO Test")
    close(bench)
    return
コード例 #5
0
ファイル: PSGV.py プロジェクト: zeyanchen/PYQUM
def test(detail=True):
    s = Initiate()
    if s is "disconnected":
        pass
    else:
        if debug(mdlname, detail):
            print(Fore.RED + "Detailed Test:")
            # print('SCPI TEST:')
            # s.write("*SAV 00,1")
            model(s)
            memory(s)
            frequency(s)
            p = float(power(s)[1]['AMPLITUDE'])
            print("Power: %s" % p)
            rfoutput(s, action=['Set', 'ON'])
            rfoutput(s)
            commentstate(s, action=['Set', "03,7,'OMG I am SUPERB!'"])
            commentstate(s, action=['Get', "03,7"])
            power(s, action=['Set', '-7.3dbm'])
            power(s)
            frequency(s, action=['Set', '1GHz'])
            frequency(s)
            rfoutput(s, action=['Set', 'ON'])
            rfoutput(s)
            Lfshape(s, action=['Set', 'DC'])
            Lfamp(s, action=['Set', 'FUNC', '1.57V'])
            Lfamp(s)
            Lfoutput(s, action=['Set', 'ON'])
        else:
            print(Fore.RED + "Basic IO Test")
    if not bool(input("Press ENTER (OTHER KEY) to (skip) reset: ")):
        state = True
    else:
        state = False
    close(s, reset=state)
    return
コード例 #6
0
ファイル: ENA.py プロジェクト: zeyanchen/PYQUM
'''Communicating with Benchtop E-series Vector Network Analyzer'''

from colorama import init, Fore, Back
init(autoreset=True) #to convert termcolor to wins color

from os.path import basename as bs
mdlname = bs(__file__).split('.')[0] # instrument-module's name e.g. ENA, PSG, YOKO

import matplotlib.pyplot as plt
from numpy import arange, floor, ceil, linspace

import visa
from pyqum.instrument.logger import address, set_status, status_code, debug
from pyqum.instrument.logger import translate_scpi as Attribute

debugger = debug(mdlname)

# INITIALIZATION
def Initiate():
    rs = address(mdlname, reset=debugger) # Instrument's Address
    rm = visa.ResourceManager()
    try:
        bench = rm.open_resource(rs) #establishing connection using GPIB# with the machine
        stat = bench.write('*RST;*CLS') #Clear buffer memory;
        bench.write("SENS:CORR:EXT:AUTO:RESet") #clear port-extension auto-correction
        bench.read_termination = '\n' #omit termination tag from output 
        bench.timeout = 80000000 #set timeout in ms
        set_status(mdlname, dict(state='connected'))
        print(Fore.GREEN + "%s's connection Initialized: %s" % (mdlname, str(stat[1])[-7:]))
    except: 
        set_status(mdlname, dict(state='DISCONNECTED'))
コード例 #7
0
ファイル: ENA.py プロジェクト: supergravity/PYQUM
def test(detail=True):
    from pyqum.instrument.analyzer import curve, IQAParray, UnwraPhase
    from pyqum.instrument.toolbox import waveform

    bench = Initiate(False)
    if bench is "disconnected":
        pass
    else:
        model(bench)
        if debug(mdlname, detail):
            # print(setrace(bench, window='D12_34'))
            print(setrace(bench, Mparam=['S21', 'S43'], window='D1_2'))
            power(bench, action=['Set', -35])
            power(bench)
            N = 3000
            # sweep(bench, action=['Set', 'OFF 10', N])
            sweep(bench, action=['Set', 'ON', N])
            f_start, f_stop = 0.7e9, 18e9
            linfreq(bench, action=['Set', f_start, f_stop])  #F-sweep
            stat = linfreq(bench)
            fstart, fstop = stat[1]['START'], stat[1]['STOP']

            # Building X-axis
            # fstart, fstop = float(fstart), float(fstop)

            # noisefilfac = 20000
            IFB = 600  #abs(float(fstart) - float(fstop))/N/noisefilfac
            ifbw(bench, action=['Set', IFB])
            ifbw(bench)
            # averag(bench, action=['Set', 1]) #optional
            # averag(bench)

            # start sweeping
            # stat = sweep(bench)
            # print("Time-taken would be: %s (%spts)" %(stat[1]['TIME'], stat[1]['POINTS']))
            # print("Ready: %s" %measure(bench)[1])
            # autoscal(bench)

            cwfreq(bench, action=['Set', 5.25e9])
            cwfreq(bench)
            # power(bench, action=['Set', '', -75.3, -40.3]) #power sweep
            power(bench, action=['Set', '', -10, -10])
            power(bench)

            # start sweeping
            stat = sweep(bench)
            print("Time-taken would be: %s (%spts)" %
                  (stat[1]['TIME'], stat[1]['POINTS']))
            print("Ready: %s" % bool(measure(bench)))
            autoscal(bench)

            dataform(bench, action=['Set', 'REAL'])
            selectrace(bench, action=['Set', 'para 1 calc 1'])
            data = sdata(bench)
            print("Data [Type: %s, Length: %s]" % (type(data), len(data)))

            rfports(bench, action=['Set', 'OFF'])
            rfports(bench)

            # Plotting trace:
            yI, yQ, Amp, Pha = IQAParray(array(data))
            curve(range(len(data) // 2), Amp, 'CW-Amp time-series', 'arb time',
                  'Amp(dB)')

            # TEST SCPI ZONE:
            # bench.write(':SYSTem:PRESet')
            # scanning(bench) #continuous scan
        else:
            print(Fore.RED + "Basic IO Test")
    close(bench)
    return