moved additional checks inside function

This commit is contained in:
2024-07-30 21:25:30 +02:00
parent 26913abbd5
commit 12e008aeba
2 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,13 @@ from peakfinder8_extension import peakfinder_8
def calc_peakfinder_analysis(results, data, pixel_mask_pf): def calc_peakfinder_analysis(results, data, pixel_mask_pf):
if pixel_mask_pf is None:
return
for k in ("beam_center_x", "beam_center_y", "hitfinder_min_snr", "hitfinder_min_pix_count", "hitfinder_adc_thresh"):
if k not in results:
return
x_beam = results["beam_center_x"] - 0.5 # to coordinates where position of first pixel/point is 0.5, 0.5 x_beam = results["beam_center_x"] - 0.5 # to coordinates where position of first pixel/point is 0.5, 0.5
y_beam = results["beam_center_y"] - 0.5 # to coordinates where position of first pixel/point is 0.5, 0.5 y_beam = results["beam_center_y"] - 0.5 # to coordinates where position of first pixel/point is 0.5, 0.5

View File

@ -211,7 +211,7 @@ def work(backend_address, accumulator_host, accumulator_port, visualisation_host
# in case all needed parameters are present, make peakfinding # in case all needed parameters are present, make peakfinding
do_peakfinder_analysis = results.get("do_peakfinder_analysis", False) do_peakfinder_analysis = results.get("do_peakfinder_analysis", False)
if do_peakfinder_analysis and pixel_mask_pf is not None and all(k in results for k in ("beam_center_x", "beam_center_y", "hitfinder_min_snr", "hitfinder_min_pix_count", "hitfinder_adc_thresh")): if do_peakfinder_analysis:
calc_peakfinder_analysis(results, pfdata, pixel_mask_pf) calc_peakfinder_analysis(results, pfdata, pixel_mask_pf)
# ??? # ???