Skip to content
Snippets Groups Projects
Commit 163a9b29 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Bugfix to ImageWrapper.__expandCoverage - was not taking into account new

expansion with nans. Also small deprecation adjustment in naninfrange
parent fce9a371
No related branches found
No related tags found
No related merge requests found
...@@ -461,20 +461,22 @@ class ImageWrapper(notifier.Notifier): ...@@ -461,20 +461,22 @@ class ImageWrapper(notifier.Notifier):
# coverage and data range. # coverage and data range.
for exp in expansions: for exp in expansions:
data = self.__getData(exp, isTuple=True) data = self.__getData(exp, isTuple=True)
data = data.squeeze(squeezeDims) data = data.squeeze(squeezeDims)
vlo, vhi = exp[self.__numRealDims - 1] vlo, vhi = exp[self.__numRealDims - 1]
for vi, vol in enumerate(range(vlo, vhi)): for vi, vol in enumerate(range(vlo, vhi)):
oldvlo, oldvhi = self.__volRanges[vol, :] oldvlo, oldvhi = self.__volRanges[vol, :]
voldata = data[..., vi] voldata = data[..., vi]
newvlo, newvhi = naninfrange(voldata) newvlo, newvhi = naninfrange(voldata)
if (not np.isnan(oldvlo)) and oldvlo < newvlo: newvlo = oldvlo if np.isnan(newvlo) or \
if (not np.isnan(oldvhi)) and oldvhi > newvhi: newvhi = oldvhi (not np.isnan(oldvlo) and oldvlo < newvlo):
newvlo = oldvlo
if np.isnan(newvhi) or \
(not np.isnan(oldvhi) and oldvhi > newvhi):
newvhi = oldvhi
# Update the stored range and # Update the stored range and
# coverage for each volume # coverage for each volume
...@@ -720,7 +722,7 @@ def naninfrange(data): ...@@ -720,7 +722,7 @@ def naninfrange(data):
use an alternate approach to calculating the minimum/maximum. use an alternate approach to calculating the minimum/maximum.
""" """
if not np.issubdtype(data.dtype, np.float): if not np.issubdtype(data.dtype, np.floating):
return data.min(), data.max() return data.min(), data.max()
# But np.nanmin/nanmax are substantially # But np.nanmin/nanmax are substantially
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment