• How to get multiple values using Python and TSP

    I found a very usefull example how to perform measurements and transfer data: 

    https://github.com/tektronix/keithley/tree/main/Instrument_Examples/DMM7510/Stream_Digitized_Measurements/Sockets/Single_Box

    Python
    def get_block(my_socket, chunk_size, buffer_size):
        # This function extracts the binaray floating point data
        # from the DMM7510.
        sndStr = "get_data({0})\n".format(buffer_size)
        my_socket.send(sndStr.encode())
        response = my_socket.recv(1024)
        # New content....
        fmtStr = '%df' % chunk_size
        altResp = struct.unpack(fmtStr, response[2:-1])
        return altResp

    TSP
    function get_data(buffSize)
        chunker = 249
        --while buffer.getstats(defbuffer1).n - readings_captured < 200 do
        while (buffer.getstats(defbuffer1).n - readings_captured) < chunker do
            delay(0.001)
        end
        local index1 = math.mod(readings_captured, buffSize) + 1
        local index2 = index1 + (chunker - 1)            -- was 199
        if index2 > buffSize then
            index2 = buffSize
        end
        --print(scpi.execute(':TRAC:DATA? ' .. index1 .. ', ' .. index2 .. ', \"defbuffer1\"'))
        printbuffer(index1, index2, defbuffer1.readings)
        readings_captured = readings_captured + chunker
    end

    How shall I change those blocks to get relativetimestamps as well?