diff --git a/dap/algos/roi.py b/dap/algos/roi.py index 708789b..efcdcab 100644 --- a/dap/algos/roi.py +++ b/dap/algos/roi.py @@ -1,7 +1,7 @@ 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: 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)): return + threshold_value = results.get("threshold_value", "NaN") + roi_intensities = [] roi_intensities_normalised = [] roi_intensities_x = [] @@ -30,7 +32,7 @@ def calc_roi(results, data, pixel_mask_pf, threshold_value_choice): roi_sum = np.nansum(data_roi) - if threshold_value_choice == "NaN": + if threshold_value == "NaN": roi_area = (ix2 - ix1) * (iy2 - iy1) roi_sum_norm = roi_sum / roi_area else: diff --git a/dap/algos/thresh.py b/dap/algos/thresh.py index c902348..1c18427 100644 --- a/dap/algos/thresh.py +++ b/dap/algos/thresh.py @@ -15,7 +15,5 @@ def calc_apply_threshold(results, data): if threshold_max > threshold_min: data[data > threshold_max] = threshold_value - return threshold_value_choice - diff --git a/dap/worker.py b/dap/worker.py index b252a33..da46b21 100644 --- a/dap/worker.py +++ b/dap/worker.py @@ -184,9 +184,8 @@ def work(backend_address, accumulator_host, accumulator_port, visualisation_host if pixel_mask_pf is not None: pfdata[pixel_mask_pf != 1] = np.nan - threshold_value_choice = calc_apply_threshold(results, pfdata) - - calc_roi(results, pfdata, pixel_mask_pf, threshold_value_choice) + calc_apply_threshold(results, pfdata) + calc_roi(results, pfdata, pixel_mask_pf) calc_spi_analysis(results) calc_peakfinder_analysis(results, pfdata, pixel_mask_pf)