| Trees | Indices | Help |
|
|---|
|
|
General utility functions and classes.
$Id: util.py 11304 2010-07-27 16:35:22Z ceball $
Version: $Revision: 11304 $
|
|||
|
Struct A simple structure class, taking keyword args and assigning them to attributes. |
|||
|
MultiFile For all file_like_objs passed on initialization, provides a convenient way to call any of file's methods (on all of them). |
|||
| ModuleFaker | |||
| ModuleImporter | |||
| gmpyFaker | |||
| gmpyImporter | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
__package__ =
|
|||
|
|||
Returns a list of the indices needed to address or loop over all the elements of a 1D or 2D matrix with the given shape. E.g.: flat_indices((3,)) == [0,1,2] |
Flattens a list. Written by Bearophile as published on the www.python.org newsgroups. Pulled into Topographica 3/5/2005. |
A range function that accepts float increments. Otherwise, works just as the inbuilt range() function. If inclusive is False, as in the default, the range is exclusive (not including the end value), as in the inbuilt range(). If inclusive is true, the range may include the end value. 'All theoretic restrictions apply, but in practice this is more useful than in theory.' From: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66472 |
Returns the class name of x as a string with the leading package information removed. E.g. if x is of type "<class 'topo.base.sheet.Sheet'>", returns "Sheet" |
Profile the given command (supplied as a string), printing statistics about the top n functions when ordered according to sorting. sorting defaults to ordering by cumulative time and then internal time; see http://docs.python.org/lib/profile-stats.html for other sorting options. By default, the complete paths of files are not shown. If there are multiple files with the same name, you might wish to set strip_dirs=False to make it easier to follow the output. Examples:
profile('execfile("examples/hierarchical.ty")')
profile('topo.sim.run(10)')
profile('execfile("examples/lissom_oo_or.ty");topo.sim.run(20000)')
./topographica examples/hierarchical.ty -c "from topo.misc.util import profile; profile('topo.sim.run(10)')" |
Select randomly from the given sequence. The weights, if given, should be a sequence the same length as seq, as would be passed to weighted_sample_idx(). |
Return an integer generated by sampling the discrete distribution represented by the sequence of weights. The integer will be in the range [0,len(weights)). The weights need not sum to unity, but can contain any non-negative values (e.g., [1 1 1 100] is a valid set of weights). To use weights from a 2D numpy array w, specify w.ravel() (not the w.flat iterator). |
Return the centroid of a weighted set of points as an array. The pts argument should be an array of points, one per row, and weights should be a vector of weights. |
Split x into its sign and absolute value. Returns a tuple (sign(x),abs(x)). Note: sign(0) = 1, unlike numpy.sign. |
Interpolate an appropriate value from the given list of values, by number. Assumes the table is a list of items to be returned for integer values, and interpolates between those items for non-integer values. |
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Thu Aug 5 14:59:19 2010 | http://epydoc.sourceforge.net |