Package mvpa :: Package datasets :: Module event :: Class EventDataset
[hide private]
[frames] | no frames]

Class EventDataset

source code


Event-based dataset

This dataset type can be used to segment 'raw' data input into meaningful
boxcar-shaped samples, by simply defining a list of events
(see :class:`~mvpa.misc.support.Event`).

Additionally, it can be used to add arbitrary information (as features)
to each event-sample (extracted from the event list itself). An
appropriate mapper is automatically constructed, that merges original
samples and additional features into a common feature space and also
separates them again during reverse-mapping. Otherwise, this dataset type
is a regular dataset (in contrast to `MetaDataset`).

The properties of an :class:`~mvpa.misc.support.Event` supported/required
by this class are:

`onset`
  An integer indicating the startpoint of an event as the sample
  index in the input data.

`duration`
  How many input data samples following the onset sample should be
  considered for an event. The embedded
  :class:`~mvpa.mappers.boxcar.BoxcarMapper` will use the maximum boxlength
  (i.e., `duration`) of all defined events to create a regular-shaped data
  array.

`label`
  The corresponding label of that event (numeric or literal).

`chunk`
  An optional chunk id.

`features`
  A list with an arbitrary number of features values (floats), that will
  be added to the feature vector of the corresponding sample.

Instance Methods [hide private]
 
__init__(self, samples=None, events=None, mask=None, bcshape=None, dametric=None, **kwargs)
If samples and mapper arguments are not None the mapper is used to forward-map the samples array and the result is passed to the Dataset constructor.
source code

Inherited from mapped.MappedDataset: mapForward, mapReverse, mapSelfReverse, selectFeatures

Class Variables [hide private]

Inherited from mapped.MappedDataset: O, __doc__, mapper, samples_original

Method Details [hide private]

__init__(self, samples=None, events=None, mask=None, bcshape=None, dametric=None, **kwargs)
(Constructor)

source code 
If samples and mapper arguments are not None the mapper is used to forward-map the samples array and the result is passed to the Dataset constructor.
Overrides: mapped.MappedDataset.__init__

Parameters:

samples: ndarray
'Raw' input data from which boxcar-shaped samples will be extracted.
events: sequence of Event instances
Both an events onset and duration are assumed to be provided as #samples. The boxlength will be determined by the maximum duration of all events.
mask: boolean array
Only features corresponding to non-zero mask elements will be considered for the final dataset. The mask shape either has to match the shape of the generated boxcar-samples, or the shape of the 'raw' input samples. In the latter case, the mask is automatically expanded to cover the whole boxcar. If no mask is provided, a full mask will be constructed automatically.
bcshape: tuple
Shape of the boxcar samples generated by the embedded boxcar mapper. If not provided this is determined automatically. However, this required an extra mapping step.
dametric: Metric
Custom metric to be used by the embedded DenseArrayMapper.
**kwargs
All additional arguments are passed to the base class.