Home | Trees | Indices | Help |
|
---|
|
An *abstract* base class that lays out the basic interface for collections of dictionary-like objects. To the outside, it behaves like a list, albeit one with a second dimension addressed by 'keys'. You could think of BisList as a kind of two-dimensional array or a dictionary of lists. However, no assumptions are yet made as to the internal data structure. BisList provides uniform methods for sorting, filtering, extraction and combination of sub-lists (take, compress), and plotting. Classes derived from BisList have to override several methods to be functional (a NotImplementedError is raised otherwise): * getValue, extend, append, take, keys, * __len__, __setitem__, __getslice__ The latter 3 are not yet defined in BisList (no NotImplementedError) but are nevertheless required. They can also be provided from the python built-in list type via multiple inheritence (see L{Biskit.DictList}, for an example). That means there are two ways of implementing BisList. 1. via multiple inheritence from BisList (first!) and list -> only L{getValue}, L{extend}, L{append} and L{take} need to be overriden. 2. inheritence from BisList only -> the __xxx__ methods have to be implemented, too. See L{DictList} for an example of strategy 1.
|
|||
|
__init__(self) Override but call. |
||
str
|
version(self) Returns CVS version of this class (see also attribute initVersion) |
||
any
|
getValue(self,
i,
key,
default=None) Get the value of a dictionary entry of a list item. |
||
any
|
__add__(c,
other) c + other |
||
any
|
__iadd__(c,
other) c += other |
||
|
extend(self,
other) Add all items of other to (the end of) this instance. |
||
|
append(self,
v) Append a single item to the end of this list. |
||
[ any ]
|
keys(self) Returns attribute keys used by the current items. |
||
[ int ]
|
argsort(self,
sortKey,
cmpfunc=cmp) Sort by values of a certain item attribute. |
||
instance
|
take(self,
indices,
deepcopy=0) Extract certain items in a certain order. |
||
instance
|
compress(self,
mask,
deepcopy=0) Extract certain items. |
||
instance
|
sortBy(self,
sortKey,
cmpfunc=cmp) Use: |
||
list
|
valuesOf(self,
key,
default=None,
indices=None,
unique=0) Get all values assigned to a certain key of all or some items. |
||
array
|
filterRange(self,
key,
vLow,
vHigh) Get indices of items where vLow <= item[ key ] <= vHigh. |
||
array
|
filterEqual(self,
key,
lst) Get indices of items for which item[ key ] in lst. |
||
array
|
filterFunct(self,
f) Get indices of items for which f( item ) == 1. |
||
instance
|
filter(self,
key,
cond) Extract items matching condition. |
||
int
|
argmax(self,
key) Returns index of item with highest item[key] value |
||
float
|
max(self,
key) Returns item with highest item[key] value |
||
int
|
argmin(self,
key) Returns index of item with lowest item[infokey] value |
||
float
|
min(self,
key) Returns item with lowest item[key] value |
||
int
|
getIndex(self,
key,
value) Returns position of item for which item[key] == value |
||
any
|
getItem(self,
key,
value) Returns item for which item[key] == value |
||
dict
|
toDict(self,
key) Convert collection into dict indexed by the value of a certain item attribute. |
||
[ item ]
|
toList(self) Returns simple python list of items |
||
(l1, l2)
|
__maskNone(self,
l1,
l2) Take out positions from l1 and l2 that are None in either of them. |
||
Biggles.FramedPlot
|
plot(self,
xkey,
*ykey,
**arg) Plot pairs of item values. |
||
Biggles.FramedArray
|
plotArray(self,
xkey,
*ykey,
**arg) Plot pairs of item values. |
|
Override but call. |
|
Get the value of a dictionary entry of a list item. Override!
|
c + other
|
c += other
|
Add all items of other to (the end of) this instance. Override!
|
Append a single item to the end of this list. Override!
|
|
Sort by values of a certain item attribute.
|
Extract certain items in a certain order. Override!
|
Extract certain items.
|
Use: sortBy( sortKey ) -> new instance sorted by item[ sortKey ]
|
Get all values assigned to a certain key of all or some items. If unique==0, the result is guaranteed to have the same length as the collection (or the list of given indices). Missing values are replaced by default (None).
|
Get indices of items where vLow <= item[ key ] <= vHigh.
|
Get indices of items for which item[ key ] in lst.
|
Get indices of items for which f( item ) == 1.
|
Extract items matching condition.
|
|
|
|
|
|
|
Convert collection into dict indexed by the value of a certain item attribute. If several items have the same value, the result will have a list registered for this key. EXAMPLE: lst.toDict('soln')
{soln1:Item, soln3:Item, solnN:Item}
|
|
Take out positions from l1 and l2 that are None in either of them.
|
Plot pairs of item values. The additional arg arguments are handed over to biggles.Points(). The special xkey value 'index' uses the position of each item as x-axis. If only one key is given, it is taken as ykey and the x-axis is the index of each item (xkey='index'). EXAMPLE: plot( xkey, [ykey1, ykey2..],[arg1=x, arg2=y])
-> biggles.FramedPlot
|
Plot pairs of item values. EXAMPLE: plot( xkey, [ykey1, ykey2..],[arg1=x, arg2=y])
-> biggles.FramedPlot
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0alpha3 on Tue May 1 22:34:51 2007 | http://epydoc.sourceforge.net |