Skip to content

Commit

Permalink
STY: Refactor logging
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Sep 9, 2013
1 parent f90f118 commit 6e7a4f6
Show file tree
Hide file tree
Showing 60 changed files with 64 additions and 198 deletions.
3 changes: 1 addition & 2 deletions mne/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
# License: BSD (3-clause)

import numpy as np
import logging
logger = logging.getLogger('mne')

from . import verbose
from .utils import logger


@verbose
Expand Down
4 changes: 1 addition & 3 deletions mne/beamformer/_dics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
import numpy as np
from scipy import linalg

import logging
logger = logging.getLogger('mne')

from .. import verbose
from ..utils import logger
from ..fiff.pick import pick_types
from ..forward import _subject_from_forward
from ..minimum_norm.inverse import combine_xyz
Expand Down
4 changes: 1 addition & 3 deletions mne/beamformer/_lcmv.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import numpy as np
from scipy import linalg

import logging
logger = logging.getLogger('mne')

from ..fiff.constants import FIFF
from ..fiff.proj import make_projector
from ..fiff.pick import pick_types, pick_channels_forward, pick_channels_cov
Expand All @@ -21,6 +18,7 @@
from ..source_estimate import _make_stc
from ..source_space import label_src_vertno_sel
from .. import verbose
from ..utils import logger


@verbose
Expand Down
3 changes: 1 addition & 2 deletions mne/connectivity/effective.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
#
# License: BSD (3-clause)
import copy
import logging
logger = logging.getLogger('mne')

import numpy as np

from .. import verbose
from ..utils import logger
from .spectral import spectral_connectivity


Expand Down
5 changes: 1 addition & 4 deletions mne/connectivity/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import numpy as np
from scipy.fftpack import fftfreq

import logging
logger = logging.getLogger('mne')


from .utils import check_indices
from ..fixes import tril_indices
from ..parallel import parallel_func
Expand All @@ -22,6 +18,7 @@
_psd_from_mt_adaptive
from ..time_frequency.tfr import morlet, cwt
from .. import verbose
from ..utils import logger

########################################################################
# Various connectivity estimators
Expand Down
4 changes: 1 addition & 3 deletions mne/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
import numpy as np
from scipy import linalg

import logging
logger = logging.getLogger('mne')

from . import fiff, verbose
from .fiff.write import start_file, end_file
from .fiff.proj import make_projector, proj_equal, activate_proj
Expand All @@ -22,6 +19,7 @@
pick_channels
from .fiff.constants import FIFF
from .epochs import _is_good
from .utils import logger


def _check_covs_algebra(cov1, cov2):
Expand Down
5 changes: 1 addition & 4 deletions mne/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
# need OSError because scikits.cuda throws it if cufft not found
pass

import logging
logger = logging.getLogger('mne')

from .utils import sizeof_fmt
from .utils import sizeof_fmt, logger


# Support CUDA for FFTs; requires scikits.cuda and pycuda
Expand Down
3 changes: 0 additions & 3 deletions mne/datasets/megsim/megsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import zipfile
from sys import stdout

import logging
logger = logging.getLogger('mne')

from ...utils import _fetch_file, get_config, set_config, _url_to_local_path
from .urls import url_match, valid_data_types, valid_data_formats, \
valid_conditions
Expand Down
5 changes: 1 addition & 4 deletions mne/datasets/sample/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
import shutil
from warnings import warn

import logging
logger = logging.getLogger('mne')

from ... import __version__ as mne_version
from ...utils import get_config, set_config, _fetch_file
from ...utils import get_config, set_config, _fetch_file, logger


def _sample_version(path):
Expand Down
4 changes: 1 addition & 3 deletions mne/decoding/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
band_stop_filter
from ..time_frequency import multitaper_psd
from ..fiff import pick_types

import logging
logger = logging.getLogger('mne')
from .utils import logger


class Scaler(TransformerMixin):
Expand Down
3 changes: 1 addition & 2 deletions mne/dipole.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
# License: Simplified BSD

import numpy as np
import logging
logger = logging.getLogger('mne')

from . import verbose
from .utils import logger


@verbose
Expand Down
4 changes: 1 addition & 3 deletions mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
import numpy as np
from copy import deepcopy

import logging
logger = logging.getLogger('mne')

from .fiff.write import start_file, start_block, end_file, end_block, \
write_int, write_float_matrix, write_float, \
write_id, write_string
Expand All @@ -37,6 +34,7 @@
from . import verbose
from .fixes import in1d
from .viz import _mutable_defaults, plot_epochs
from .utils import logger


class _BaseEpochs(ProjMixin):
Expand Down
5 changes: 1 addition & 4 deletions mne/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@
import numpy as np
from os.path import splitext

import logging
logger = logging.getLogger('mne')

from .fiff.constants import FIFF
from .fiff.tree import dir_tree_find
from .fiff.tag import read_tag
from .fiff.open import fiff_open
from .fiff.write import write_int, start_block, start_file, end_block, end_file
from .fiff.pick import pick_channels
from .utils import get_config
from .utils import get_config, logger
from . import verbose


Expand Down
6 changes: 2 additions & 4 deletions mne/fiff/bti/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
#
# simplified BSD-3 license

import logging
import os.path as op
from itertools import count
import numpy as np

from ...utils import verbose
from ... import verbose
from ...utils import logger
from .. import Raw
from .. import FIFF
from .constants import BTI
Expand All @@ -24,8 +24,6 @@
bti_to_vv_coil_trans, inverse_trans, merge_trans)
from ..meas_info import Info

logger = logging.getLogger('mne')


FIFF_INFO_CHS_FIELDS = ('loc', 'ch_name', 'unit_mul', 'coil_trans',
'coord_frame', 'coil_type', 'range', 'unit', 'cal', 'eeg_loc',
Expand Down
3 changes: 0 additions & 3 deletions mne/fiff/bti/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
# simplified BSD-3 license

import struct
import logging
import numpy as np

logger = logging.getLogger('mne')


def _unpack_matrix(fid, format, rows, cols, dtype):
""" Aux Function """
Expand Down
4 changes: 0 additions & 4 deletions mne/fiff/compensator.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import numpy as np

import logging
logger = logging.getLogger('mne')

from .constants import FIFF
from .. import verbose


def get_current_comp(info):
Expand Down
4 changes: 1 addition & 3 deletions mne/fiff/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

import numpy as np

import logging
logger = logging.getLogger('mne')

from .constants import FIFF
from .write import start_block, end_block, write_int, write_name_list, \
write_double, write_float_matrix
Expand All @@ -16,6 +13,7 @@
from .proj import read_proj, write_proj
from .channels import read_bad_channels
from .. import verbose
from ..utils import logger


@verbose
Expand Down
4 changes: 1 addition & 3 deletions mne/fiff/ctf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

import numpy as np

import logging
logger = logging.getLogger('mne')

from .constants import FIFF
from .tag import find_tag, has_tag, read_tag
from .tree import dir_tree_find
from .. import verbose
from ..utils import logger


def hex2dec(s):
Expand Down
4 changes: 1 addition & 3 deletions mne/fiff/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

import numpy as np

import logging
logger = logging.getLogger('mne')

from .. import verbose
from .utils import logger


@verbose
Expand Down
5 changes: 1 addition & 4 deletions mne/fiff/evoked.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
import numpy as np
import warnings

import logging
logger = logging.getLogger('mne')

from .constants import FIFF
from .open import fiff_open
from .tag import read_tag
Expand All @@ -21,7 +18,7 @@
from ..baseline import rescale
from ..filter import resample, detrend
from ..fixes import in1d
from ..utils import _check_pandas_installed
from ..utils import _check_pandas_installed, logger

from .write import start_file, start_block, end_file, end_block, \
write_int, write_string, write_float_matrix, \
Expand Down
5 changes: 1 addition & 4 deletions mne/fiff/kit/kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@
# License: BSD (3-clause)

import time
import logging
from struct import unpack
from os import SEEK_CUR
import numpy as np
from scipy.linalg import norm
from ...fiff import pick_types
from ...transforms.coreg import fit_matched_pts
from ...utils import verbose
from ...utils import verbose, logger
from ..raw import Raw
from ..constants import FIFF
from ..meas_info import Info
from .constants import KIT, KIT_NY, KIT_AD
from . import coreg

logger = logging.getLogger('mne')


class RawKIT(Raw):
"""Raw object from KIT SQD file adapted from bti/raw.py
Expand Down
4 changes: 1 addition & 3 deletions mne/fiff/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
#
# License: BSD (3-clause)

import logging
logger = logging.getLogger('mne')

from .constants import FIFF
from .tag import find_tag, has_tag
from .write import write_int, start_block, end_block, write_float_matrix, \
write_name_list
from .. import verbose
from ..utils import logger


def _transpose_named_matrix(mat, copy=True):
Expand Down
4 changes: 1 addition & 3 deletions mne/fiff/meas_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
from StringIO import StringIO
from datetime import datetime as dt

import logging
logger = logging.getLogger('mne')

from .open import fiff_open
from .tree import dir_tree_find, copy_tree
from .constants import FIFF
Expand All @@ -25,6 +22,7 @@
write_string, write_dig_point, write_float, write_int, \
write_coord_trans, write_ch_info, write_name_list
from .. import verbose
from ..utils import logger


def _summarize_str(st):
Expand Down
3 changes: 1 addition & 2 deletions mne/fiff/open.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
import os.path as op
import gzip
import cStringIO
import logging
logger = logging.getLogger('mne')

from .tag import read_tag_info, read_tag, read_big, Tag
from .tree import make_dir_tree
from .constants import FIFF
from .. import verbose
from ..utils import logger


@verbose
Expand Down
4 changes: 1 addition & 3 deletions mne/fiff/pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
import re
from warnings import warn

import logging
logger = logging.getLogger('mne')

import numpy as np
from .constants import FIFF
from .. import verbose
from ..utils import logger


def channel_type(info, idx):
Expand Down
Loading

0 comments on commit 6e7a4f6

Please sign in to comment.