Commit f7e30b89 authored by Widener, Patrick's avatar Widener, Patrick
Browse files

Fix a couple of dumb mistakes and diagnose message size problem

parent c5f61adb
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
import zmq
import numpy as np
import time
import json

context = zmq.Context()
# subscription socket where we'll receive data
@@ -15,12 +16,13 @@ sigsocket.send(b'')
sigsocket.recv()

print("synchronized; ready to receive data")
msg = subsocket.recv_multipart(flags=0,copy=True)
md = msg[0]
msg = subsocket.recv_multipart(flags=0)
md = json.loads(msg[0])
sz = msg[1]

ary = np.frombuffer(bytes(memoryview(sz)),dtype=md['dtype'])
ary = np.frombuffer(sz,dtype=md['dtype'])
ary.reshape(md['shape'])

print(f'received {ary.size} elements')

+3 −1
Original line number Diff line number Diff line
import numpy as np
import zmq
import time
import json

aryinit = np.load("../data/p_322_data_np_res_16.npy")
ary = aryinit[:1000]

ary = np.load("../data/p_322_data_np_res_16.npy")
print('array contains {} elements'.format(ary.size))

# set up metadata for numpy array reconstruction