Mezurit 2

Online documentation - Differences in version 0.74

GPIB

Version 0.74 does not support adding user-defined compute functions, but they can still be added by directly modifying /usr/share/mezurit2/script.py. The GPIB_Device class takes slightly different arguments and is also not directly callable. Instead, one must store its return value in an intermediate variable, then define a channel function which calls the self.read method. In addition, a call to self.reset must be added to reset_gpib() (in newer versions this happens automatically). The modified syntax is described below, along with an example:

GPIB_Device (read_period, intro_str, read_str, reply_fmt, write_fmt)

read_period floatTime between updates in seconds
intro_str str GPIB command needed to query the model name (normally "*IDN?")
read_str str GPIB command needed to get (read) the parameter
reply_fmt str C printf-style format needed to convert a reply to a floating point value
write_fmt str C printf-style format needed to set the parameter (supply empty string if N/A)
return value Instance of the GPIB_Device class

Example: Agilent signal generator

Code: Agilent_8648_FREQ = GPIB_Device(0.5, "*IDN?", "FREQ:CW?", "%lf", "FREQ:CW %1.8le HZ")
def A8648_Freq (brd, pad) : return Agilent_8648_FREQ.read(brd, pad)
def reset_gpib () :
   Agilent_8648_FREQ.reset()
   ...
Channel def.: X1 (MHz) = A8648_Freq(0, 18)
Result: During the parse phase Mezurit 2 will create a gpib slot for board 0, address 18. In panel mode it will query the device with the command "FREQ:CW?" every 0.5 seconds and decode the reply (e.g. "1.000000E+8") as a floating point value 100e6 (displayed as 100 MHz). If the user were to set X1 to some value (e.g. 95 MHz), Mezurit 2 would immediately send "FREQ:CW 9.500000E+7 HZ" to the instrument, then resume reading every 0.5 seconds.

The parameters self.inverse_fn and self.noninverse_fn are not present in version 0.74. However, the functionality of the latter can be obtained by placing the desired expression in the channel function, as is done for SR830_SensIn() in /usr/share/mezurit2/script.py.