diff tek2024b_example.py @ 18:9bb8a9f3df6b

Update examples to match new code.
author Daniel O'Connor <darius@dons.net.au>
date Wed, 10 Aug 2011 15:18:26 +0930
parents c2c13d804fce
children 91b476ebc0f2
line wrap: on
line diff
--- a/tek2024b_example.py	Wed Aug 10 15:17:57 2011 +0930
+++ b/tek2024b_example.py	Wed Aug 10 15:18:26 2011 +0930
@@ -52,13 +52,13 @@
 
     # Fetch horizontal scale
     u.write("HOR:MAIN:SCALE?")
-    hscale = float(u.read(1).split()[1])
-    print "Horizontal scale is %f sec/div" % (hscale)
+    hscale = scpi.getdata(u.read())
+    print "Horizontal scale is %f nsec/div" % (hscale * 1e9)
 
     # Make sure the previous commands have been executed
     u.write("*WAI")
 
-    # Fetch curve data (wait up to 1 second)
+    # Fetch curve data (wait up to 1 second) since the read takes a little while
     u.write("CURVE?")
     then = time.time()                            
     result = u.read(1.0)
@@ -66,7 +66,7 @@
     print "CURVE read took %f milliseconds" % ((now - then) * 1000.0)
 
     # Parse data
-    ary = scpi.bindecode(result, header = ':CURVE ', dtype = numpy.dtype('>h'))
+    ary = scpi.bindecode(result, dtype = numpy.dtype('>h'))
 
     # Convert to volts
     ary = ary / 32768.0 * vscale