|
18 | 18 | from .utils._utils import _icalabel_to_data_frame |
19 | 19 |
|
20 | 20 | IC_LABELS = mne_icalabel.config.ICA_LABELS_TO_MNE |
21 | | -CH_LABELS: dict[str, str] = { |
22 | | - "Noisy": "ch_sd", |
23 | | - "Bridged": "bridge", |
24 | | - "Uncorrelated": "low_r", |
25 | | - "Rank": "rank" |
26 | | -} |
27 | | -EPOCH_LABELS: dict[str, str] = { |
28 | | - "Noisy": "noisy", |
29 | | - "Noisy ICs": "noisy_ICs", |
30 | | - "Uncorrelated": "uncorrelated", |
31 | | -} |
| 21 | +CH_LABELS: list = ["noisy", "bridged", "uncorrelated", "rank"] |
| 22 | +EPOCH_LABELS: list = ["noisy", "noisy_ICs", "uncorrelated"] |
32 | 23 |
|
33 | 24 |
|
34 | 25 | class _Flagged(dict): |
35 | 26 |
|
36 | | - def __init__(self, key_map, kind_str, ll, *args, **kwargs): |
| 27 | + def __init__(self, keys, kind_str, ll, *args, **kwargs): |
37 | 28 | """Initialize class.""" |
38 | 29 | super().__init__(*args, **kwargs) |
39 | 30 | self.ll = ll |
40 | | - self._key_map = key_map |
| 31 | + self._keys = keys |
41 | 32 | self._kind_str = kind_str |
42 | 33 |
|
43 | 34 | @property |
44 | 35 | def valid_keys(self): |
45 | 36 | """Return the valid keys.""" |
46 | | - return tuple(self._key_map.values()) |
| 37 | + return tuple(self._keys) |
47 | 38 |
|
48 | 39 | def __repr__(self): |
49 | 40 | """Return a string representation.""" |
50 | 41 | ret_str = f"Flagged {self._kind_str}s: |\n" |
51 | | - for key, val in self._key_map.items(): |
52 | | - ret_str += f" {key}: {self.get(val, None)}\n" |
| 42 | + for key in self._keys: |
| 43 | + ret_str += f" {key.title().replace('_', ' ')}: {self.get(key, None)}\n" |
53 | 44 | return ret_str |
54 | 45 |
|
55 | 46 | def __eq__(self, other): |
@@ -102,8 +93,7 @@ def add_flag_cat(self, kind, bad_ch_names, *args): |
102 | 93 | Parameters |
103 | 94 | ---------- |
104 | 95 | kind : str |
105 | | - Should be one of ``'ch_sd'``, ``'low_r'``, |
106 | | - ``'bridge'``, ``'rank'``. |
| 96 | + Should be one of the values in ``CH_LABELS``. |
107 | 97 | bad_ch_names : list | tuple |
108 | 98 | Channel names. Will be the values corresponding to the ``kind`` |
109 | 99 | dictionary key. |
@@ -220,7 +210,7 @@ def add_flag_cat(self, kind, bad_epoch_inds, epochs): |
220 | 210 | Parameters |
221 | 211 | ---------- |
222 | 212 | kind : str |
223 | | - Should be one of ``'noisy'``, ``'uncorrelated'``, ``'noisy_ICs'``. |
| 213 | + Should be one of the values in ``EPOCH_LABELS``. |
224 | 214 | bad_epochs_inds : list | tuple |
225 | 215 | Indices for the epochs in an :class:`mne.Epochs` object. Will be |
226 | 216 | the values for the ``kind`` dictionary key. |
|
0 commit comments