Here are the examples of the python api numpy.ravel taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
145 Examples
3
View Complete Implementation : test_old_ma.py
Copyright MIT License
Author : ktraunmueller
Copyright MIT License
Author : ktraunmueller
def test_testMinMax (self):
"Test minimum and maximum."
(x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d
xr = np.ravel(x) #max doesn't work if shaped
xmr = ravel(xm)
#true because of careful selection of data
self.astertTrue(eq(max(xr), maximum(xmr)))
#true because of careful selection of data
self.astertTrue(eq(min(xr), minimum(xmr)))
3
View Complete Implementation : test_fitpack.py
Copyright MIT License
Author : ktraunmueller
Copyright MIT License
Author : ktraunmueller
def check_5(self,f=f2,kx=3,ky=3,xb=0,xe=2*pi,yb=0,ye=2*pi,Nx=20,Ny=20,s=0):
x = xb+(xe-xb)*arange(Nx+1,dtype=float)/float(Nx)
y = yb+(ye-yb)*arange(Ny+1,dtype=float)/float(Ny)
xy = makepairs(x,y)
tck = bisplrep(xy[0],xy[1],f(xy[0],xy[1]),s=s,kx=kx,ky=ky)
tt = [tck[0][kx:-kx],tck[1][ky:-ky]]
t2 = makepairs(tt[0],tt[1])
v1 = bisplev(tt[0],tt[1],tck)
v2 = f2(t2[0],t2[1])
v2.shape = len(tt[0]),len(tt[1])
err = norm2(ravel(v1-v2))
astert_(err < 1e-2, err)
put(err)
3
View Complete Implementation : test_fitpack.py
Copyright MIT License
Author : ktraunmueller
Copyright MIT License
Author : ktraunmueller
def check_5(self,f=f2,kx=3,ky=3,xb=0,xe=2*pi,yb=0,ye=2*pi,Nx=20,Ny=20,s=0):
x = xb+(xe-xb)*arange(Nx+1,dtype=float)/float(Nx)
y = yb+(ye-yb)*arange(Ny+1,dtype=float)/float(Ny)
xy = makepairs(x,y)
tck = bisplrep(xy[0],xy[1],f(xy[0],xy[1]),s=s,kx=kx,ky=ky)
tt = [tck[0][kx:-kx],tck[1][ky:-ky]]
t2 = makepairs(tt[0],tt[1])
v1 = bisplev(tt[0],tt[1],tck)
v2 = f2(t2[0],t2[1])
v2.shape = len(tt[0]),len(tt[1])
err = norm2(ravel(v1-v2))
astert_(err < 1e-2, err)
put(err)
3
View Complete Implementation : _support.py
Copyright MIT License
Author : ktraunmueller
Copyright MIT License
Author : ktraunmueller
def _chk2_asarray(a, b, axis):
if axis is None:
a = np.ravel(a)
b = np.ravel(b)
outaxis = 0
else:
a = np.asarray(a)
b = np.asarray(b)
outaxis = axis
return a, b, outaxis
3
View Complete Implementation : _support.py
Copyright MIT License
Author : ktraunmueller
Copyright MIT License
Author : ktraunmueller
def _chk2_asarray(a, b, axis):
if axis is None:
a = np.ravel(a)
b = np.ravel(b)
outaxis = 0
else:
a = np.asarray(a)
b = np.asarray(b)
outaxis = axis
return a, b, outaxis
3
View Complete Implementation : _support.py
Copyright MIT License
Author : ktraunmueller
Copyright MIT License
Author : ktraunmueller
def _chk_asarray(a, axis):
if axis is None:
a = np.ravel(a)
outaxis = 0
else:
a = np.asarray(a)
outaxis = axis
return a, outaxis
3
View Complete Implementation : _support.py
Copyright MIT License
Author : ktraunmueller
Copyright MIT License
Author : ktraunmueller
def _chk_asarray(a, axis):
if axis is None:
a = np.ravel(a)
outaxis = 0
else:
a = np.asarray(a)
outaxis = axis
return a, outaxis
3
View Complete Implementation : mlabwrap.py
Copyright MIT License
Author : hello-sea
Copyright MIT License
Author : hello-sea
def _format_struct(self, varname):
res = []
fieldnames = self._do("fieldnames(%s)" % varname)
size = numpy.ravel(self._do("size(%s)" % varname))
return "%dx%d struct array with fields:\n%s" % (
size[0], size[1], "\n ".join([""] + fieldnames))
3
View Complete Implementation : mlabwrap.py
Copyright MIT License
Author : hello-sea
Copyright MIT License
Author : hello-sea
def _format_struct(self, varname):
res = []
fieldnames = self._do("fieldnames(%s)" % varname)
size = numpy.ravel(self._do("size(%s)" % varname))
return "%dx%d struct array with fields:\n%s" % (
size[0], size[1], "\n ".join([""] + fieldnames))
3
View Complete Implementation : mlabwrap.py
Copyright MIT License
Author : hello-sea
Copyright MIT License
Author : hello-sea
def _format_struct(self, varname):
res = []
fieldnames = self._do("fieldnames(%s)" % varname)
size = numpy.ravel(self._do("size(%s)" % varname))
return "%dx%d struct array with fields:\n%s" % (
size[0], size[1], "\n ".join([""] + fieldnames))