use the same validation logic as in other cases
This commit is contained in:
@ -3,11 +3,17 @@ import numpy as np
|
|||||||
|
|
||||||
def calc_apply_threshold(results, data):
|
def calc_apply_threshold(results, data):
|
||||||
apply_threshold = results.get("apply_threshold", False)
|
apply_threshold = results.get("apply_threshold", False)
|
||||||
|
if not apply_threshold:
|
||||||
|
return
|
||||||
|
|
||||||
|
for k in ("threshold_min", "threshold_max"):
|
||||||
|
if k not in results:
|
||||||
|
return
|
||||||
|
|
||||||
threshold_value_choice = results.get("threshold_value", "NaN")
|
threshold_value_choice = results.get("threshold_value", "NaN")
|
||||||
threshold_value = 0 if threshold_value_choice == "0" else np.nan
|
threshold_value = 0 if threshold_value_choice == "0" else np.nan #TODO
|
||||||
|
|
||||||
#TODO: this is duplicated in calc_radial_integration
|
#TODO: this is duplicated in calc_radial_integration
|
||||||
if apply_threshold and all(k in results for k in ("threshold_min", "threshold_max")):
|
|
||||||
threshold_min = float(results["threshold_min"])
|
threshold_min = float(results["threshold_min"])
|
||||||
threshold_max = float(results["threshold_max"])
|
threshold_max = float(results["threshold_max"])
|
||||||
data[data < threshold_min] = threshold_value
|
data[data < threshold_min] = threshold_value
|
||||||
|
Reference in New Issue
Block a user