From e26325dfc3da59113e44595c908a127e239f06b5 Mon Sep 17 00:00:00 2001 From: Per A Brodtkorb Date: Mon, 20 Feb 2017 19:07:11 +0100 Subject: [PATCH] Fixed a TypeError: 'numpy.float64' object cannot be interpreted as an index --- wafo/misc.py | 2 +- wafo/spectrum/core.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wafo/misc.py b/wafo/misc.py index cce43d8..484de8a 100644 --- a/wafo/misc.py +++ b/wafo/misc.py @@ -2916,7 +2916,7 @@ def _histogram(data, bins=None, range=None, normed=False, weights=None, """ x = np.atleast_1d(data) if bins is None: - bins = np.ceil(4 * np.sqrt(np.sqrt(len(x)))) + bins = int(np.ceil(4 * np.sqrt(np.sqrt(len(x))))) bin_, limits = np.histogram(data, bins=bins, range=range, normed=normed, weights=weights, density=density) xx, yy = _make_bars(limits, bin_) diff --git a/wafo/spectrum/core.py b/wafo/spectrum/core.py index 16e111b..b51d1ff 100644 --- a/wafo/spectrum/core.py +++ b/wafo/spectrum/core.py @@ -578,7 +578,7 @@ class SpecData1D(PlotData): if dt is None: return dt_old, 1 rate = max(round(dt_old * 1. / dt), 1.) - return dt, rate + return dt, int(rate) def _check_dt(self, dt): freq = self.args @@ -659,9 +659,9 @@ class SpecData1D(PlotData): n_f = len(freq) if nt is None: nt = rate * (n_f - 1) - else: # %check if Nt is ok + else: # check if Nt is ok nt = minimum(nt, rate * (n_f - 1)) - + # nr, nt = int(nr), int(nt) spec = self.copy() spec.resample(dt)