def pull_chunk(self, timeout=0.0, max_samples=1024, dest_obj=None):
        """Pull a chunk of samples from the inlet.
        
        Keyword arguments:
        timeout -- The timeout of the operation; if passed as 0.0, then only 
                   samples available for immediate pickup will be returned. 
                   (default 0.0)
        max_samples -- Maximum number of samples to return. (default 
                       1024)
        dest_obj -- A Python object that supports the buffer interface.
                    If this is provided then the dest_obj will be updated in place
                    and the samples list returned by this method will be empty.
                    It is up to the caller to trim the buffer to the appropriate
                    number of samples.
                    A numpy buffer must be order='C'
                    (default None)
                       
        Returns a tuple (samples,timestamps) where samples is a list of samples 
        (each itself a list of values), and timestamps is a list of time-stamps.

        Throws a LostError if the stream source has been lost.

        """
        # look up a pre-allocated buffer of appropriate length        
        num_channels = self.channel_count
        max_values = max_samples*num_channels

        if max_samples not in self.buffers:
            # noinspection PyCallingNonCallable
            self.buffers[max_samples] = ((self.value_type*max_values)(),
                                         (c_double*max_samples)())
        if dest_obj is not None:
            data_buff = (self.value_type * max_values).from_buffer(dest_obj)
        else:
            data_buff = self.buffers[max_samples][0]
        ts_buff = self.buffers[max_samples][1]

        # read data into it
        errcode = c_int()
        # noinspection PyCallingNonCallable
        num_elements = self.do_pull_chunk(self.obj, byref(data_buff),
                                          byref(ts_buff), max_values,
                                          max_samples, c_double(timeout),
                                          byref(errcode))
        handle_error(errcode)
        # return results (note: could offer a more efficient format in the 
        # future, e.g., a numpy array)
        num_samples = num_elements/num_channels
        if dest_obj is None:
            samples = [[data_buff[s*num_channels+c] for c in range(num_channels)]
                       for s in range(int(num_samples))]
            if self.channel_format == cf_string:
                samples = [[v.decode('utf-8') for v in s] for s in samples]
                free_char_p_array_memory(data_buff, max_values)
        else:
            samples = None
        timestamps = [ts_buff[s] for s in range(int(num_samples))]
        return samples, timestamps
def pull_chunk(self, timeout=0.0, max_samples=1024, dest_obj=None):
        """Pull a chunk of samples from the inlet.
        
        Keyword arguments:
        timeout -- The timeout of the operation; if passed as 0.0, then only 
                   samples available for immediate pickup will be returned. 
                   (default 0.0)
        max_samples -- Maximum number of samples to return. (default 
                       1024)
        dest_obj -- A Python object that supports the buffer interface.
                    If this is provided then the dest_obj will be updated in place
                    and the samples list returned by this method will be empty.
                    It is up to the caller to trim the buffer to the appropriate
                    number of samples.
                    A numpy buffer must be order='C'
                    (default None)
                       
        Returns a tuple (samples,timestamps) where samples is a list of samples 
        (each itself a list of values), and timestamps is a list of time-stamps.

        Throws a LostError if the stream source has been lost.

        """
        # look up a pre-allocated buffer of appropriate length        
        num_channels = self.channel_count
        max_values = max_samples*num_channels

        if max_samples not in self.buffers:
            # noinspection PyCallingNonCallable
            self.buffers[max_samples] = ((self.value_type*max_values)(),
                                         (c_double*max_samples)())
        if dest_obj is not None:
            data_buff = (self.value_type * max_values).from_buffer(dest_obj)
        else:
            data_buff = self.buffers[max_samples][0]
        ts_buff = self.buffers[max_samples][1]

        # read data into it
        errcode = c_int()
        # noinspection PyCallingNonCallable
        num_elements = self.do_pull_chunk(self.obj, byref(data_buff),
                                          byref(ts_buff), max_values,
                                          max_samples, c_double(timeout),
                                          byref(errcode))
        handle_error(errcode)
        # return results (note: could offer a more efficient format in the 
        # future, e.g., a numpy array)
        num_samples = num_elements/num_channels
        if dest_obj is None:
            samples = [[data_buff[s*num_channels+c] for c in range(num_channels)]
                       for s in range(int(num_samples))]
            if self.channel_format == cf_string:
                samples = [[v.decode('utf-8') for v in s] for s in samples]
                free_char_p_array_memory(data_buff, max_values)
        else:
            samples = None
        timestamps = [ts_buff[s] for s in range(int(num_samples))]
        return samples, timestamps
def pull_chunk ( self , timeout = 0.0 , max_samples = 1024 , dest_obj = None ) : # look up a pre-allocated buffer of appropriate length         num_channels = self . channel_count max_values = max_samples * num_channels if max_samples not in self . buffers : # noinspection PyCallingNonCallable self . buffers [ max_samples ] = ( ( self . value_type * max_values ) ( ) , ( c_double * max_samples ) ( ) ) if dest_obj is not None : data_buff = ( self . value_type * max_values ) . from_buffer ( dest_obj ) else : data_buff = self . buffers [ max_samples ] [ 0 ] ts_buff = self . buffers [ max_samples ] [ 1 ] # read data into it errcode = c_int ( ) # noinspection PyCallingNonCallable num_elements = self . do_pull_chunk ( self . obj , byref ( data_buff ) , byref ( ts_buff ) , max_values , max_samples , c_double ( timeout ) , byref ( errcode ) ) handle_error ( errcode ) # return results (note: could offer a more efficient format in the  # future, e.g., a numpy array) num_samples = num_elements / num_channels if dest_obj is None : samples = [ [ data_buff [ s * num_channels + c ] for c in range ( num_channels ) ] for s in range ( int ( num_samples ) ) ] if self . channel_format == cf_string : samples = [ [ v . decode ( 'utf-8' ) for v in s ] for s in samples ] free_char_p_array_memory ( data_buff , max_values ) else : samples = None timestamps = [ ts_buff [ s ] for s in range ( int ( num_samples ) ) ] return samples , timestamps
Pull a chunk of samples from the inlet.
        
        Keyword arguments:
        timeout -- The timeout of the operation; if passed as 0.0, then only 
                   samples available for immediate pickup will be returned. 
                   (default 0.0)
        max_samples -- Maximum number of samples to return. (default 
                       1024)
        dest_obj -- A Python object that supports the buffer interface.
                    If this is provided then the dest_obj will be updated in place
                    and the samples list returned by this method will be empty.
                    It is up to the caller to trim the buffer to the appropriate
                    number of samples.
                    A numpy buffer must be order='C'
                    (default None)
                       
        Returns a tuple (samples,timestamps) where samples is a list of samples 
        (each itself a list of values), and timestamps is a list of time-stamps.

        Throws a LostError if the stream source has been lost.
Pull a chunk of samples from the inlet . Keyword arguments : timeout -- The timeout of the operation ; if passed as 0 . 0 then only samples available for immediate pickup will be returned . ( default 0 . 0 ) max_samples -- Maximum number of samples to return . ( default 1024 ) dest_obj -- A Python object that supports the buffer interface . If this is provided then the dest_obj will be updated in place and the samples list returned by this method will be empty . It is up to the caller to trim the buffer to the appropriate number of samples . A numpy buffer must be order = C ( default None ) Returns a tuple ( samples timestamps ) where samples is a list of samples ( each itself a list of values ) and timestamps is a list of time - stamps .