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