Example1
Capacitance measurement.py
import clr
clr.AddReference("Atv.Framework")
clr.AddReference("Atv.Framework.Devices")
from Atv.Framework.Devices.ParameterAnalyzer.Keithley4200.Enumerations import LptConstants as param
import time
# this is the test
def Test(p):
# get name from the gui input - requires a device selector in the gui code
k4200Name = p.GetInput("DEV_K4200").ValueString
# get device object from device manager
k4200 = p.GetDevice(k4200Name)
# initialize device
k4200.tstsel(1)
k4200.devclr()
k4200.devint()
# get instrument id for CVU1
cvuId = k4200.getinstid("CVU1", 0)
# set measurement speed
speed = param.KI_CVU_SPEED_QUIET
# set measurement model
model = param.KI_CVU_TYPE_CSRS
# trigger a measurement
dummy, cp, gp = k4200.measz(cvuId, model, speed, 0.0, 0.0)
# measure time
t = k4200.meast(cvuId, 0.0)/1000
# get measurement status
stat = int(k4200.getstatus(cvuId, param.KI_CVU_MEASURE_STATUS, 0))
if (stat & (~3)) != 0:
raise ScriptError("CVU error: {}".format(stat))
# store data in measmatic - requires that the parameters are setup in measmatic
p.StoreData("Capacitance", "", cp)
p.StoreData("Conductance", "", gp)