This commit is contained in:
2024-03-22 21:05:48 +01:00
parent 9513f3aa5a
commit 1f96f3c242

View File

@ -11,7 +11,7 @@ import zmq
from peakfinder8_extension import peakfinder_8 from peakfinder8_extension import peakfinder_8
flags = 0 FLAGS = 0
def radial_profile(data, r, nr, keep_pixels=None): def radial_profile(data, r, nr, keep_pixels=None):
@ -130,8 +130,8 @@ def main():
events = dict(poller.poll(2000)) # check every 2 seconds in each worker events = dict(poller.poll(2000)) # check every 2 seconds in each worker
if backend_socket in events: if backend_socket in events:
metadata = backend_socket.recv_json(flags) metadata = backend_socket.recv_json(FLAGS)
image = backend_socket.recv(flags, copy=False, track=False) image = backend_socket.recv(FLAGS, copy=False, track=False)
image = np.frombuffer(image, dtype=metadata['type']).reshape(metadata['shape']) image = np.frombuffer(image, dtype=metadata['type']).reshape(metadata['shape'])
results = copy(metadata) results = copy(metadata)
@ -463,28 +463,28 @@ def main():
frame_number = metadata['frame'] frame_number = metadata['frame']
# #
accumulator_socket.send_json(results, flags) accumulator_socket.send_json(results, FLAGS)
if (apply_aggregation != 0 ) and 'aggregation_max' in results: if (apply_aggregation != 0 ) and 'aggregation_max' in results:
if forceSendVisualisation: if forceSendVisualisation:
visualisation_socket.send_json(results, flags | zmq.SNDMORE) visualisation_socket.send_json(results, FLAGS | zmq.SNDMORE)
visualisation_socket.send(data, flags, copy=True, track=True) visualisation_socket.send(data, FLAGS, copy=True, track=True)
else: else:
data = np.empty((2,2), dtype=np.uint16) data = np.empty((2,2), dtype=np.uint16)
results['type'] = str(data.dtype) results['type'] = str(data.dtype)
results['shape'] = data.shape results['shape'] = data.shape
visualisation_socket.send_json(results, flags | zmq.SNDMORE) visualisation_socket.send_json(results, FLAGS | zmq.SNDMORE)
visualisation_socket.send(data, flags, copy=True, track=True) visualisation_socket.send(data, FLAGS, copy=True, track=True)
else: else:
if results['is_good_frame'] and (results['is_hit_frame'] or randint(1, skip_frames_rate) == 1): if results['is_good_frame'] and (results['is_hit_frame'] or randint(1, skip_frames_rate) == 1):
visualisation_socket.send_json(results, flags | zmq.SNDMORE) visualisation_socket.send_json(results, FLAGS | zmq.SNDMORE)
visualisation_socket.send(data, flags, copy=True, track=True) visualisation_socket.send(data, FLAGS, copy=True, track=True)
else: else:
data = np.empty((2,2), dtype=np.uint16) data = np.empty((2,2), dtype=np.uint16)
results['type'] = str(data.dtype) results['type'] = str(data.dtype)
results['shape'] = data.shape results['shape'] = data.shape
visualisation_socket.send_json(results, flags | zmq.SNDMORE) visualisation_socket.send_json(results, FLAGS | zmq.SNDMORE)
visualisation_socket.send(data, flags, copy=True, track=True) visualisation_socket.send(data, FLAGS, copy=True, track=True)