refactor #1

Merged
augustin_s merged 159 commits from refactor into main 2024-10-12 17:09:10 +02:00
2 changed files with 8 additions and 8 deletions
Showing only changes of commit bfaa80c9d0 - Show all commits

View File

@@ -1,22 +1,22 @@
import numpy as np import numpy as np
def calc_force_send(results, data, pixel_mask_pf, image, n_aggregated_images, data_summed): def calc_force_send(results, data, pixel_mask_pf, image, data_summed, n_aggregated_images):
force_send_visualisation = False force_send_visualisation = False
if data.dtype == np.uint16: if data.dtype == np.uint16:
return data, force_send_visualisation, n_aggregated_images, data_summed return data, force_send_visualisation, data_summed, n_aggregated_images
apply_threshold = results.get("apply_threshold", False)
apply_aggregation = results.get("apply_aggregation", False) apply_aggregation = results.get("apply_aggregation", False)
apply_threshold = results.get("apply_threshold", False)
if not apply_aggregation: if not apply_aggregation:
data_summed = None data_summed = None
n_aggregated_images = 1 n_aggregated_images = 1
if not apply_threshold and not apply_aggregation: if not apply_aggregation and not apply_threshold:
data = image data = image
return data, force_send_visualisation, n_aggregated_images, data_summed return data, force_send_visualisation, data_summed, n_aggregated_images
if apply_threshold and all(k in results for k in ("threshold_min", "threshold_max")): if apply_threshold and all(k in results for k in ("threshold_min", "threshold_max")):
threshold_min = float(results["threshold_min"]) threshold_min = float(results["threshold_min"])
@@ -42,7 +42,7 @@ def calc_force_send(results, data, pixel_mask_pf, image, n_aggregated_images, da
if pixel_mask_pf is not None: if pixel_mask_pf is not None:
data[~pixel_mask_pf] = np.nan data[~pixel_mask_pf] = np.nan
return data, force_send_visualisation, n_aggregated_images, data_summed return data, force_send_visualisation, data_summed, n_aggregated_images

View File

@@ -44,8 +44,8 @@ def work(backend_address, accumulator_host, accumulator_port, visualisation_host
zmq_socks = ZMQSockets(backend_address, accumulator_host, accumulator_port, visualisation_host, visualisation_port) zmq_socks = ZMQSockets(backend_address, accumulator_host, accumulator_port, visualisation_host, visualisation_port)
n_aggregated_images = 1
data_summed = None data_summed = None
n_aggregated_images = 1
while True: while True:
@@ -118,7 +118,7 @@ def work(backend_address, accumulator_host, accumulator_port, visualisation_host
calc_peakfinder_analysis(results, pfdata, pixel_mask_pf) calc_peakfinder_analysis(results, pfdata, pixel_mask_pf)
# ??? # ???
data, force_send_visualisation, n_aggregated_images, data_summed = calc_force_send(results, data, pixel_mask_pf, image, n_aggregated_images, data_summed) data, force_send_visualisation, data_summed, n_aggregated_images = calc_force_send(results, data, pixel_mask_pf, image, data_summed, n_aggregated_images)
results["type"] = str(data.dtype) results["type"] = str(data.dtype)
results["shape"] = data.shape results["shape"] = data.shape