Package mvpa :: Package misc :: Module support
[hide private]
[frames] | no frames]

Module support

source code

Support function -- little helpers in everyday life
Classes [hide private]
  MapOverlap
Compute some overlap stats from a sequence of binary maps.
  Event
Simple class to define properties of an event.
  HarvesterCall
  Harvester
World domination helper: do whatever it is asked and accumulate results
Functions [hide private]
 
reuseAbsolutePath(file1, file2, force=False)
Use path to file1 as the path to file2 is no absolute path is given for file2
source code
array (len(startpoints) x data.shape[1:])
transformWithBoxcar(data, startpoints, boxlength, offset=0, fx=N.mean)
This function extracts boxcar windows from an array.
source code
 
getUniqueLengthNCombinations(data, n)
Generates a list of lists containing all combinations of elements of data of length 'n' without repetitions.
source code
 
indentDoc(v)
Given a value returns a string where each line is indented
source code
 
idhash(val)
Craft unique id+hash for an object
source code
 
isSorted(items)
Check if listed items are in sorted order.
source code
 
isInVolume(coord, shape)
For given coord check if it is within a specified volume size.
source code
 
getBreakPoints(items, contiguous=True)
Return a list of break points.
source code
 
RFEHistory2maps(history)
Convert history generated by RFE into the array of binary maps
source code

Imports: N, re, os, copy, deepcopy, isSequenceType, debug


Function Details [hide private]

reuseAbsolutePath(file1, file2, force=False)

source code 
Use path to file1 as the path to file2 is no absolute path is given for file2
Parameters:
  • force (bool) - if True, force it even if the file2 starts with /

transformWithBoxcar(data, startpoints, boxlength, offset=0, fx=N.mean)

source code 
This function extracts boxcar windows from an array. Such a boxcar is defined by a starting point and the size of the window along the first axis of the array (boxlength). Afterwards a customizable function is applied to each boxcar individually (Default: averaging).
Parameters:
  • data (array) - An array with an arbitrary number of dimensions.
  • startpoints (sequence) - Boxcar startpoints as index along the first array axis
  • boxlength (int) - Length of the boxcar window in #array elements
  • offset (int) - Optional offset between the configured starting point and the actual begining of the boxcar window.
Returns: array (len(startpoints) x data.shape[1:])

getUniqueLengthNCombinations(data, n)

source code 

Generates a list of lists containing all combinations of elements of data of length 'n' without repetitions.

data: list n: integer

This function is adapted from a Java version posted in some forum on the web as an answer to the question 'How can I generate all possible combinations of length n?'. Unfortunately I cannot remember which forum it was.

indentDoc(v)

source code 

Given a value returns a string where each line is indented

Needed for a cleaner __repr__ output v - arbitrary

isSorted(items)

source code 
Check if listed items are in sorted order.
Returns:
True if were sorted. Otherwise False + Warning

Parameters: items: iterable container

isInVolume(coord, shape)

source code 

For given coord check if it is within a specified volume size.

Returns True/False. Assumes that volume coordinates start at 0. No more generalization (arbitrary minimal coord) is done to save on performance

getBreakPoints(items, contiguous=True)

source code 
Return a list of break points.
Parameters:
  • items (iterable) - list of items, such as chunks
  • contiguous (bool) - if True (default) then raise Value Error if items are not contiguous, i.e. a label occur in multiple contiguous sets
Returns:
list of indexes for every new set of items

RFEHistory2maps(history)

source code 

Convert history generated by RFE into the array of binary maps

Example:
history2maps(N.array( [ 3,2,1,0 ] ))
results in
array([[ 1., 1., 1., 1.],
[ 1., 1., 1., 0.], [ 1., 1., 0., 0.], [ 1., 0., 0., 0.]])