本文整理汇总了Python中mne.set_log_level方法的典型用法代码示例。如果您正苦于以下问题:Python mne.set_log_level方法的具体用法?Python mne.set_log_level怎么用?Python mne.set_log_level使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne
的用法示例。
在下文中一共展示了mne.set_log_level方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: interpolate_bads
# 需要导入模块: import mne [as 别名]
# 或者: from mne import set_log_level [as 别名]
def interpolate_bads(inst, picks, dots=None, reset_bads=True, mode='accurate'):
"""Interpolate bad MEG and EEG channels."""
import mne
# to prevent cobyla printf error
# XXX putting to critical for now unless better solution
# emerges
verbose = mne.set_log_level('CRITICAL', return_old_level=True)
eeg_picks = set(pick_types(inst.info, meg=False, eeg=True, exclude=[]))
eeg_picks_interp = [p for p in picks if p in eeg_picks]
if len(eeg_picks_interp) > 0:
_interpolate_bads_eeg(inst, picks=eeg_picks_interp)
meg_picks = set(pick_types(inst.info, meg=True, eeg=False, exclude=[]))
meg_picks_interp = [p for p in picks if p in meg_picks]
if len(meg_picks_interp) > 0:
_interpolate_bads_meg_fast(inst, picks=meg_picks_interp,
dots=dots, mode=mode)
if reset_bads is True:
inst.info['bads'] = []
mne.set_log_level(verbose)
return inst
示例2: _fast_map_meg_channels
# 需要导入模块: import mne [as 别名]
# 或者: from mne import set_log_level [as 别名]
def _fast_map_meg_channels(info, pick_from, pick_to,
dots=None, mode='fast'):
from mne.io.pick import pick_info
from mne.forward._field_interpolation import _setup_dots
from mne.forward._field_interpolation import _compute_mapping_matrix
from mne.forward._make_forward import _create_meg_coils, _read_coil_defs
from mne.bem import _check_origin
miss = 1e-4 # Smoothing criterion for MEG
# XXX: hack to silence _compute_mapping_matrix
verbose = mne.get_config('MNE_LOGGING_LEVEL', 'INFO')
mne.set_log_level('WARNING')
info_from = pick_info(info, pick_from, copy=True)
templates = _read_coil_defs()
coils_from = _create_meg_coils(info_from['chs'], 'normal',
info_from['dev_head_t'], templates)
my_origin = _check_origin((0., 0., 0.04), info_from)
int_rad, noise, lut_fun, n_fact = _setup_dots(mode, coils_from, 'meg')
# This function needs a clean input. It hates the presence of other
# channels than MEG channels. Make sure all is picked.
if dots is None:
dots = self_dots, cross_dots = _compute_dots(info, mode=mode)
else:
self_dots, cross_dots = dots
self_dots, cross_dots = _pick_dots(dots, pick_from, pick_to)
ch_names = [c['ch_name'] for c in info_from['chs']]
fmd = dict(kind='meg', ch_names=ch_names,
origin=my_origin, noise=noise, self_dots=self_dots,
surface_dots=cross_dots, int_rad=int_rad, miss=miss)
fmd['data'] = _compute_mapping_matrix(fmd, info_from)
mne.set_log_level(verbose)
return fmd['data']
示例3: raw
# 需要导入模块: import mne [as 别名]
# 或者: from mne import set_log_level [as 别名]
def raw():
"""Fixture for physionet EEG subject 4, dataset 1."""
mne.set_log_level("WARNING")
# load in subject 1, run 1 dataset
edf_fpath = eegbci.load_data(4, 1, update_path=True)[0]
# using sample EEG data (https://physionet.org/content/eegmmidb/1.0.0/)
raw = mne.io.read_raw_edf(edf_fpath, preload=True)
# The eegbci data has non-standard channel names. We need to rename them:
eegbci.standardize(raw)
return raw
示例4: load_data
# 需要导入模块: import mne [as 别名]
# 或者: from mne import set_log_level [as 别名]
def load_data(n_trials=10, data_type='rest', sfreq=150, epoch=None,
filter_params=[5., None], equalize="zeropad", n_jobs=1,
random_state=None):
"""Load and prepare the HCP dataset for multiCSC
Parameters
----------
n_trials : int
Number of recordings that are loaded.
data_type : str
Type of recordings loaded. Should be in {'rest', 'task_working_memory',
'task_motor', 'task_story_math', 'noise_empty_room', 'noise_subject'}.
sfreq : float
Sampling frequency of the signal. The data are resampled to match it.
epoch : tuple or None
If set to a tuple, extract epochs from the raw data, using
t_min=epoch[0] and t_max=epoch[1]. Else, use the raw signal, divided
in n_splits chunks.
filter_params : tuple
Frequency cut for a band pass filter applied to the signals. The
default is a high-pass filter with frequency cut at 2Hz.
n_jobs : int
Number of jobs that can be used for preparing (filtering) the data.
random_state : int | None
State to seed the random number generator.
Return
------
X : ndarray, shape (n_trials, n_channels, n_times)
Signals loaded from HCP.
info : list of mne.Info
List of the info related to each signals.
"""
if data_type == "rest" and epoch is not None:
raise ValueError("epoch != None is not valid with resting-state data.")
rng = check_random_state(random_state)
mne.set_log_level(30)
db = get_all_records()
records = [(subject, run_index)
for subject, runs in db[data_type].items()
for run_index in runs]
X, info = [], []
records = rng.permutation(records)[:n_trials]
for i, (subject, run_index) in enumerate(records):
print("\rLoading HCP subjects: {:7.2%}".format(i / n_trials),
end='', flush=True)
X_n, info_n = load_one_record(
data_type, subject, int(run_index), sfreq=sfreq, epoch=epoch,
filter_params=filter_params, n_jobs=n_jobs)
X += [X_n]
info += [info_n]
print("\rLoading HCP subjects: done ")
X = make_array(X, equalize=equalize)
X /= np.std(X)
return X, info
示例5: data_generator
# 需要导入模块: import mne [as 别名]
# 或者: from mne import set_log_level [as 别名]
def data_generator(n_trials=10, data_type='rest', sfreq=150, epoch=None,
filter_params=[5., None], equalize="zeropad", n_jobs=1,
random_state=None):
"""Generator loading subjects from the HCP dataset for multiCSC
Parameters
----------
n_trials : int
Number of recordings that are loaded.
data_type : str
Type of recordings loaded. Should be in {'rest', 'task_working_memory',
'task_motor', 'task_story_math', 'noise_empty_room', 'noise_subject'}.
sfreq : float
Sampling frequency of the signal. The data are resampled to match it.
epoch : tuple or None
If set to a tuple, extract epochs from the raw data, using
t_min=epoch[0] and t_max=epoch[1]. Else, use the raw signal, divided
in n_splits chunks.
filter_params : tuple
Frequency cut for a band pass filter applied to the signals. The
default is a high-pass filter with frequency cut at 2Hz.
n_jobs : int
Number of jobs that can be used for preparing (filtering) the data.
random_state : int | None
State to seed the random number generator.
Yields
------
X : ndarray, shape (1, n_channels, n_times)
Signals loaded from HCP.
info : list of mne.Info
info related to this signal.
"""
if data_type == "rest" and epoch is not None:
raise ValueError("epoch != None is not valid with resting-state data.")
rng = check_random_state(random_state)
mne.set_log_level(30)
db = get_all_records()
records = [(subject, run_index)
for subject, runs in db[data_type].items()
for run_index in runs]
records = rng.permutation(records)[:n_trials]
for i, (subject, run_index) in enumerate(records):
try:
X_n, info_n = load_one_record(
data_type, subject, int(run_index), sfreq=sfreq, epoch=epoch,
filter_params=filter_params, n_jobs=n_jobs)
X_n /= X_n.std()
yield X_n, info_n
except UnicodeDecodeError:
print("failed to load {}-{}-{}"
.format(subject, data_type, run_index))