D. Code examples
The
following
simple
examples
demonstrate
how
to
communicate
with the
ARF/XRF
over ethernet in several languages, using the bin-
dings provided by
MOGL
abs.
Further examples are available from
the
MOGL
abs website.
D.1
python
Communication is handled by a “device” class, which provides con-
venience functions for sending commands and queries.
#
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
# ARF python example, (c) MOGLabs 2016
#
−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
from mogdevice import MOGDevice
# connect to the device
dev = MOGDevice(’10.1.1.23’)
# print some information
print ’Device info:’, dev.ask(’info’)
# example command: set frequency
dev.cmd(’FREQ,1,100MHz’)
# example query: check frequency
print ’Freq:’, dev.ask(’FREQ,1’)
# some queries can return dictionaries
print ’Temperatures:’, dev.ask_dict(’TEMP’)
# other queries respond with binary data
tbl = dev.ask_bin(’TABLE,DUMP,1’)
print ’Binary table:’, len(tbl)
# close the connection
dev.close()
The next example shows how to construct a Gaussian pulse using
numpy
and the
MOGDevice
class, showing how easy it is to generate
arbitrary waveforms. The resulting waveform is shown in Figure D.1.
119
Содержание ARF021
Страница 1: ...Agile RF Synthesizer AOM driver ARF021 ARF421 XRF021 XRF421 Version 1 5 0 Rev 6 ...
Страница 4: ...ii ...
Страница 10: ...viii Contents ...
Страница 26: ...16 Chapter 3 Communications ...
Страница 44: ...34 Chapter 5 External modulation ...
Страница 50: ...40 Chapter 6 PID stabilisation ...
Страница 64: ...54 Chapter 7 Digital I O ...
Страница 100: ...90 Chapter 9 Advanced table mode XRF ...
Страница 128: ...118 Appendix C Command language ...
Страница 133: ......