Streaming floating point data in Python2
datalock seems to be unneeded, since data.append is thread-safe and iterating while appending is safe.

multiprocessing might be faster, but it might be slower. It depends on where you're bottlenecked. In particular, data transfer is slower with multiple processes.

The slow aspect here is primarily repeated conversions to numpy.ndarray objects. This can be avoided by only doing the translation once, which is easiest in the producer thread:

data.append(np.array(one_sample, dtype="float64"))


get_data is then simpler as

def get_data(raw_data, number_values=None):
    if number_values == 0:
        return []
    return np.array(raw_data[-number_values or 0:]).T


If the block size you want is bounded by a fixed limit, it's probably better to write into a circular numpy buffer of the right shape. This way, you can just do a single concatenation, rather than a concatenation of a large number of arrays.