simpler logic

This commit is contained in:
2024-08-02 12:28:09 +02:00
parent 40c0a08d7c
commit b1b92e4b52
3 changed files with 6 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import numpy as np import numpy as np
def calc_roi(results, data, pixel_mask_pf, threshold_value_choice): def calc_roi(results, data, pixel_mask_pf):
if pixel_mask_pf is None: if pixel_mask_pf is None:
return return
@ -20,6 +20,8 @@ def calc_roi(results, data, pixel_mask_pf, threshold_value_choice):
if not (len(roi_x1) == len(roi_x2) == len(roi_y1) == len(roi_y2)): if not (len(roi_x1) == len(roi_x2) == len(roi_y1) == len(roi_y2)):
return return
threshold_value = results.get("threshold_value", "NaN")
roi_intensities = [] roi_intensities = []
roi_intensities_normalised = [] roi_intensities_normalised = []
roi_intensities_x = [] roi_intensities_x = []
@ -30,7 +32,7 @@ def calc_roi(results, data, pixel_mask_pf, threshold_value_choice):
roi_sum = np.nansum(data_roi) roi_sum = np.nansum(data_roi)
if threshold_value_choice == "NaN": if threshold_value == "NaN":
roi_area = (ix2 - ix1) * (iy2 - iy1) roi_area = (ix2 - ix1) * (iy2 - iy1)
roi_sum_norm = roi_sum / roi_area roi_sum_norm = roi_sum / roi_area
else: else:

View File

@ -15,7 +15,5 @@ def calc_apply_threshold(results, data):
if threshold_max > threshold_min: if threshold_max > threshold_min:
data[data > threshold_max] = threshold_value data[data > threshold_max] = threshold_value
return threshold_value_choice

View File

@ -184,9 +184,8 @@ def work(backend_address, accumulator_host, accumulator_port, visualisation_host
if pixel_mask_pf is not None: if pixel_mask_pf is not None:
pfdata[pixel_mask_pf != 1] = np.nan pfdata[pixel_mask_pf != 1] = np.nan
threshold_value_choice = calc_apply_threshold(results, pfdata) calc_apply_threshold(results, pfdata)
calc_roi(results, pfdata, pixel_mask_pf)
calc_roi(results, pfdata, pixel_mask_pf, threshold_value_choice)
calc_spi_analysis(results) calc_spi_analysis(results)
calc_peakfinder_analysis(results, pfdata, pixel_mask_pf) calc_peakfinder_analysis(results, pfdata, pixel_mask_pf)