SCPI

class pylayers.measures.vna.E5072A.SCPI(port=5025, timeout=None, verbose=False, Nr=1, Nt=1, emulated=False)[source]

Bases: pylayers.util.project.PyLayers

Attributes Summary

PORT

Methods Summary

ask(com)

autoscale([win, tr])

autoscale on window win trace tr

avrg([sens, b, navrg, cmd])

allows get|set the point averaging

calibh5([Nr, Nt, _filemesh5, _filecalh5, …])

measure a calibration vector and store in h5 file

close()

close socket

freq([sens, fminGHz, fmaxGHz, cmd])

get | set frequency ramp

getIdent()

get VNA Identification

getchan([chan, Nmeas, fminGHz, fmaxGHz])

get a Tchannel from VNA

getdata([chan, Nr, Nt, Nmeas, calibration, seed])

getdata from VNA

ifband([sens, ifbHz, cmd])

allows get|set the IF bandwidth

load_calconfig([_filename])

load the whole set of calibration config

load_config_vna([_filename])

load a vna config file from an .ini file

meastime()

parS([param, chan, tr, cmd])

set|get the measurement S parameter of a selected channel

points([value, cmd, sens, echo])

‘get’|’set’ number of points

power_level([chan, cmd, power])

allows ‘get’ | ‘set’ the the power level transmitted.

read(cmd)

reset()

Resets the device to known state (with *RST) and clears the error log

stepped_mode([sens, mode])

activate sweep mode

swept_mode([sens])

activate sweep mode

trace([chan, ntrace, cmd])

allows get|set the number of traces.

trigger([cmd])

configure the trigger that control the acquisition of the measurements

write(cmd)

Attributes Documentation

PORT = 5025

Methods Documentation

ask(com)[source]
autoscale(win=1, tr=1)[source]

autoscale on window win trace tr

win : integer tr : integer

avrg(sens=1, b='OFF', navrg=20, cmd='getavrg')[source]

allows get|set the point averaging

Parameters ———- def ifband(self,sens=1,ifbHz=70000,cmd=’get’): b : boolean (ON/OFF) cmd : getavgr (0 average OFF

1 average ON)

setavgr getnavgr (preset value = 16) setnavgr

navgr : range of average : [1,999]

>>> from pylayers.measures.vna.E5072A import *
>>> vna = SCPI()
>>> vna.reset()
>>> vna.freq(fminGHz=2.8,fmaxGHz=3.2,cmd='set')
>>> vna.avrg()
>>> vna.avrg(b='ON',cmd='setavrg')
>>> vna.avrg()
>>> vna.avrg(navrg=100,cmd='setavrg')
>>> vna.close()
calibh5(Nr=4, Nt=8, _filemesh5='measures', _filecalh5='mcalib', _filecal='cal_config.ini', _filevna='vna_config.ini', typ='full', gcalm=1, cables=[], author='', comment='')[source]

measure a calibration vector and store in h5 file

Nr : int Nt : int _filemesh5 : string

measurement data file prefix

_filecalh5string

multi antenna calibration data file prefix

_filecalstring

variable parameters calibration .ini configuration file name

_filevnastring

vna .ini configuration file name

typstring

‘full’ | ‘single’

gcalmint

selected calibration group of _filecalh5 (used only if typ==’single’)

cables : list of strings author comment

close()[source]

close socket

freq(sens=1, fminGHz=1.8, fmaxGHz=2.2, cmd='get')[source]

get | set frequency ramp

sens : 1 fminGHz : frequency start (float) fmaxGHz : frequency stop (float) cmd : ‘get’ | ‘set’

>>> from pylayers.measures.vna.E5072A import *
>>> vna = SCPI()
>>> vna.freq(fminGHz=3.8,fmaxGHz=4.2,cmd='set')
>>> vna.close()
getIdent()[source]

get VNA Identification

getchan(chan=1, Nmeas=10, fminGHz=1.8, fmaxGHz=2.2)[source]

get a Tchannel from VNA

Nmeas : number of times of measures chan : int

channel number

fminGHz : frequency start (float) fmaxGHz : frequency stop (float)

>>> from pylayers.measures.vna.E5072A import *
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> vna = SCPI()
>>> vna.parS(param='S21',cmd='set')
>>> S21 = vna.getdata()
>>> #plt.plot(np.abs(S21.y)[0])
>>> vna.close()
getdata(chan=1, Nr=1, Nt=1, Nmeas=10, calibration=False, seed=0)[source]

getdata from VNA

Nmeas : number of measures chan : int

channel number

Nr : Number of receiver (used only when calibration ==True) Nt : Number of transmitter (used only when calibration ==True) Nmeas : Number of measurements calibration : boolean (used only for emulation)

if True the measurement correspond to a dataset for calibration purpose

seedIn emulated mode the data are produced from random number. seed is

for reproducibility of random experiments.

>>> from pylayers.measures.vna.E5072A import *
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> vna = SCPI()
>>> vna.parS(param='S21',cmd='set')
>>> S21 = vna.getdata()
>>> vna.close()
ifband(sens=1, ifbHz=70000, cmd='get')[source]

allows get|set the IF bandwidth

ifbHz : IF Bandwidth (default : 70000Hz) cmd : ‘get’|’set’

>>> from pylayers.measures.vna.E5072A import *
>>> vna = SCPI()
>>> vna.ifband(sens=1,ifbHz=70000,cmd='set')
>>> vna.close()
load_calconfig(_filename='cal_config.ini')[source]

load the whole set of calibration config

load_config_vna(_filename='vna_config.ini')[source]

load a vna config file from an .ini file

_filenamestring

file name extension .ini

meastime()[source]
parS(param='S21', chan=1, tr=1, cmd='get')[source]

set|get the measurement S parameter of a selected channel

cmd : ‘get’| ‘set’ param : string

{‘S11’,’S12’,’S21’,’S22’}

chanint

default 1

>>> from pylayers.measures.vna.E5072A import *
>>> vna = SCPI()
>>> vna.parS(param='S21',cmd='set')
>>> vna.close()

working

points(value=1601, cmd='get', sens=1, echo=False)[source]

‘get’|’set’ number of points

sens : int cmd : ‘get’ | ‘set’

>>> from pylayers.measures.vna.E5072A import *
>>> vna = SCPI()
>>> vna.points(201,cmd='set')
>>> vna.close()
power_level(chan=1, cmd='get', power=10)[source]

allows ‘get’ | ‘set’ the the power level transmitted.

chan : number of the channel pow : int power level transmitted cmd : ‘get’|’set’

>>> from pylayers.measures.vna.E5072A import *
>>> vna = SCPI()
>>> vna.power_level(cmd='set',power=10)
>>> vna.close()
read(cmd)[source]
reset()[source]

Resets the device to known state (with *RST) and clears the error log

>>> from pylayers.measures.vna.E5072A import *
>>> vna = SCPI()
>>> vna.close()
stepped_mode(sens=1, mode='STEP')[source]

activate sweep mode

sens : int mode : ‘stepped’ STEPped : source frequency is CONSTANT during measurement of eah displayed point. More accurate than ANALog. Dwell time can be set in this mode.

swept_mode(sens=1)[source]

activate sweep mode

sens : int

ANALogsource frequency is continuously RAMPING during measurement of each \

displayed point. Faster than STEPped. Sweep time (not dwell time) can be set in this mode.

trace(chan=1, ntrace=1, cmd='get')[source]
allows get|set the number of traces.

traces are a series of measured data points. limits of traces : max nbr of win x max nbr of traces per window (24)

chan : int ntrace : 2 cmd : ‘get’|’set’

>>> #from pylayers.measures.vna.E5072A import *
>>> #vna = SCPI()
>>> #vna.trace(chan=1,param='S21',ntrace=1,cmd='set')
>>> #vna.close()
trigger(cmd='bus')[source]

configure the trigger that control the acquisition of the measurements

cmdstring

‘bus’ : actives the trigger via the BUS ‘go’ : generates a trigger immediately and executes a measurement, regardless of the setting

of the trigger mode.

‘test’ : when all of pending operations complete, *OPC returns 1.

write(cmd)[source]