Bit Error Rate Tester | BERT 1005
Quantifi Photonics Ltd.
Version
2.04
86
Python® 2.7 code example
The following example shows how to communicate with a BERT product using Python code. For a list of
supported and valid SCPI commands, refer to the Programming Guide.
# 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:
print(
"connecting to "
+
ip
+
" ... "
)
instrument
=
vxi11.Instrument
(
ip
)
print(
"connected"
)
print(
"checking IDN..."
)
command
=
"*IDN?"
data
=
instrument.ask
(
command
)
print(
"IDN: "
+
data
)
print(
"checking OPT..."
)
command
=
"*OPT?"
data
=
instrument.ask
(
command
)
print(
"OPT: "
+
data
)
# replace this with a valid command for your device (read # the
programming guide section for examples)
command
=
""
print(
"writing a specific command"
)
instrument.write
(
command
)
print(
"checking ESR"
)
command
=
"*ESR?"
data
=
instrument.ask
(
command
)
print(
"*ESR?: "
+
data
)
except
Vxi11Exception
as
e
:
# pass
print(
"ERROR"
+
str
(
e
)
+
", command: "
+
str
(
command
))