Fixed TypeError: Non-integers used as index values

master
Per A Brodtkorb 8 years ago
parent bb3848e31a
commit b0fde67abc

@ -91,8 +91,9 @@ class Rind(object):
Cov(Xi,Xj) = 0.3 for i~=j and Cov(Xi,Xj) = 0.3 for i~=j and
Cov(Xi,Xi) = 1 otherwise Cov(Xi,Xi) = 1 otherwise
>>> import wafo.gaussian as wg >>> import wafo.gaussian as wg
>>> import numpy as np
>>> n = 5 >>> n = 5
>>> Blo =-np.inf; Bup=-1.2; indI=[-1, n-1] # Barriers >>> Blo =-np.inf; Bup=-1.2; indI=np.array([-1, n-1], dtype=int) # Barriers
>>> m = np.zeros(n); rho = 0.3; >>> m = np.zeros(n); rho = 0.3;
>>> Sc =(np.ones((n,n))-np.eye(n))*rho+np.eye(n) >>> Sc =(np.ones((n,n))-np.eye(n))*rho+np.eye(n)
>>> rind = wg.Rind() >>> rind = wg.Rind()

@ -248,7 +248,7 @@ def evar(y):
sh0 = y.shape sh0 = y.shape
S = np.zeros(sh0) S = np.zeros(sh0)
sh1 = np.ones((d,)) sh1 = np.ones((d,), dtype=np.int64)
cos = np.cos cos = np.cos
for i in range(d): for i in range(d):
ni = sh0[i] ni = sh0[i]

@ -758,16 +758,16 @@ class SpecData1D(PlotData):
raise ValueError(txt) raise ValueError(txt)
if rate is None: if rate is None:
rate = 1 # %interpolation rate rate = 1 # interpolation rate
elif rate > 16: elif rate > 16:
rate = 16 rate = 16
else: # make sure rate is a power of 2 else: # make sure rate is a power of 2
rate = 2 ** nextpow2(rate) rate = 2 ** nextpow2(rate)
if nt is None: if nt is None:
nt = rate * (n_f - 1) nt = int(rate * (n_f - 1))
else: # check if Nt is ok else: # check if Nt is ok
nt = minimum(nt, rate * (n_f - 1)) nt = int(minimum(nt, rate * (n_f - 1)))
spec = self.copy() spec = self.copy()

@ -17,7 +17,7 @@ def test_rind():
n = 5 n = 5
Blo = -np.inf Blo = -np.inf
Bup = -1.2 Bup = -1.2
indI = [-1, n - 1] # Barriers indI = np.array([-1, n - 1], dtype=int) # Barriers
m = np.zeros(n) m = np.zeros(n)
rho = 0.3 rho = 0.3
Sc = (np.ones((n, n)) - np.eye(n)) * rho + np.eye(n) Sc = (np.ones((n, n)) - np.eye(n)) * rho + np.eye(n)

Loading…
Cancel
Save