Skip to content

Commit

Permalink
FIX: Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Feb 5, 2016
1 parent 104b824 commit e0cec48
Show file tree
Hide file tree
Showing 58 changed files with 328 additions and 383 deletions.
11 changes: 5 additions & 6 deletions mne/beamformer/_dics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
from scipy import linalg

from ..utils import logger, verbose, _traverse_warn
from ..utils import logger, verbose, warn
from ..forward import _subject_from_forward
from ..minimum_norm.inverse import combine_xyz, _check_reference
from ..source_estimate import _make_stc
Expand Down Expand Up @@ -351,9 +351,9 @@ def csd_shapes(x):
for i in range(len(frequencies) - 1):
fstep.append(frequencies[i + 1] - frequencies[i])
if not np.allclose(fstep, np.mean(fstep), 1e-5):
_traverse_warn('Uneven frequency spacing in CSD object, '
'frequencies in the resulting stc file will be '
'inaccurate.')
warn('Uneven frequency spacing in CSD object, '
'frequencies in the resulting stc file will be '
'inaccurate.')
fstep = fstep[0]
elif len(frequencies) > 1:
fstep = frequencies[1] - frequencies[0]
Expand Down Expand Up @@ -548,8 +548,7 @@ def tf_dics(epochs, forward, noise_csds, tmin, tmax, tstep, win_lengths,
# be calculated for an additional time window
if i_time == n_time_steps - 1 and win_tmax - tstep < tmax and\
win_tmax >= tmax + (epochs.times[-1] - epochs.times[-2]):
_traverse_warn('Adding a time window to cover last time '
'points')
warn('Adding a time window to cover last time points')
win_tmin = tmax - win_length
win_tmax = tmax

Expand Down
5 changes: 2 additions & 3 deletions mne/beamformer/_lcmv.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ..cov import compute_whitener, compute_covariance
from ..source_estimate import _make_stc, SourceEstimate
from ..source_space import label_src_vertno_sel
from ..utils import logger, verbose, _traverse_warn
from ..utils import logger, verbose, warn
from .. import Epochs
from ..externals import six

Expand Down Expand Up @@ -765,8 +765,7 @@ def tf_lcmv(epochs, forward, noise_covs, tmin, tmax, tstep, win_lengths,
# be calculated for an additional time window
if i_time == n_time_steps - 1 and win_tmax - tstep < tmax and\
win_tmax >= tmax + (epochs.times[-1] - epochs.times[-2]):
_traverse_warn('Adding a time window to cover last time '
'points')
warn('Adding a time window to cover last time points')
win_tmin = tmax - win_length
win_tmax = tmax

Expand Down
11 changes: 5 additions & 6 deletions mne/bem.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
from scipy import linalg

from .fixes import partial
from .utils import (verbose, logger, run_subprocess, get_subjects_dir,
_traverse_warn)
from .utils import verbose, logger, run_subprocess, get_subjects_dir, warn
from .transforms import _ensure_trans, apply_trans
from .io.constants import FIFF
from .io.write import (start_file, start_block, write_float, write_int,
Expand Down Expand Up @@ -854,12 +853,12 @@ def fit_sphere_to_headshape(info, dig_kinds=(FIFF.FIFFV_POINT_EXTRA,),
# i.e. 108mm "radius", so let's go with 110mm
# en.wikipedia.org/wiki/Human_head#/media/File:HeadAnthropometry.JPG
if radius > 110.:
_traverse_warn('Estimated head size (%0.1f mm) exceeded 99th '
'percentile for adult head size' % (radius,))
warn('Estimated head size (%0.1f mm) exceeded 99th '
'percentile for adult head size' % (radius,))
# > 2 cm away from head center in X or Y is strange
if np.sqrt(np.sum(origin_head[:2] ** 2)) > 20:
_traverse_warn('(X, Y) fit (%0.1f, %0.1f) more than 20 mm from '
'head frame origin' % tuple(origin_head[:2]))
warn('(X, Y) fit (%0.1f, %0.1f) more than 20 mm from '
'head frame origin' % tuple(origin_head[:2]))
logger.info('Origin head coordinates:'.ljust(30) +
'%0.1f %0.1f %0.1f mm' % tuple(origin_head))
logger.info('Origin device coordinates:'.ljust(30) +
Expand Down
8 changes: 3 additions & 5 deletions mne/channels/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from ..externals.six import string_types

from ..utils import verbose, logger, _traverse_warn
from ..utils import verbose, logger, warn
from ..io.pick import (channel_type, pick_info, pick_types,
_check_excludes_includes)
from ..io.constants import FIFF
Expand Down Expand Up @@ -287,10 +287,8 @@ def set_channel_types(self, mapping):
unit_old = self.info['chs'][c_ind]['unit']
unit_new = _human2unit[ch_type]
if unit_old != _human2unit[ch_type]:
_traverse_warn("The unit for channel %s has changed "
"from %s to %s." % (ch_name,
_unit2human[unit_old],
_unit2human[unit_new]))
warn("The unit for channel %s has changed from %s to %s."
% (ch_name, _unit2human[unit_old], _unit2human[unit_new]))
self.info['chs'][c_ind]['unit'] = _human2unit[ch_type]
if ch_type in ['eeg', 'seeg']:
self.info['chs'][c_ind]['coil_type'] = FIFF.FIFFV_COIL_EEG
Expand Down
6 changes: 3 additions & 3 deletions mne/channels/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from numpy.polynomial.legendre import legval
from scipy import linalg

from ..utils import logger, _traverse_warn
from ..utils import logger, warn
from ..io.pick import pick_types, pick_channels, pick_info
from ..surface import _normalize_vectors
from ..bem import _fit_sphere
Expand Down Expand Up @@ -145,8 +145,8 @@ def _interpolate_bads_eeg(inst):
distance = np.sqrt(np.sum((pos_good - center) ** 2, 1))
distance = np.mean(distance / radius)
if np.abs(1. - distance) > 0.1:
_traverse_warn('Your spherical fit is poor, interpolation results are '
'likely to be inaccurate.')
warn('Your spherical fit is poor, interpolation results are '
'likely to be inaccurate.')

logger.info('Computing interpolation matrix from {0} sensor '
'positions'.format(len(pos_good)))
Expand Down
14 changes: 7 additions & 7 deletions mne/channels/montage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from ..io.pick import pick_types
from ..io.open import fiff_open
from ..io.constants import FIFF
from ..utils import _check_fname, _traverse_warn
from ..utils import _check_fname, warn

from ..externals.six import string_types
from ..externals.six.moves import map
Expand Down Expand Up @@ -649,10 +649,10 @@ def _set_montage(info, montage, update_ch_names=False):
not_found = np.setdiff1d(eeg_sensors, sensors_found)
if len(not_found) > 0:
not_found_names = [info['ch_names'][ch] for ch in not_found]
_traverse_warn('The following EEG sensors did not have a position '
'specified in the selected montage: ' +
str(not_found_names) + '. Their position has been '
'left untouched.')
warn('The following EEG sensors did not have a position '
'specified in the selected montage: ' +
str(not_found_names) + '. Their position has been '
'left untouched.')

elif isinstance(montage, DigMontage):
dig = _make_dig_points(nasion=montage.nasion, lpa=montage.lpa,
Expand All @@ -679,8 +679,8 @@ def _set_montage(info, montage, update_ch_names=False):
did_not_set = [info['chs'][ii]['ch_name']
for ii in np.where(is_eeg & ~did_set)[0]]
if len(did_not_set) > 0:
_traverse_warn('Did not set %s channel positions:\n%s'
% (len(did_not_set), ', '.join(did_not_set)))
warn('Did not set %s channel positions:\n%s'
% (len(did_not_set), ', '.join(did_not_set)))
else:
raise TypeError("Montage must be a 'Montage' or 'DigMontage' "
"instead of '%s'." % type(montage))
8 changes: 4 additions & 4 deletions mne/chpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .transforms import (apply_trans, invert_transform, _angle_between_quats,
quat_to_rot, rot_to_quat)
from .utils import (verbose, logger, check_version, use_log_level, deprecated,
_check_fname, _traverse_warn)
_check_fname, warn)
from .fixes import partial
from .externals.six import string_types

Expand Down Expand Up @@ -490,9 +490,9 @@ def _calculate_chpi_positions(raw, t_step_min=0.1, t_step_max=10.,
use_mask[exclude] = False
good = use_mask.sum() >= 3
if not good:
_traverse_warn(_time_prefix(fit_time) + '%s/%s good HPI fits, '
'cannot determine the transformation!'
% (use_mask.sum(), n_freqs))
warn(_time_prefix(fit_time) + '%s/%s good HPI fits, '
'cannot determine the transformation!'
% (use_mask.sum(), n_freqs))
continue

#
Expand Down
23 changes: 10 additions & 13 deletions mne/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
from .defaults import _handle_default
from .epochs import _is_good
from .utils import (check_fname, logger, verbose, estimate_rank,
_compute_row_norms, check_version, _time_mask,
_traverse_warn)
_compute_row_norms, check_version, _time_mask, warn)

from .externals.six.moves import zip
from .externals.six import string_types
Expand Down Expand Up @@ -341,9 +340,8 @@ def _check_n_samples(n_samples, n_chan):
if n_samples <= 0:
raise ValueError('No samples found to compute the covariance matrix')
if n_samples < n_samples_min:
text = ('Too few samples (required : %d got : %d), covariance '
'estimate may be unreliable' % (n_samples_min, n_samples))
_traverse_warn(text)
warn('Too few samples (required : %d got : %d), covariance '
'estimate may be unreliable' % (n_samples_min, n_samples))


@verbose
Expand Down Expand Up @@ -630,8 +628,8 @@ def _unpack_epochs(epochs):
# check for baseline correction
for epochs_t in epochs:
if epochs_t.baseline is None and epochs_t.info['highpass'] < 0.5:
_traverse_warn('Epochs are not baseline corrected, covariance '
'matrix may be inaccurate')
warn('Epochs are not baseline corrected, covariance '
'matrix may be inaccurate')

for epoch in epochs:
epoch.info._check_consistency()
Expand Down Expand Up @@ -944,8 +942,8 @@ def _auto_low_rank_model(data, mode, n_jobs, method_params, cv,
# make sure we don't empty the thing if it's a generator
max_n = max(list(cp.deepcopy(iter_n_components)))
if max_n > data.shape[1]:
_traverse_warn('You are trying to estimate %i components on matrix '
'with %i features.' % (max_n, data.shape[1]))
warn('You are trying to estimate %i components on matrix '
'with %i features.' % (max_n, data.shape[1]))

for ii, n in enumerate(iter_n_components):
est.n_components = n
Expand Down Expand Up @@ -1229,10 +1227,9 @@ def prepare_noise_cov(noise_cov, info, ch_names, rank=None,
C_eeg_eig, C_eeg_eigvec = _get_ch_whitener(C_eeg, False, 'EEG',
rank_eeg)
if _needs_eeg_average_ref_proj(info):
_traverse_warn('No average EEG reference present in info["projs"], '
'covariance may be adversely affected. Consider '
'recomputing covariance using a raw file with an '
'average eeg reference projector added.')
warn('No average EEG reference present in info["projs"], covariance '
'may be adversely affected. Consider recomputing covariance using'
' a raw file with an average eeg reference projector added.')

n_chan = len(ch_names)
eigvec = np.zeros((n_chan, n_chan), dtype=np.float)
Expand Down
16 changes: 7 additions & 9 deletions mne/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from scipy.fftpack import fft, ifft

from .utils import sizeof_fmt, logger, get_config, _traverse_warn
from .utils import sizeof_fmt, logger, get_config, warn


# Support CUDA for FFTs; requires scikits.cuda and pycuda
Expand Down Expand Up @@ -34,7 +34,7 @@ def get_cuda_memory():
The amount of available memory as a human-readable string.
"""
if not _cuda_capable:
_traverse_warn('CUDA not enabled, returning zero for memory')
warn('CUDA not enabled, returning zero for memory')
mem = 0
else:
from pycuda.driver import mem_get_info
Expand Down Expand Up @@ -67,20 +67,19 @@ def init_cuda(ignore_config=False):
from pycuda import gpuarray, driver # noqa
from pycuda.elementwise import ElementwiseKernel
except ImportError:
_traverse_warn('module pycuda not found, CUDA not enabled')
warn('module pycuda not found, CUDA not enabled')
return
try:
# Initialize CUDA; happens with importing autoinit
import pycuda.autoinit # noqa
except ImportError:
_traverse_warn('pycuda.autoinit could not be imported, likely '
'a hardware error, CUDA not enabled')
warn('pycuda.autoinit could not be imported, likely a hardware error, '
'CUDA not enabled')
return
# Make sure scikit-cuda is installed
cudafft = _get_cudafft()
if cudafft is None:
_traverse_warn('module scikit-cuda not found, CUDA not '
'enabled')
warn('module scikit-cuda not found, CUDA not enabled')
return

# let's construct our own CUDA multiply in-place function
Expand All @@ -96,8 +95,7 @@ def init_cuda(ignore_config=False):
try:
cudafft.Plan(16, np.float64, np.complex128) # will get auto-GC'ed
except:
_traverse_warn('Device does not support 64-bit FFTs, '
'CUDA not enabled')
warn('Device does not support 64-bit FFTs, CUDA not enabled')
return
_cuda_capable = True
# Figure out limit for CUDA FFT calculations
Expand Down
8 changes: 4 additions & 4 deletions mne/decoding/time_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ..io.pick import pick_types
from ..viz.decoding import plot_gat_matrix, plot_gat_times
from ..parallel import parallel_func, check_n_jobs
from ..utils import _traverse_warn
from ..utils import warn


class _DecodingTime(dict):
Expand Down Expand Up @@ -213,7 +213,7 @@ def predict(self, epochs):
X, y, _ = _check_epochs_input(epochs, None, self.picks_)

if not np.all([len(test) for train, test in self.cv_]):
_traverse_warn('Some folds do not have any test epochs.')
warn('Some folds do not have any test epochs.')

# Define testing sliding window
if self.test_times == 'diagonal':
Expand Down Expand Up @@ -444,8 +444,8 @@ def _predict_time_loop(X, estimators, cv, slices, predict_mode,
# In simple mode, we avoid iterating over time slices.
slices = [slice(expected_start[0], expected_start[-1] + 1, 1)]
elif _warn_once.get('vectorization', True):
_traverse_warn('not vectorizing predictions across testing times, '
'using a time window with length > 1')
warn('not vectorizing predictions across testing times, '
'using a time window with length > 1')
_warn_once['vectorization'] = False
# Iterate over testing times. If is_single_time_sample, then 1 iteration.
y_pred = list()
Expand Down
4 changes: 2 additions & 2 deletions mne/dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
_points_outside_surface)
from .parallel import parallel_func
from .fixes import partial
from .utils import logger, verbose, _time_mask, _traverse_warn
from .utils import logger, verbose, _time_mask, warn


class Dipole(object):
Expand Down Expand Up @@ -488,7 +488,7 @@ def constraint(rd):
# Find a good starting point (find_best_guess in C)
B2 = np.dot(B, B)
if B2 == 0:
_traverse_warn('Zero field found for time %s' % t)
warn('Zero field found for time %s' % t)
return np.zeros(3), 0, np.zeros(3), 0

idx = np.argmin([_fit_eval(guess_rrs[[fi], :], B, B2, fwd_svd)
Expand Down
Loading

0 comments on commit e0cec48

Please sign in to comment.