moved calc_apply_threshold out of calc_radial_integration
This commit is contained in:
@ -16,17 +16,7 @@ def calc_radial_integration(results, data, pixel_mask_pf):
|
|||||||
r_min = min(rad)
|
r_min = min(rad)
|
||||||
r_max = max(rad) + 1
|
r_max = max(rad) + 1
|
||||||
|
|
||||||
apply_threshold = results.get("apply_threshold", False)
|
data = calc_apply_threshold(results, data)
|
||||||
|
|
||||||
#TODO: this is duplicated in calc_apply_threshold and calc_force_send
|
|
||||||
if apply_threshold and all(k in results for k in ("threshold_min", "threshold_max")):
|
|
||||||
threshold_min = float(results["threshold_min"])
|
|
||||||
threshold_max = float(results["threshold_max"])
|
|
||||||
data = data.copy() # do the following in-place changes on a copy
|
|
||||||
data[data < threshold_min] = np.nan
|
|
||||||
#TODO: skipping max is a guess, but not obvious/symmetric -- better to ensure the order min < max by switching them if needed
|
|
||||||
if threshold_max > threshold_min:
|
|
||||||
data[data > threshold_max] = np.nan
|
|
||||||
|
|
||||||
rp = radial_profile(data, rad, norm, pixel_mask_pf)
|
rp = radial_profile(data, rad, norm, pixel_mask_pf)
|
||||||
|
|
||||||
@ -72,3 +62,20 @@ def radial_profile(data, rad, norm, keep_pixels):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def calc_apply_threshold(results, data):
|
||||||
|
apply_threshold = results.get("apply_threshold", False)
|
||||||
|
|
||||||
|
#TODO: this is duplicated in calc_apply_threshold and calc_force_send
|
||||||
|
if apply_threshold and all(k in results for k in ("threshold_min", "threshold_max")):
|
||||||
|
threshold_min = float(results["threshold_min"])
|
||||||
|
threshold_max = float(results["threshold_max"])
|
||||||
|
data = data.copy() # do the following in-place changes on a copy
|
||||||
|
data[data < threshold_min] = np.nan
|
||||||
|
#TODO: skipping max is a guess, but not obvious/symmetric -- better to ensure the order min < max by switching them if needed
|
||||||
|
if threshold_max > threshold_min:
|
||||||
|
data[data > threshold_max] = np.nan
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user