handle equals case correctly (i.e., like indices)
This commit is contained in:
@@ -27,7 +27,7 @@ def calc_apply_threshold(results, data, value=None, copy=False):
|
|||||||
|
|
||||||
def threshold(data, vmin, vmax, replacement):
|
def threshold(data, vmin, vmax, replacement):
|
||||||
"""
|
"""
|
||||||
threshold data in place by replacing values < vmin and values > vmax with replacement
|
threshold data in place by replacing values < vmin and values >= vmax with replacement
|
||||||
"""
|
"""
|
||||||
if vmin is not None and vmax is not None:
|
if vmin is not None and vmax is not None:
|
||||||
# if vmin > vmax, data will be overwritten entirely -- better to ensure vmin < vmax by switching them if needed
|
# if vmin > vmax, data will be overwritten entirely -- better to ensure vmin < vmax by switching them if needed
|
||||||
@@ -35,7 +35,7 @@ def threshold(data, vmin, vmax, replacement):
|
|||||||
if vmin is not None:
|
if vmin is not None:
|
||||||
data[data < vmin] = replacement
|
data[data < vmin] = replacement
|
||||||
if vmax is not None:
|
if vmax is not None:
|
||||||
data[data > vmax] = replacement
|
data[data >= vmax] = replacement
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user