Skip to content

Commit

Permalink
Clean up references to deprecated Numpy type aliases (#2204)
Browse files Browse the repository at this point in the history
* cleaned up refs to deprecated Numpy type aliases

* Update arviz/stats/density_utils.py

---------

Co-authored-by: Oriol Abril-Pla <[email protected]>
  • Loading branch information
ahk02 and OriolAbril authored Feb 9, 2023
1 parent 6f90214 commit 6ae4439
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion arviz/data/io_pyro.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def posterior_to_xarray(self):
def sample_stats_to_xarray(self):
"""Extract sample_stats from Pyro posterior."""
divergences = self.posterior.diagnostics()["divergences"]
diverging = np.zeros((self.nchains, self.ndraws), dtype=np.bool)
diverging = np.zeros((self.nchains, self.ndraws), dtype=bool)
for i, k in enumerate(sorted(divergences)):
diverging[i, divergences[k]] = True
data = {"diverging": diverging}
Expand Down
2 changes: 1 addition & 1 deletion arviz/stats/density_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def _check_custom_lims(custom_lims, x_min, x_max):
if custom_lims[1] is None:
custom_lims[1] = x_max

all_numeric = all(isinstance(i, (int, float, np.integer, np.float)) for i in custom_lims)
all_numeric = all(isinstance(i, (int, float, np.integer, np.number)) for i in custom_lims)
if not all_numeric:
raise TypeError(
"Elements of `custom_lims` must be numeric or None.\nAt least one of them is not."
Expand Down
4 changes: 2 additions & 2 deletions arviz/stats/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ def _mcse_sd(ary):
return np.nan
ess = _ess_sd(ary)
if _numba_flag:
sd = np.float(_sqrt(svar(np.ravel(ary), ddof=1), np.zeros(1)))
sd = float(_sqrt(svar(np.ravel(ary), ddof=1), np.zeros(1)))
else:
sd = np.std(ary, ddof=1)
fac_mcse_sd = np.sqrt(np.exp(1) * (1 - 1 / ess) ** (ess - 1) - 1)
Expand Down Expand Up @@ -905,7 +905,7 @@ def _mc_error(ary, batches=5, circular=False):
else:
std = stats.circstd(ary, high=np.pi, low=-np.pi)
elif _numba_flag:
std = np.float(_sqrt(svar(ary), np.zeros(1)))
std = float(_sqrt(svar(ary), np.zeros(1)))
else:
std = np.std(ary)
return std / np.sqrt(len(ary))
Expand Down

0 comments on commit 6ae4439

Please sign in to comment.