Utils

Channels

brainda.utils.channels.pick_channels(ch_names: List[str], pick_chs: List[str], ordered: bool = True, match_case: str = 'auto') List[int]

Wrapper of mne.pick_channels with match_case option.

Parameters
  • ch_names (List[str]) – all channel names

  • pick_chs (List[str]) – channel names to pick

  • ordered (bool, optional) – if Ture, return picked channels in pick_chs order, by default True

  • match_case (str, optional) – if True, pick channels in strict mode, by default ‘auto’

Returns

indices of picked channels

Return type

List[int]

brainda.utils.channels.upper_ch_names(raw: mne.io.fiff.raw.Raw) mne.io.fiff.raw.Raw

Uppercase all channel names in MNE Raw object.

Parameters

raw (Raw) – MNE Raw object.

Returns

MNE Raw object.

Return type

Raw

Download

brainda.utils.download.mne_data_path(url: str, sign: str, path: Optional[Union[str, pathlib.Path]] = None, proxies: Optional[Dict[str, str]] = None, force_update: bool = False, update_path: bool = True, verbose: Optional[Union[bool, str, int]] = None, **kwargs) str

Get the local path of the target file.

This function returns the local path of the target file, downloading it if needed or requested. The local path keeps the same structure as the url.

Parameters
  • url (str) – url of the target file.

  • sign (str) – the unique identifier to which the file belongs

  • path (Union[str, Path], optional) – local folder to save the file, by default None

  • proxies (Optional[Dict[str, str]], optional) – use proxies to download files, e.g. {‘https’: ‘socks5://127.0.0.1:1080’}, by default None

  • force_update (bool, optional) – whether to re-download the file, by default False

  • update_path (bool, optional) – whether to update mne config, by default True

  • verbose (Optional[Union[bool, str, int]], optional) – [description], by default None

Returns

local path of the target file

Return type

str

IO

brainda.utils.io.loadmat(mat_file: Union[str, pathlib.Path]) dict

Wrapper of scipy.io loadmat function, works for matv7.3.

Parameters

mat_file (Union[str, Path]) – file path

Returns

data

Return type

dict