channels#
Module for handling channels.
- utils.channels.get_default_channels_from_data(data: ndarray, car_rereferencing: bool = True)[source]#
Return default channels dataframe with ecog datatype, no bad channels, no targets, common average rereferencing
- Parameters:
data (np.ndarray) – Data array in shape (n_channels, n_time)
car_rereferencing (bool, optional) – use common average rereferencing, by default True
- Returns:
- nm_channel dataframe containing columns:
name
rereference
used
target
type
status
new_name
- Return type:
pd.DataFrame
- utils.channels.set_channels(ch_names: list[str], ch_types: list[str], reference: list | str = 'default', bads: list[str] | None = None, new_names: str | list[str] = 'default', ecog_only: bool = False, used_types: Iterable[str] | None = ('ecog', 'dbs', 'seeg'), target_keywords: Iterable[str] | None = ('mov', 'squared', 'label')) pd.DataFrame [source]#
Return dataframe with channel-specific settings in channels format.
Return an channels dataframe with the columns: “name”, “rereference”, “used”, “target”, “type”, “status”, “new_name”]. “name” is set to ch_names, “rereference” can be specified individually. “used” is set to 1 for all channel types specified in used_types, else to 0. “target” is set to 1 for all channels containing any of the target_keywords, else to 0.
Possible channel types: mne-tools/mne-python
- Parameters:
ch_names (list) – list of channel names.
ch_types (list) – list of channel types. Should optimally be of the types: “ECOG”, “DBS” or “SEEG”.
reference (str | list of str | None, default: 'default') – re-referencing scheme. Default is “default”. This sets ECOG channel references to “average” and creates a bipolar referencing scheme for LFP/DBS/SEEG channels, where each channel is referenced to the adjacent lower channel, split by left and right hemisphere. For this, the channel names must contain the substring “_L_” and/or “_R_” (lower or upper case). CAVE: Adjacent channels will be determined using the sort() function.
bads (str | list of str, default: None) – channels that should be marked as bad and not be used for average re-referencing etc.
new_names (list of str | None, default: 'default') – new channel names that should be used when writing out the features and results. Useful when applying re-referencing. Set to ‘None’ if no renaming should be performed. ‘default’ will infer channel renaming from re-referencing information. If a list is given, it should be in the same order as ‘ch_names’.
ecog_only (boolean, default: False) – if True, set only ‘ecog’ channel type to used
used_types (iterable of str | None, default : ("ecog", "dbs", "seeg")) – data channel types to be used. Set to None to use no channel types.
target_keywords (iterable of str | None, default : ("ecog", "dbs", "seeg")) – keywords for target channels
- Returns:
df
- Return type:
DataFrame in channels format