| | - ArrayToImage(a)
- converts array to greyscale or color image
- ImageToArray(i)
- converts greyscale or color image to (byte) array
- addmirrored(x, n)
- Take a 1D vector x and add n points at both ends, respecting the mirror
on boundary conditions.
- aexp(x)
- Works just like an ordinary exp, except it returns zero for
large negative arguments, not OverflowError :-(
no longer necessary in Python 2.1
- alltrue = reduce(...)
- applyforallrows(x, oper, ndim=None)
- Apply an operation for all rows of x. The operation oper
should take a 1D vector and return another 1D vector.
If passdim is true, the 'oper' is passed a keyword argument
'ndim' giving the dimension being processed.
- array(...)
- array(sequence, typecode=None, copy=1, savespace=0) will return a new array formed from the given (potentially nested) sequence with type given by typecode. If no typecode is given, then the type will be determined as the minimum type required to hold the objects in sequence. If copy is zero and sequence is already an array, a reference will be returned. If savespace is nonzero, the new array will maintain its precision in operations.
- array2ppm(image)
- basisv(shape, i, type='d')
- Return an array of 'type' of shape 'shape', with all zeros except
one at index i.
- calchist(x, h=1.0, minx=None, maxx=None)
- Given an array (or vector x), returns pair of vectors (t,cnt)
suitable for showing the histogram of x with plot. h is the spacing
and minx/maxx the lower and upper limits
- choose(...)
- choose(a, (b1,b2,...))
- cross_correlate(...)
- cross_correlate(a,v)
- cumproduct = accumulate(...)
- cumsum = accumulate(...)
- dotrange(x, y, s, square=0)
- Compute the dot-product of x and y, taking advantage of the
fact that the only non-zero elements of y are in range s,
as returned by rangetoslice(r). If square==1, the second argument
is squared.
- downsample(x, n)
- Downsample 1D array x by a factor of n, starting at the first
element
- float_array(m)
- Makes a floating array out of m, accepting just about anything
Taken from Gnuplot.utils by
Michael Haggerty <mhagger@alum.mit.edu>
- foldmirrored(x, n)
- Cut n points at the beginning and end of x, foldover and add
to the original vector
- fromstring(...)
- fromstring(string, count=None, typecode='l') returns a new 1d array initialized from the raw binary data in string. If count is not equal to None, the new array will have count elements, otherwise it's size is determined by the size of string.
- getindices(x=None, shape=None)
- Return a list of all indices of an array x. Usage:
for i in getindices(x): # print all elements
print x[i]
- int_array(m)
- Makes an int array out of m, accepting just about anything
- keyboard()
- Debugging function. Stops the program and lets you execute
commands from the keyboard until empty line is given.
- maddmirrored(x, n)
- Apply addmirrored to a multidimensional x, extending
it in all directions
- makeClassBag(classes=[], accumulators={})
- makeClassBag permits to create a bag object containing several
client objects. When a message is sent to the bag object, it is
resent to all clients. The response from clients is aggregated
using a user supplied accumulating functions.
Instantiation:
classbag=makeClassBag([classA,classB,classC],
accumulators={'result': operator.add})
b=classbag(1,2,3) # instantiates all clients
Calling b.fun(1,2) then returns: classA(1,2)+classB(1,2)
Default operator is returning the list of all results.
Note that changing data members of the client objects is not supported
- makeGrid(size, step=(20, 20))
- Returns an array with a grid pattern
- maxelement(x)
- Returns the value of the largest element of x, regardless of the
dimensionality.
- mdownsample(x, n)
- Downsample a multidimensional array x by a factor n[i] in
direction i. Uses downsample.
- mfold(k, n)
- Calculates the real index corresponding to k mirrored for vector
length n
- mfoldv(k, n)
- As mfold but accepts sequences as k and n
- minelement(x)
- Returns the value of the smallest element of x, regardless of the
dimensionality.
- mupsample(x, n)
- Upsample a multidimensional array x by a factor n[i] in
direction i. Uses upsample.
- plot(*set, **kw)
- Plot function going through points x,y (Numeric arrays or other).
Only y can be given.
Usage: g=plot(y) or g=plot(x,y)
Keyword parameters: title, gnupl, with, xlabel, ylabel, cmd
Returns the Gnuplot handle
- printtofile(img, filename, size=None, scale='auto', resample=0)
- Save to a file a 2D array img, possibly scaled to 'size'
which should be a tuple (xsize,ysize). The filename should
already contain the extension. If no scaling is used (scale=None),
the range is 0..255
If img is 3D the first coordinate is assumed to be the color index,
i.e. img[0] is red, img[1] green, and img[2] is blue
resample defines the interpolation method, it can be NEAREST, BILINEAR,
or BICUBIC, see Image.py
- prodall(x)
- Returns the product of all the elements of x, regardless of the
dimensionality.
- product = reduce(...)
- rangeisempty(r)
- Given a range r, return true if it is empty
- rangesintersect(r, s)
- Given two ranges r,s
in the form (array(l1,l2,l3,...),array(h1,h2,h3,...)),
return their intersection
- rangetoslice(r)
- Given the range as returned by the splinerange
in the form (array(l1,l2,l3,...),array(h1,h2,h3,...)),
return a list of slice objects to be used for slicing
- repeat(...)
- repeat(a, n, axis=0)
- reshape(...)
- reshape(a, (d1, d2, ..., dn)). Change the shape of a to be an n-dimensional array with dimensions given by d1...dn. One dimension is allowed to be None. This dimension will be set to whatever value will make the size of the new array equal the size of the old one. Note: the size specified for the new array must be exactly equal to the size of the old one or an error will occur. This returns a completely new array with the data of the old one copied. Use a.shape=(...) for no data copying.
- save_ppm(ppm, fname=None)
- # --------------------------------------------------------------------
- searchsorted = binarysearch(...)
- binarysearch(a,v)
- showContours(img, cont, size=None, scale='auto', title='showDif')
- Shows superposed contours cont in red over an image img in gray.
The two images must be of the same size.
Contours are plotted if bigger than 0.
Returns an image suitable for bigtools.view.
- showDif(img1, img2, size=None)
- Shows a difference between two images. The two images must be
of the same size. Currently we put one in red and the other one in the
green channels. Returns an image suitable for bigtools.view.
- showImgWithLandmarks(img, lnd, size=None, scale='auto', title='Landmarks', lndsize=2)
- Returns an image suitable for bigtools.view
with superimposed landmarks in red.
WARNING: We do not check if the landmarks are too close to borders.
- sometrue = reduce(...)
- sum = reduce(...)
- sumall(x)
- Returns the sum of all the elements of x, regardless of the
dimensionality.
- sumforalldims(x, oper)
- Call operation on all transposes of x
and return the sum of the results
- sumforallrows(x, oper)
- Call oper on all rows (including higher dimensions) of x
and return the sum of the results
- superdiagonal(x)
- returns a superdiagonal of a matrix x, i.e. another matrix
y(i)=x(i,i), where i can be a vector index
- take(...)
- take(a, indices, axis=0). Selects the elements in indices from array a along the given axis.
- tensorprod(v)
- Calculates a tensor product of all elements of v, v is a list
of vectors
- test_ClassBag()
- test_CombinedBase()
- test_Parameters()
- timeop(oper, comm='Operation')
- try_tensor()
- upsample(x, n)
- Upsample 1D array x by a factor of n, starting at the first
element and filling gaps with zero. Returns a vector of length
len(x)*n
- vectorsumforalldims(x, oper)
- Call operation (vector->vector) on all rows of all transposes of x
and return the sum of the results
- view(img, size=None, scale='auto', title='view', resample=0)
- View a 2D array img as image, possibly scaled to 'size'
which should be a tuple (xsize,ysize). If no scaling is used (scale=None),
the range is 0..255
If img is 3D the first coordinate is assumed to be the color index,
i.e. img[0] is red, img[1] green, and img[2] is blue
It returns a handle to a ViewWindow object. When it is destroyed, the
window disappears.
resample defines the interpolation method, it can be NEAREST, BILINEAR,
or BICUBIC, see Image.py
- viewimg(img, title='view')
- View a PIL image object img. It
returns a handle to a ViewWindow object. When it is destroyed, the
window disappears.
- zeros(...)
- zeros((d1,...,dn),typecode,savespace) will return a new array of shape (d1,...,dn) and type typecode (default 'l') with all it's entries initialized to zero. If savespace (default 0) is nonzero the array will be a spacesaver array.
|