read detector_name only where it is needed

This commit is contained in:
2024-08-02 14:12:29 +02:00
parent 19f1c8e375
commit d8d984f5a3
2 changed files with 8 additions and 6 deletions

View File

@ -1,11 +1,15 @@
#TODO: find a better way to handle this
def calc_apply_additional_mask(results, detector, pixel_mask_pf):
def calc_apply_additional_mask(results, pixel_mask_pf):
apply_additional_mask = results.get("apply_additional_mask", False)
if not apply_additional_mask:
return
if detector == "JF06T08V04":
detector_name = results.get("detector_name", None)
if not detector_name:
return
if detector_name == "JF06T08V04":
# edge pixels
pixel_mask_pf[0:1030, 1100] = 0
pixel_mask_pf[0:1030, 1613] = 0
@ -52,7 +56,7 @@ def calc_apply_additional_mask(results, detector, pixel_mask_pf):
pixel_mask_pf[1794, 1503:1550] = 0
if detector == "JF17T16V01":
elif detector_name == "JF17T16V01":
# mask module 11
pixel_mask_pf[2619:3333,1577:2607] = 0

View File

@ -105,8 +105,6 @@ def work(backend_address, accumulator_host, accumulator_port, visualisation_host
pulse_id = results.get("pulse_id", 0)
results.update(peakfinder_parameters)
detector_name = results.get("detector_name", "")
results["number_of_spots"] = 0
results["is_hit_frame"] = False
@ -157,7 +155,7 @@ def work(backend_address, accumulator_host, accumulator_port, visualisation_host
pixel_mask_pf = None
calc_apply_additional_mask(results, detector_name, pixel_mask_pf) # changes pixel_mask_pf in place
calc_apply_additional_mask(results, pixel_mask_pf) # changes pixel_mask_pf in place
if pixel_mask_corrected is not None: