MCPcopy
hub / github.com/mne-tools/mne-python / _clean_names

Function _clean_names

mne/utils/misc.py:264–292  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

262
263
264def _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
295def _get_argvalues():

Callers 13

test_clean_namesFunction · 0.90
test_rawctf_clean_namesFunction · 0.90
compute_fine_calibrationFunction · 0.85
_prep_fine_calFunction · 0.85
_read_cross_talkFunction · 0.85
_read_bad_chansFunction · 0.85
_clean_names_instFunction · 0.85
find_layoutFunction · 0.85
_iter_topographyFunction · 0.85
_plot_evoked_topoFunction · 0.85
_prepare_topomap_plotFunction · 0.85
_plot_projs_topomapFunction · 0.85

Calls 3

setFunction · 0.85
splitMethod · 0.80
appendMethod · 0.45

Tested by 2

test_clean_namesFunction · 0.72
test_rawctf_clean_namesFunction · 0.72