ica_command¶
ica_command rejects independent components of the ICA currently loaded in AnyWave, or restores them. It does what you
do by hand when you reject components in the ICA panel: AnyWave marks the components as rejected and rebuilds the
signals.
aw.ica_command(cfg)
Note
The function is called ica_command in Python. In MATLAB the command is called ica.
cfg is a dict:
| key | content | required |
|---|---|---|
'labels' |
list of the labels of the components | yes |
'command' |
'reject' (default) or 'undo' |
no |
The labels of the components start with the modality: E_IC1, E_IC2... for EEG, S_IC1... for sEEG, M_IC1... for
MEG and EMG_IC1... for EMG. The numbering starts at 1.
Examples¶
Reject components 10 and 15 of a MEG ICA:
import sys
import anywave as aw
aw.init(sys.argv)
aw.ica_command({'labels': ['M_IC10', 'M_IC15'], 'command': 'reject'}) # 'reject' is the default
Restore them:
aw.ica_command({'labels': ['M_IC10', 'M_IC15'], 'command': 'undo'})
Build the list of labels in your code:
rejected = [1, 4, 7] # numbers of the components
aw.ica_command({'labels': ['E_IC%d' % k for k in rejected]})
Good to know¶
- An ICA must be loaded in AnyWave. Without an ICA nothing happens.
- The function does not wait for an answer: the request is sent, and AnyWave rebuilds the signals.