11.3 Python® 2.7 code example
The following example shows how to communicate with the Quantifi Photonics product using Python code.
# You can get VXI11 from pip:
# pip install python-vxi11==0.9
import
vxi11
from
vxi11.vxi11
import
Vxi11Exception
# replace this with the IP of your device
ip =
"127.0.0.1"
try
:
(
"connecting to "
+ ip +
" ... "
)
instrument = vxi11.
Instrument
(ip)
(
"connected"
)
(
"checking IDN..."
)
command =
"*IDN?"
data = instrument.
ask
(command)
(
"IDN: "
+ data)
(
"checking OPT..."
)
command =
"*OPT?"
data = instrument.
ask
(command)
(
"OPT: "
+ data)
# replace this with a valid command for your device (read # the programming guide section for examples)
command =
""
(
"writing a specific command"
)
instrument.
write
(command)
(
"checking ESR"
)
command =
"*ESR?"
data = instrument.
ask
(command)
(
"*ESR?: "
+ data)
except
Vxi11Exception
as
e:
# pass
(
"ERROR"
+
str
(e) +
", command: "
+
str
(command))
Quantifi Photonics | SLED 1000 / 1300 Series PXIe User Manual | Document version 1.08
52 / 61