Commit 9511f303 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

fix numpy deprecation warnings

parent 0eff4f8e
......@@ -59,11 +59,11 @@ class GLSpace(StructuredDomain):
@property
def shape(self):
return (np.int((self.nlat * self.nlon)),)
return (int(self.nlat * self.nlon),)
@property
def size(self):
return np.int((self.nlat * self.nlon))
return int(self.nlat * self.nlon)
@property
def scalar_dvol(self):
......
......@@ -53,7 +53,7 @@ class HPSpace(StructuredDomain):
@property
def size(self):
return np.int(12 * self.nside * self.nside)
return int(12 * self.nside * self.nside)
@property
def scalar_dvol(self):
......
......@@ -131,7 +131,7 @@ class LMSpace(StructuredDomain):
op = HarmonicTransformOperator(lm0, gl)
kernel_lm = op.adjoint_times(kernel_sphere.weight(1)).val
# evaluate the k lengths of the harmonic space
k_lengths = self.get_k_length_array().val.astype(np.int)
k_lengths = self.get_k_length_array().val.astype(np.int64)
return Field.from_raw(self, kernel_lm[k_lengths])
@property
......
......@@ -122,7 +122,7 @@ class RGSpace(StructuredDomain):
if np.all(self.distances == self.distances[0]): # shortcut
maxdist = np.asarray(self.shape)//2
tmp = np.sum(maxdist*maxdist)
tmp = np.zeros(tmp+1, dtype=np.bool)
tmp = np.zeros(tmp+1, dtype=bool)
t2 = np.arange(maxdist[0]+1, dtype=np.int64)
t2 *= t2
for i in range(1, dimensions):
......
......@@ -259,7 +259,7 @@ class Field(Operator):
if np.isscalar(wgt):
fct *= wgt
else:
new_shape = np.ones(len(self.shape), dtype=np.int)
new_shape = np.ones(len(self.shape), dtype=np.int64)
new_shape[self._domain.axes[ind][0]:
self._domain.axes[ind][-1]+1] = wgt.shape
wgt = wgt.reshape(new_shape)
......
......@@ -68,9 +68,9 @@ class _LightConeDerivative(LinearOperator):
def _cone_arrays(c, domain, sigx, want_gradient):
x = _make_coords(domain)
a = np.zeros(domain.shape, dtype=np.complex)
a = np.zeros(domain.shape, dtype=np.complex128)
if want_gradient:
derivs = np.zeros((c.size,) + domain.shape, dtype=np.complex)
derivs = np.zeros((c.size,) + domain.shape, dtype=np.complex128)
else:
derivs = None
a -= (x[0]/(sigx*domain[0].distances[0]))**2
......
......@@ -64,10 +64,10 @@ def _comp_traverse(start, end, shp, dist, lo, mid, hi, sig, erf):
c_first = np.ceil(start[:, i]+direction*dmin)
c_first = np.where(direction > 0., c_first, c_first-1.)
c_first = (c_first-start[:, i])/dirx
pos1 = np.asarray((start[:, i]+dmin*direction), dtype=np.int)
pos1 = np.asarray((start[:, i]+dmin*direction), dtype=np.int64)
pos1 = np.sum(pos1*inc)
cdist = np.empty(0, dtype=np.float64)
add = np.empty(0, dtype=np.int)
add = np.empty(0, dtype=np.int64)
for j in range(ndim):
if direction[j] != 0:
step = inc[j] if direction[j] > 0 else -inc[j]
......
......@@ -393,7 +393,7 @@ class _InformationStore(object):
m = self.history_length
mmax = self.max_history_length
k = self.k
result = np.empty((2*m+1, 2*m+1), dtype=np.float)
result = np.empty((2*m+1, 2*m+1), dtype=np.float64)
# update the stores
k1 = (k-1) % mmax
......@@ -435,10 +435,10 @@ class _InformationStore(object):
m = self.history_length
b_dot_b = self.b_dot_b
delta = np.zeros(2*m+1, dtype=np.float)
delta = np.zeros(2*m+1, dtype=np.float64)
delta[2*m] = -1
alpha = np.empty(m, dtype=np.float)
alpha = np.empty(m, dtype=np.float64)
for j in range(m-1, -1, -1):
delta_b_b = sum([delta[l] * b_dot_b[l, j] for l in range(2*m+1)])
......
......@@ -138,8 +138,8 @@ class LineSearch(metaclass=NiftyMeta):
max_zoom_iterations=100):
self.preferred_initial_step_size = preferred_initial_step_size
self.c1 = np.float(c1)
self.c2 = np.float(c2)
self.c1 = float(c1)
self.c2 = float(c2)
self.max_step_size = max_step_size
self.max_iterations = int(max_iterations)
self.max_zoom_iterations = int(max_zoom_iterations)
......
......@@ -97,8 +97,8 @@ class DOFDistributor(LinearOperator):
firstaxis = self._target.axes[self._space][0]
lastaxis = self._target.axes[self._space][-1]
arrshape = self._target.shape
presize = np.prod(arrshape[0:firstaxis], dtype=np.int)
postsize = np.prod(arrshape[lastaxis+1:], dtype=np.int)
presize = np.prod(arrshape[0:firstaxis], dtype=np.int64)
postsize = np.prod(arrshape[lastaxis+1:], dtype=np.int64)
self._hshape = (presize, self._domain[self._space].shape[0], postsize)
self._pshape = (presize, self._dofdex.size, postsize)
......
......@@ -66,7 +66,7 @@ class RegriddingOperator(LinearOperator):
self._frac = [None] * ndim
for d in range(ndim):
tmp = np.arange(new_shape[d])*(newdist[d]/dom.distances[d])
self._bindex[d] = np.minimum(dom.shape[d]-2, tmp.astype(np.int))
self._bindex[d] = np.minimum(dom.shape[d]-2, tmp.astype(np.int64))
self._frac[d] = tmp-self._bindex[d]
def apply(self, x, mode):
......
......@@ -31,7 +31,7 @@ SPACE_COMBINATIONS = [(), SPACES[0], SPACES[1], SPACES]
@pmp('domain', SPACE_COMBINATIONS)
@pmp('attribute_desired_type',
[['domain', ift.DomainTuple], ['val', np.ndarray],
['shape', tuple], ['size', (np.int, np.int64)]])
['shape', tuple], ['size', (int, np.int32, np.int64)]])
def test_return_types(domain, attribute_desired_type):
attribute = attribute_desired_type[0]
desired_type = attribute_desired_type[1]
......@@ -286,7 +286,7 @@ def test_stdfunc():
f = ift.Field.full(s, 27)
assert_equal(f.val, 27)
assert_equal(f.shape, (200,))
assert_equal(f.dtype, np.int)
assert_equal(f.dtype, np.int64)
fx = ift.full(f.domain, 0)
assert_equal(f.dtype, fx.dtype)
assert_equal(f.shape, fx.shape)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment