added replacement value as argument
This commit is contained in:
@@ -2,7 +2,7 @@ import numpy as np
|
||||
|
||||
|
||||
#TODO: this is duplicated in calc_radial_integration and calc_apply_aggregation
|
||||
def calc_apply_threshold(results, data, copy=False):
|
||||
def calc_apply_threshold(results, data, value=None, copy=False):
|
||||
apply_threshold = results.get("apply_threshold", False)
|
||||
if not apply_threshold:
|
||||
return data
|
||||
@@ -11,8 +11,9 @@ def calc_apply_threshold(results, data, copy=False):
|
||||
if k not in results:
|
||||
return data
|
||||
|
||||
threshold_value_choice = results.get("threshold_value", "NaN")
|
||||
threshold_value = 0 if threshold_value_choice == "0" else np.nan #TODO
|
||||
if value is None:
|
||||
threshold_value = results.get("threshold_value", "NaN")
|
||||
value = 0 if threshold_value == "0" else np.nan #TODO
|
||||
|
||||
threshold_min = float(results["threshold_min"])
|
||||
threshold_max = float(results["threshold_max"])
|
||||
@@ -20,7 +21,7 @@ def calc_apply_threshold(results, data, copy=False):
|
||||
if copy:
|
||||
data = data.copy() # do the following in-place changes on a copy
|
||||
|
||||
threshold(data, threshold_min, threshold_max, threshold_value)
|
||||
threshold(data, threshold_min, threshold_max, value)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user