edit: I figured out what I wanted.
You can index the data received ("recv" in Python):
Code: Select all
data = socket_from_tcp_writer.recv(buf_size) # important to set up socket before
len(data) # = 8*number channels*chunk size (e.g. 1 channel, 4 samples per chunk --> 32)
(sadly the indentation was lost) Moderator Edit : the code tag instead quote tag for code.^^
Code: Select all
# buf_size_sc: samples per chunk set in scenario or acquisition server
for factor in range(buf_size_sc):
# append to list
to_convert = []
for i in range(8):
to_convert.append(data[factor*8 + i])
# convert
converted = bytearray(to_convert)
# readout actual number
floatval_tuple = struct.unpack('d', converted)
floatval = floatval_tuple[0]
chunk_vals.append(floatval)