Fixed a TypeError: 'numpy.float64' object cannot be interpreted as an index

master
Per A Brodtkorb 8 years ago
parent b0fde67abc
commit e26325dfc3

@ -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_)

@ -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)

Loading…
Cancel
Save