Functions | Variables
wiimote::pstat Namespace Reference

Functions

def abut
 =========================== LIST FUNCTIONS ==========================
def colex
def collapse
def dm
def duplicates
def flat
def linedelimited
def lineincols
def lineincustcols
def linexand
def linexor
def list2string
def makelol
def makestr
def nonrepeats
def pl
def printcc
def printincols
def printl
def recode
def remap
def replace
def roundlist
def simpleabut
def sortby
def unique

Variables

float __version__ = 0.4

Function Documentation

def wiimote.pstat.abut (   source,
  args 
)

=========================== LIST FUNCTIONS ==========================

Here are the list functions, DEFINED FOR ALL SYSTEMS. Array functions (for NumPy-enabled computers) appear below.

Like the |Stat abut command.  It concatenates two lists side-by-side
and returns the result.  '2D' lists are also accomodated for either argument
(source or addon).  CAUTION:  If one list is shorter, it will be repeated
until it is as long as the longest list.  If this behavior is not desired,
use pstat.simpleabut().

Usage:   abut(source, args)   where args=any # of lists
Returns: a list of lists as long as the LONGEST list past, source on the
     'left', lists in <args> attached consecutively on the 'right'

Definition at line 120 of file pstat.py.

def wiimote.pstat.colex (   listoflists,
  cnums 
)
Extracts from listoflists the columns specified in the list 'cnums'
(cnums can be an integer, a sequence of integers, or a string-expression that
corresponds to a slice operation on the variable x ... e.g., 'x[3:]' will colex
columns 3 onward from the listoflists).

Usage:   colex (listoflists,cnums)
Returns: a list-of-lists corresponding to the columns from listoflists
     specified by cnums, in the order the column numbers appear in cnums

Definition at line 203 of file pstat.py.

def wiimote.pstat.collapse (   listoflists,
  keepcols,
  collapsecols,
  fcn1 = None,
  fcn2 = None,
  cfcn = None 
)
Averages data in collapsecol, keeping all unique items in keepcols
(using unique, which keeps unique LISTS of column numbers), retaining the
unique sets of values in keepcols, the mean for each.  Setting fcn1
and/or fcn2 to point to a function rather than None (e.g., stats.sterr, len)
will append those results (e.g., the sterr, N) after each calculated mean.
cfcn is the collapse function to apply (defaults to mean, defined here in the
pstat module to avoid circular imports with stats.py, but harmonicmean or
others could be passed).

Usage:    collapse (listoflists,keepcols,collapsecols,fcn1=None,fcn2=None,cfcn=None)
Returns: a list of lists with all unique permutations of entries appearing in
columns ("conditions") specified by keepcols, abutted with the result of
cfcn (if cfcn=None, defaults to the mean) of each column specified by
collapsecols.

Definition at line 231 of file pstat.py.

def wiimote.pstat.dm (   listoflists,
  criterion 
)
Returns rows from the passed list of lists that meet the criteria in
the passed criterion expression (a string as a function of x; e.g., 'x[3]>=9'
will return all rows where the 4th column>=9 and "x[2]=='N'" will return rows
with column 2 equal to the string 'N').

Usage:   dm (listoflists, criterion)
Returns: rows from listoflists that meet the specified criterion.

Definition at line 309 of file pstat.py.

def wiimote.pstat.duplicates (   inlist)
Returns duplicate items in the FIRST dimension of the passed list.

Usage:   duplicates (inlist)

Definition at line 674 of file pstat.py.

def wiimote.pstat.flat (   l)
Returns the flattened version of a '2D' list.  List-correlate to the a.ravel()()
method of NumPy arrays.

Usage:    flat(l)

Definition at line 324 of file pstat.py.

def wiimote.pstat.linedelimited (   inlist,
  delimiter 
)
Returns a string composed of elements in inlist, with each element
separated by 'delimiter.'  Used by function writedelimited.  Use '\t'
for tab-delimiting.

Usage:   linedelimited (inlist,delimiter)

Definition at line 394 of file pstat.py.

def wiimote.pstat.lineincols (   inlist,
  colsize 
)
Returns a string composed of elements in inlist, with each element
right-aligned in columns of (fixed) colsize.

Usage:   lineincols (inlist,colsize)   where colsize is an integer

Definition at line 411 of file pstat.py.

def wiimote.pstat.lineincustcols (   inlist,
  colsizes 
)
Returns a string composed of elements in inlist, with each element
right-aligned in a column of width specified by a sequence colsizes.  The
length of colsizes must be greater than or equal to the number of columns
in inlist.

Usage:   lineincustcols (inlist,colsizes)
Returns: formatted string created from inlist

Definition at line 432 of file pstat.py.

def wiimote.pstat.linexand (   listoflists,
  columnlist,
  valuelist 
)
Returns the rows of a list of lists where col (from columnlist) = val
(from valuelist) for EVERY pair of values (columnlist[i],valuelists[i]).
len(columnlist) must equal len(valuelist).

Usage:   linexand (listoflists,columnlist,valuelist)
Returns: the rows of listoflists where columnlist[i]=valuelist[i] for ALL i

Definition at line 338 of file pstat.py.

def wiimote.pstat.linexor (   listoflists,
  columnlist,
  valuelist 
)
Returns the rows of a list of lists where col (from columnlist) = val
(from valuelist) for ANY pair of values (colunmlist[i],valuelist[i[).
One value is required for each column in columnlist.  If only one value
exists for columnlist but multiple values appear in valuelist, the
valuelist values are all assumed to pertain to the same column.

Usage:   linexor (listoflists,columnlist,valuelist)
Returns: the rows of listoflists where columnlist[i]=valuelist[i] for ANY i

Definition at line 364 of file pstat.py.

def wiimote.pstat.list2string (   inlist,
  delimit = ' ' 
)
Converts a 1D list to a single long string for file output, using
the string.join function.

Usage:   list2string (inlist,delimit=' ')
Returns: the string created from inlist

Definition at line 458 of file pstat.py.

def wiimote.pstat.makelol (   inlist)
Converts a 1D list to a 2D list (i.e., a list-of-lists).  Useful when you
want to use put() to write a 1D list one item per line in the file.

Usage:   makelol(inlist)
Returns: if l = [1,2,'hi'] then returns [[1],[2],['hi']] etc.

Definition at line 470 of file pstat.py.

def wiimote.pstat.makestr (   x)

Definition at line 484 of file pstat.py.

def wiimote.pstat.nonrepeats (   inlist)
Returns items that are NOT duplicated in the first dim of the passed list.

Usage:   nonrepeats (inlist)

Definition at line 687 of file pstat.py.

def wiimote.pstat.pl (   listoflists)
Prints a list of lists, 1 list (row) at a time.

Usage:   pl(listoflists)
Returns: None

Definition at line 541 of file pstat.py.

def wiimote.pstat.printcc (   lst,
  extra = 2 
)
Prints a list of lists in columns, customized by the max size of items
within the columns (max size of items in col, plus 'extra' number of spaces).
Use 'dashes' or '\\n' in the list-of-lists to print dashes or blank lines,
respectively.

Usage:   printcc (lst,extra=2)
Returns: None

Definition at line 490 of file pstat.py.

def wiimote.pstat.printincols (   listoflists,
  colsize 
)
Prints a list of lists in columns of (fixed) colsize width, where
colsize is an integer.

Usage:   printincols (listoflists,colsize)
Returns: None

Definition at line 528 of file pstat.py.

def wiimote.pstat.printl (   listoflists)
Alias for pl.

Definition at line 556 of file pstat.py.

def wiimote.pstat.recode (   inlist,
  listmap,
  cols = None 
)
Changes the values in a list to a new set of values (useful when
you need to recode data from (e.g.) strings to numbers.  cols defaults
to None (meaning all columns are recoded).

Usage:   recode (inlist,listmap,cols=None)  cols=recode cols, listmap=2D list
Returns: inlist with the appropriate values replaced with new ones

Definition at line 577 of file pstat.py.

def wiimote.pstat.remap (   listoflists,
  criterion 
)
Remaps values in a given column of a 2D list (listoflists).  This requires
a criterion as a function of 'x' so that the result of the following is
returned ... map(lambda x: 'criterion',listoflists).  

Usage:   remap(listoflists,criterion)    criterion=string
Returns: remapped version of listoflists

Definition at line 608 of file pstat.py.

def wiimote.pstat.replace (   inlst,
  oldval,
  newval 
)
Replaces all occurrences of 'oldval' with 'newval', recursively.

Usage:   replace (inlst,oldval,newval)

Definition at line 562 of file pstat.py.

def wiimote.pstat.roundlist (   inlist,
  digits 
)
Goes through each element in a 1D or 2D inlist, and applies the following
function to all elements of FloatType ... round(element,digits).

Usage:   roundlist(inlist,digits)
Returns: list with rounded floats

Definition at line 622 of file pstat.py.

def wiimote.pstat.simpleabut (   source,
  addon 
)
Concatenates two lists as columns and returns the result.  '2D' lists
are also accomodated for either argument (source or addon).  This DOES NOT
repeat either list to make the 2 lists of equal length.  Beware of list pairs
with different lengths ... the resulting list will be the length of the
FIRST list passed.

Usage:   simpleabut(source,addon)  where source, addon=list (or list-of-lists)
Returns: a list of lists as long as source, with source on the 'left' and
             addon on the 'right'

Definition at line 167 of file pstat.py.

def wiimote.pstat.sortby (   listoflists,
  sortcols 
)
Sorts a list of lists on the column(s) specified in the sequence
sortcols.

Usage:   sortby(listoflists,sortcols)
Returns: sorted list, unchanged column ordering

Definition at line 640 of file pstat.py.

def wiimote.pstat.unique (   inlist)
Returns all unique items in the passed list.  If the a list-of-lists
is passed, unique LISTS are found (i.e., items in the first dimension are
compared).

Usage:   unique (inlist)
Returns: the unique elements (or rows) in inlist

Definition at line 659 of file pstat.py.


Variable Documentation

Definition at line 112 of file pstat.py.



wiimote
Author(s): Andreas Paepcke, Melonee Wise, Mark Horn
autogenerated on Sat Jun 8 2019 20:54:42