diff options
Diffstat (limited to 'lecroy.py')
-rw-r--r-- | lecroy.py | 23 |
1 files changed, 7 insertions, 16 deletions
@@ -20,7 +20,7 @@ import array import StringIO import struct import numpy as np -import scope +import sock # data types in lecroy binary blocks, where: # length -- byte length of type @@ -123,21 +123,12 @@ wavedesc_template = ( ('descriptor_name' , 0 , String), ('acq_vert_offset' , 340 , Float), ('wave_source' , 344 , Enum) ) -class LeCroyScope(scope.Scope): +class LeCroyScope(sock.Socket): """ A class for triggering and fetching waveforms from the oscilloscope. - - .. note:: - - You must call connect() on the object before fetching waveforms. """ - def __init__(self, host, port=1861, timeout=2.0): - super(LeCroyScope, self).__init__(host, port, timeout) - - def connect(self): - """Connect to the oscilloscope.""" - super(LeCroyScope, self).connect() - # initialize some parameters + def __init__(self, *args, **kwargs): + super(LeCroyScope, self).__init__(*args, **kwargs) self.send('comm_header short') self.check_last_command() self.send('comm_format DEF9,BYTE,BIN') @@ -160,7 +151,7 @@ class LeCroyScope(scope.Scope): if channel not in range(1, 5): raise Exception('channel must be in %s.' % str(range(1, 5))) - self.send('c%s:wf? all' % str(channel)) + self.send('c%s:wf? desc' % str(channel)) msg = self.recv() if not int(msg[1]) == channel: @@ -207,8 +198,8 @@ class LeCroyScope(scope.Scope): def getwaveform(self, channel, wavedesc): """ - Request, process, and return the x and y arrays for channel number - *channel* from the oscilloscope. + Request, process, and return the voltage array for channel number + `channel` from the oscilloscope as a numpy array. """ if channel not in range(1, 5): |