Skip to content

Commit

Permalink
fix: replace calls to deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
jokasimr committed Jun 18, 2024
1 parent 939e97a commit 81ed86d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/plopp/backends/matplotlib/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ def logx(self):
"""
self.xscale = 'log' if self.xscale == 'linear' else 'linear'
self._bbox.xmin = np.inf
self._bbox.xmax = np.NINF
self._bbox.xmax = -np.inf
self.autoscale()

def logy(self):
Expand All @@ -542,7 +542,7 @@ def logy(self):
"""
self.yscale = 'log' if self.yscale == 'linear' else 'linear'
self._bbox.ymin = np.inf
self._bbox.ymax = np.NINF
self._bbox.ymax = -np.inf
self.autoscale()

def finalize(self):
Expand Down
2 changes: 1 addition & 1 deletion src/plopp/core/limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def find_limits(
if x.masks:
x = sc.where(
merge_masks(x.masks),
sc.scalar(np.NaN, unit=x.unit),
sc.scalar(np.nan, unit=x.unit),
x.data.to(dtype='float64'),
)
v = x.values
Expand Down
4 changes: 2 additions & 2 deletions src/plopp/graphics/colormapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __init__(
self.user_vmin = vmin
self.user_vmax = vmax
self.vmin = np.inf
self.vmax = np.NINF
self.vmax = -np.inf
self.norm = norm
self._autoscale = autoscale

Expand Down Expand Up @@ -271,7 +271,7 @@ def toggle_norm(self):
self.norm = "log" if self.norm == 'linear' else 'linear'
self.normalizer = _get_normalizer(self.norm)
self.vmin = np.inf
self.vmax = np.NINF
self.vmax = -np.inf
self.autoscale()
self._set_normalizer_limits()
self._set_artists_colors(self.artists.keys())
Expand Down
4 changes: 2 additions & 2 deletions tests/core/limits_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ def test_find_limits_with_inf():

def test_find_limits_with_ninf():
da = sc.DataArray(data=sc.arange('x', 11.0, unit='m'))
da.values[5] = np.NINF
da.values[5] = -np.inf
lims = find_limits(da)
assert sc.identical(lims[0], sc.scalar(0.0, unit='m'))
assert sc.identical(lims[1], sc.scalar(10.0, unit='m'))


def test_find_limits_no_finite_values_raises():
da = sc.DataArray(
data=sc.array(dims=['x'], values=[np.nan, np.inf, np.NINF, np.nan], unit='m')
data=sc.array(dims=['x'], values=[np.nan, np.inf, -np.inf, np.nan], unit='m')
)
with pytest.raises(ValueError, match="No finite values were found in array"):
_ = find_limits(da)
Expand Down

0 comments on commit 81ed86d

Please sign in to comment.