@Tin: you don't need to install PyVISA to use such a wrapper. The only thing that add to your sources would be the wrapper class file. The advantage of such a wrapper would be that you don't need to change any lines in your code if you move to the next gpib framework next time. Such a wrapper wouldn't be limited to two systems. Any changes in the low level stuff is at one place only.
The other stufff you described is one layer higher. That has nothing to do with encapsulating the gpib stuff. I also use such things for the calibration scripts.
As an example calibrating OHMs of a Solartron 7150 with the Fluke 5450A:
import visa
import DMM_Solartron_7150
import CAL_Fluke_5450A
import cal_run
rm = visa.ResourceManager()
S7150 = DMM_Solartron_7150.DMM(rm.open_resource("GPIB1::3::INSTR"))
F5450A = CAL_Fluke_5450A.CAL(rm.open_resource("GPIB1::19::INSTR"))
#F5450A Resistors
calpoints = ["0", "1", "1.9", "10", "19", "100", "190", "1e3", "1.9e3",
"10e3", "19e3", "100e3", "190e3",
"1e6", "1.9e6", "10e6", "19e6"]
runs = 100
S7150.set_mode("OHM")
cal_run.cal(F5450A, S7150, calpoints, runs)
S7150.close()
F5450A.close()
The DMM class takes care about peculiarities of the meters. The 7150 returns OHMs always in kOhm for example:
def get_reading(self):
reading = float(self.visa.read())
if self.mode == "OHM":
reading *= 1000 #Werte werden in kOhm ausgegeben
return reading
btw: Why don't you use lists, if you have numbered DMMs and values?