Package mvpa :: Package misc :: Package io :: Module base :: Class SampleAttributes
[hide private]
[frames] | no frames]

Class SampleAttributes

source code


Read and write PyMVPA sample attribute definitions from and to text files.
Instance Methods [hide private]
new empty dictionary

__init__(self, source, literallabels=False, header=None)
Read PyMVPA sample attributes from disk.
source code
 
tofile(self, filename)
Write sample attributes to a text file.
source code
 
getNSamples(self)
Returns the number of samples in the file.
source code
 
toEvents(self, **kwargs)
Convert into a list of Event instances.
source code

Inherited from ColumnData: __iadd__, __str__, getNColumns, getNRows, selectSamples

Inherited from ColumnData (private): _check, _fromFile, _getAttrib

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Class Variables [hide private]
  nsamples = property(fget= getNSamples)

Inherited from ColumnData: __doc__, ncolumns, nrows

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, source, literallabels=False, header=None)
(Constructor)

source code 
Read PyMVPA sample attributes from disk.
Parameters:
  • source, basestring - Filename of an atrribute file
  • literallabels, bool - Either labels are given as literal strings
  • header, None, or, bool, or, list, of, str - If None, ['labels', 'chunks'] is assumed. Otherwise the same behavior as of ColumnData
Returns:
new empty dictionary

Overrides: object.__init__

tofile(self, filename)

source code 
Write sample attributes to a text file.
Parameters:
  • filename - Target filename
  • header - If True a column header is written, using the column keys. If False no header is written.
  • header_order - If it is a list of strings, they will be used instead of simply asking for the dictionary keys. However these strings must match the dictionary keys in number and identity. This argument type can be used to determine the order of the columns in the output file. The default value is None. In this case the columns will be in an arbitrary order.
  • sep - String that is written as a separator between to data columns.
Overrides: ColumnData.tofile

toEvents(self, **kwargs)

source code 

Convert into a list of Event instances.

Each change in the label or chunks value is taken as a new event onset. The length of an event is determined by the number of identical consecutive label-chunk combinations. Since the attributes list has no sense of absolute timing, both onset and duration are determined and stored in #samples units.

Parameters:
  • kwargs - Any keyword arugment provided would be replicated, through all the entries.