Skip to content

Commit

Permalink
ENH: Ignore known warnings, just to clean up the test suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkern committed Apr 11, 2017
1 parent 89c3967 commit 1d426d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion chaco/log_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Major library imports
from numpy import array, isnan, log, log10, exp, zeros, sometrue,\
floor, ceil, ndarray
import numpy as np

# Enthought library imports
from traits.api import Bool, Float
Expand Down Expand Up @@ -54,7 +55,8 @@ def map_screen(self, data_array):
intermediate = data_array*0.0
else:
try:
mask = (data_array <= LOG_MINIMUM) | isnan(data_array)
with np.errstate(invalid='ignore'):
mask = (data_array <= LOG_MINIMUM) | isnan(data_array)
if sometrue(mask):
data_array = array(data_array, copy=True, ndmin=1)
data_array[mask] = self.fill_value
Expand Down
9 changes: 7 additions & 2 deletions chaco/multi_array_data_source.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
""" Defines the MultiArrayDataSource class.
"""
import warnings

# Major package imports
from numpy import nanmax, nanmin, array, shape, ones, bool, newaxis, nan_to_num

Expand Down Expand Up @@ -179,8 +181,11 @@ def get_bounds(self, value = None, index = None):
mini = nanmin(self._data[::, index])
else:
# value is None and index is None:
maxi = nanmax(self._data)
mini = nanmin(self._data)
with warnings.catch_warnings():
warnings.filterwarnings(
'ignore', "All-NaN (slice|axis) encountered", RuntimeWarning)
maxi = nanmax(self._data)
mini = nanmin(self._data)

return (mini, maxi)

Expand Down

0 comments on commit 1d426d4

Please sign in to comment.