Package mvpa :: Package misc :: Module support :: Class Event

[hide private]
[frames] | no frames]

# Class Event

source code

Simple class to define properties of an event.

The class is basically a dictionary. Any properties can be passed as keyword arguments to the constructor, e.g.:

>     >>> ev = Event(onset=12, duration=2.45)

Conventions for keys:

`onset`
  The onset of the event in some unit.
`duration`
  The duration of the event in the same unit as `onset`.
`label`
  E.g. the condition this event is part of.
`chunk`
  Group this event is part of (if any), e.g. experimental run.
`features`
  Any amount of additional features of the event. This might include things like physiological measures, stimulus intensity. Must be a mutable sequence (e.g. list), if present.

Instance Methods | [hide private]

    new empty dictionary

__init__(self, **kwargs) x.__init__(...) initializes x; see help(type(x)) for signature | source code

asDescreteTime(self, dt, storeoffset=False) Convert `onset` and `duration` information into descrete timepoints. | source code

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__`, `__str__`, `__subclasshook__`

Class Variables | [hide private]

| _MUSTHAVE = `['onset']`
Inherited from `dict`: `__hash__`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, **kwargs)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Returns:

    new empty dictionary

Overrides: object.__init__
  (inherited documentation)

### asDescreteTime(self, dt, storeoffset=False)

source code

Convert `onset` and `duration` information into descrete timepoints.

Parameters:
  - `dt`, `float` - Temporal distance between two timepoints in the same unit as `onset` and `duration`.
  - `storeoffset`, `bool` - If True, the temporal offset between original `onset` and descretized `onset` is stored as an additional item in `features`.
Returns:

  A copy of the original Event with `onset` and optionally `duration` replaced by their corresponding descrete timepoint. The new onset will correspond to the timepoint just before or exactly at the original onset. The new duration will be the number of timepoints covering the event from the computed onset timepoint till the timepoint exactly at the end, or just after the event.

  Note again, that the new values are expressed as #timepoint and not in their original unit!