mvpa2.datasets.eventrelated.find_events¶
-
mvpa2.datasets.eventrelated.
find_events
(**kwargs)¶ Detect changes in multiple synchronous sequences.
Multiple sequence arguments are scanned for changes in the unique value combination at corresponding locations. Each change in the combination is taken as a new event onset. The length of an event is determined by the number of identical consecutive combinations.
Parameters: **kwargs : sequences
Arbitrary number of sequences that shall be scanned.
Returns: list
Detected events, where each event is a dictionary with the unique combination of values stored under their original name. In addition, the dictionary also contains the
onset
of the event (as index in the sequence), as well as theduration
(as number of identical consecutive items).See also
eventrelated_dataset
- event-related segmentation of a dataset
Examples
>>> seq1 = ['one', 'one', 'two', 'two'] >>> seq2 = [1, 1, 1, 2] >>> events = find_events(targets=seq1, chunks=seq2) >>> for e in events: ... print e {'chunks': 1, 'duration': 2, 'onset': 0, 'targets': 'one'} {'chunks': 1, 'duration': 1, 'onset': 2, 'targets': 'two'} {'chunks': 2, 'duration': 1, 'onset': 3, 'targets': 'two'}