flatten the code; early exit
This commit is contained in:
@ -64,9 +64,14 @@ def radial_profile(data, rad, norm, keep_pixels):
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
#TODO: this is duplicated in calc_apply_threshold and calc_force_send
|
#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_min = float(results["threshold_min"])
|
||||||
threshold_max = float(results["threshold_max"])
|
threshold_max = float(results["threshold_max"])
|
||||||
data = data.copy() # do the following in-place changes on a copy
|
data = data.copy() # do the following in-place changes on a copy
|
||||||
|
Reference in New Issue
Block a user