Thanks for posting this it has been the source of inspiration for some work that I am doing but have an issue that is proving difficult to overcome and I think I'm probably just missing something simple. I'm using Python with a 3205a picoscope, I've written a class for it similar to what you have done but specifically for the 3205a and not using the generic base class.
I have a buffer set up of length 1250000 with a timebase of 2(8ns) and I'm running block mode (without aggregation) based on the programmers guide with channel A enabled and B disabled. It all works but only half the buffer is filled I've attached and figure with the plots for 2 cycles of runBlock(). Any Ideas why only half the buffer is being filled?
P.S. the capture is a high pass filtered mains signal through a diff probe
As far as I know I'm not using any downsampling, if I am it's not intentional. Here are the functions in my python class that calls the DLL using ctypes:
def setDataBuffer(self, channel, buffer):
""" the buffer should be a numpy array """
buffer_p = buffer.ctypes.data_as(POINTER(c_short))
bufferLth = len(buffer)
status = self.pico.ps3000aSetDataBuffer(self.handle,c_short(self.CHANNEL[channel]),
buffer_p,c_long(bufferLth),
c_ushort(0),c_short(0))
if status!=0:
raise IOError('There was a problem setting the data buffer')
if status!=0:
raise IOError('There was a problem running block mode')
def getValues(self, noOfSamples):
noOfSamples = c_long(noOfSamples)
overflow = c_short()
status = self.pico.ps3000aGetValues(self.handle,c_ulong(0),byref(noOfSamples),
c_ulong(0),c_short(0),c_ushort(0),
byref(overflow))
if status!=0:
raise IOError('There was a problem getting the values: status:',status)
return (noOfSamples.value,overflow.value)
setDataBuffer is passed 'A' which subsequently selects 0 from a python dictionary and an empty numpy array:
buffer = np.empty(nSamples,dtype=np.long) where nSamples is set to 1250000 # I've also tried much smaller values
RunBlock is passed 0, nSamples and and the timebase set to 3 # I've also tried much larger values
1. Please ensure that you are using the latest version of the ps3000a.dll (available from the SDK or PicoScope 6 installation directory).
2. Ensure that you are using the correct data types - enumerations such as in the call to ps3000aSetDataBuffer should be unsigned 32-bit integers (ulong). Also, in the call to ps3000aGetValues, noOfSamples should be an unsigned 32-bit integer (ulong).
Is noOfSamples equal to the sum of the pre and post trigger samples?