Remove white-space on topo matching. This function handles different naming conventions for old VS new VectorView systems (`remove_whitespace`) and removes system specific parts in CTF channel names (`before_dash`). Usage ----- # for new VectorView (only inside layout)
(names, remove_whitespace=False, before_dash=True)
| 262 | |
| 263 | |
| 264 | def _clean_names(names, remove_whitespace=False, before_dash=True): |
| 265 | """Remove white-space on topo matching. |
| 266 | |
| 267 | This function handles different naming conventions for old VS new VectorView systems |
| 268 | (`remove_whitespace`) and removes system specific parts in CTF channel names |
| 269 | (`before_dash`). |
| 270 | |
| 271 | Usage |
| 272 | ----- |
| 273 | # for new VectorView (only inside layout) |
| 274 | ch_names = _clean_names(epochs.ch_names, remove_whitespace=True) |
| 275 | |
| 276 | # for CTF |
| 277 | ch_names = _clean_names(epochs.ch_names, before_dash=True) |
| 278 | """ |
| 279 | cleaned = [] |
| 280 | for name in names: |
| 281 | if " " in name and remove_whitespace: |
| 282 | name = name.replace(" ", "") |
| 283 | if "-" in name and before_dash: |
| 284 | name = name.split("-")[0] |
| 285 | if name.endswith("_v"): |
| 286 | name = name[:-2] |
| 287 | cleaned.append(name) |
| 288 | if len(set(cleaned)) != len(names): |
| 289 | # this was probably not a VectorView or CTF dataset, and we now broke the |
| 290 | # dataset by creating duplicates, so let's use the original channel names. |
| 291 | return names |
| 292 | return cleaned |
| 293 | |
| 294 | |
| 295 | def _get_argvalues(): |