Package topo :: Package base :: Module arrayutil
[hide private]
[frames] | no frames]

Module arrayutil

source code

General utility functions and classes for Topographica that require numpy.

$Id: arrayutil.py 11290 2010-07-27 13:42:46Z ceball $


Version: $Revision: 11290 $

Classes [hide private]
  DivideWithConstant
Divide two scalars or arrays with a constant (c) offset on the denominator to allow setting the gain or to avoid divide-by-zero issues.
Functions [hide private]
 
ufunc_script_repr(f, imports, prefix=None, settings=None)
Return a runnable representation of the numpy ufunc f, and an import statement for its module.
source code
 
L2norm(v)
Return the L2 norm of the vector v.
source code
 
norm(v, p=2)
Returns the Lp norm of v, where p is arbitrary and defaults to 2.
source code
 
divisive_normalization(weights)
Divisively normalize an array to sum to 1.0
source code
 
add_border(matrix, width=1, value=0.0)
Returns a new matrix consisting of the given matrix with a border or margin of the given width filled with the given value.
source code
 
arg(z)
Return the complex argument (phase) of z.
source code
 
octave_str(mat, name='mat', owner='')
Print the given Numpy matrix in Octave format, listing the given matrix name and the object that owns it (if any).
source code
 
octave_output(filename, mat, name='mat', owner='')
Writes the given matrix to a new file of the given name, in Octave format.
source code
 
centroid(array_2D)
Return the centroid (center of gravity) for a 2D array.
source code
 
clip_lower(arr, lower_bound)
In-place, one-sided version of numpy.clip().
source code
 
clip_upper(arr, upper_bound)
In-place, one-sided version of numpy.clip().
source code
 
wrap(lower, upper, x)
Circularly alias the numeric value x into the range [lower,upper).
source code
 
array_argmax(arr)
Returns the coordinates of the maximum element in the given array.
source code
Variables [hide private]
  __package__ = 'topo.base'
Function Details [hide private]

arg(z)

source code 
Return the complex argument (phase) of z. (z in radians.)

clip_lower(arr, lower_bound)

source code 

In-place, one-sided version of numpy.clip().

i.e. numpy.clip(arr,a_min=lower_bound,out=arr) if it existed.

clip_upper(arr, upper_bound)

source code 

In-place, one-sided version of numpy.clip().

i.e. numpy.clip(arr,a_max=upper_bound,out=arr) if it existed.

wrap(lower, upper, x)

source code 

Circularly alias the numeric value x into the range [lower,upper).

Valid for cyclic quantities like orientations or hues.