Commit 55be306e authored by Martin Reinecke's avatar Martin Reinecke
Browse files

reshape(-1) -> ravel()

parent b6e09b5f
...@@ -706,7 +706,7 @@ class Field(object): ...@@ -706,7 +706,7 @@ class Field(object):
fct = tmp fct = tmp
if spaces is None: if spaces is None:
return fct*np.vdot(y.val.reshape(-1), x.val.reshape(-1)) return fct*np.vdot(y.val.ravel(), x.val.ravel())
else: else:
# create a diagonal operator which is capable of taking care of the # create a diagonal operator which is capable of taking care of the
# axes-matching # axes-matching
......
...@@ -299,7 +299,7 @@ class LineSearchStrongWolfe(LineSearch): ...@@ -299,7 +299,7 @@ class LineSearchStrongWolfe(LineSearch):
d1[1, 0] = -(dc*dc*dc) d1[1, 0] = -(dc*dc*dc)
d1[1, 1] = db*db*db d1[1, 1] = db*db*db
[A, B] = np.dot(d1, np.asarray([fb - fa - C * db, [A, B] = np.dot(d1, np.asarray([fb - fa - C * db,
fc - fa - C * dc]).reshape(-1)) fc - fa - C * dc]).ravel())
A /= denom A /= denom
B /= denom B /= denom
radical = B * B - 3 * A * C radical = B * B - 3 * A * C
......
...@@ -117,7 +117,7 @@ class GLSpace(Space): ...@@ -117,7 +117,7 @@ class GLSpace(Space):
def weight(self): def weight(self):
from pyHealpix import GL_weights from pyHealpix import GL_weights
vol = GL_weights(self.nlat, self.nlon) vol = GL_weights(self.nlat, self.nlon)
return np.outer(vol, np.ones(self.nlon,dtype=np.float64)).reshape(-1) return np.outer(vol, np.ones(self.nlon,dtype=np.float64)).ravel()
# ---Added properties and methods--- # ---Added properties and methods---
......
...@@ -162,10 +162,10 @@ class PowerSpace(Space): ...@@ -162,10 +162,10 @@ class PowerSpace(Space):
harmonic_partner=self.harmonic_partner, harmonic_partner=self.harmonic_partner,
distance_array=distance_array, distance_array=distance_array,
binbounds=binbounds) binbounds=binbounds)
temp_rho = np.bincount(temp_pindex.reshape(-1)) temp_rho = np.bincount(temp_pindex.ravel())
assert not np.any(temp_rho == 0), "empty bins detected" assert not np.any(temp_rho == 0), "empty bins detected"
temp_kindex = np.bincount(temp_pindex.reshape(-1), temp_kindex = np.bincount(temp_pindex.ravel(),
weights=distance_array.reshape(-1)) \ weights=distance_array.ravel()) \
/ temp_rho / temp_rho
self._powerIndexCache[key] = (binbounds, self._powerIndexCache[key] = (binbounds,
temp_pindex, temp_pindex,
......
...@@ -101,7 +101,7 @@ class PowerSpaceConsistencyCheck(unittest.TestCase): ...@@ -101,7 +101,7 @@ class PowerSpaceConsistencyCheck(unittest.TestCase):
bb = PowerSpace.useful_binbounds(harmonic_partner, logarithmic, nbin) bb = PowerSpace.useful_binbounds(harmonic_partner, logarithmic, nbin)
p = PowerSpace(harmonic_partner=harmonic_partner, binbounds=bb) p = PowerSpace(harmonic_partner=harmonic_partner, binbounds=bb)
assert_equal(np.bincount(p.pindex.reshape(-1)), p.rho, assert_equal(np.bincount(p.pindex.ravel()), p.rho,
err_msg='rho is not equal to pindex degeneracy') err_msg='rho is not equal to pindex degeneracy')
......
Markdown is supported
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