@@ 97,7 97,9 @@ class GPIBplotter(GPIB):
return res
-if __name__ == '__main__':
+def main():
+ global GPIBplotter
+
import optparse
opt = optparse.OptionParser(
'A simple HP7470A GPIB plotter emulator for '
@@ 125,6 127,11 @@ if __name__ == '__main__':
action="store_true",
dest="verbose",
help="Verbose mode")
+ opt.add_option(
+ '-m', '--mockup', default=False,
+ action="store_true",
+ dest='mockup',
+ help='Use a pseudo GPIB connection (for test purpose)')
options, argv = opt.parse_args(sys.argv)
@@ 136,6 143,9 @@ if __name__ == '__main__':
else:
outf = sys.stdout
+ if options.mockup:
+ from pygpibtoolkit.plotter.gpib_plotter_mockup import GPIBplotter
+
try:
plotter = GPIBplotter(
device=options.device, address=int(options.address),
@@ 166,3 176,7 @@ if __name__ == '__main__':
nloop += 1
fname, ext = os.path.splitext(options.filename)
outf = open(fname + "_%d" % nloop + ext, 'w')
+
+
+if __name__ == '__main__':
+ main()