Skip to content

Commit

Permalink
Merge pull request #867 from arokem/set_logger_levels
Browse files Browse the repository at this point in the history
Set logger levels to INFO
  • Loading branch information
arokem authored Aug 22, 2022
2 parents 34bd33a + 47fcd44 commit ec3057b
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion AFQ/api/bundle_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def __init__(self,
for bundle_name in bundle_info:
self.bundle_names.append(bundle_name)

self.logger = logging.getLogger('AFQ.api')
self.logger = logging.getLogger('AFQ')

if self.seg_algo == "afq":
if "FP" in self.bundle_names\
Expand Down
4 changes: 3 additions & 1 deletion AFQ/api/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ def __init__(self,
if not isinstance(bids_layout_kwargs, dict):
raise TypeError("bids_layout_kwargs must be a dict")

self.logger = logging.getLogger('AFQ.api')
self.logger = logging.getLogger('AFQ')
self.logger.setLevel(logging.INFO)

self.parallel_params = parallel_params
self.wf_dict = {}

Expand Down
2 changes: 1 addition & 1 deletion AFQ/api/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(self,
"unrecognized parameter tractography_params, "
"did you mean tracking_params ?"))

self.logger = logging.getLogger('AFQ.api')
self.logger = logging.getLogger('AFQ')
self.output_dir = output_dir

kwargs = dict(
Expand Down
12 changes: 6 additions & 6 deletions AFQ/data/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def read_callosum_templates(as_img=True, resample_to=False):
dict with: keys: names of template ROIs and values: nibabel Nifti1Image
objects from each of the ROI nifti files.
"""
logger = logging.getLogger('AFQ.data')
logger = logging.getLogger('AFQ')

logger.debug('loading callosum templates')
tic = time.perf_counter()
Expand Down Expand Up @@ -555,7 +555,7 @@ def read_templates(as_img=True, resample_to=False):
dict with: keys: names of template ROIs and values: nibabel Nifti1Image
objects from each of the ROI nifti files.
"""
logger = logging.getLogger('AFQ.data')
logger = logging.getLogger('AFQ')
logger.debug('loading AFQ templates')
tic = time.perf_counter()

Expand Down Expand Up @@ -649,7 +649,7 @@ def read_or_templates(as_img=True, resample_to=False):
dict with: keys: names of template ROIs and values: nibabel Nifti1Image
objects from each of the ROI nifti files.
"""
logger = logging.getLogger('AFQ.data')
logger = logging.getLogger('AFQ')

logger.debug('loading or templates')
tic = time.perf_counter()
Expand Down Expand Up @@ -795,7 +795,7 @@ def organize_stanford_data(path=None, clear_previous_afq=False):
If clear_previous_afq is True and there is an afq folder in derivatives,
it will be removed.
"""
logger = logging.getLogger('AFQ.data')
logger = logging.getLogger('AFQ')

# fetches data for first subject and session
logger.info('fetching Stanford HARDI data')
Expand Down Expand Up @@ -1188,7 +1188,7 @@ def bundles_to_aal(bundles, atlas=None):
targets[bundle + "_" + region_name] = nib.Nifti1Image(
aal_roi, atlas.affine)
else:
logger = logging.getLogger('AFQ.data')
logger = logging.getLogger('AFQ')
logger.warning(f"Segmentation end points undefined for {bundle},"
+ " continuing without end points")
targets[bundle + "_start"] = None
Expand Down Expand Up @@ -1309,7 +1309,7 @@ def read_ukbb_fa_template(mask=True):
)

if not op.exists(fa_path):
logger = logging.getLogger('AFQ.data')
logger = logging.getLogger('AFQ')
logger.warning(
"Downloading brain MRI group mean statistics from UK Biobank. "
+ "This download is approximately 1.1 GB. "
Expand Down
2 changes: 1 addition & 1 deletion AFQ/definitions/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
__all__ = ["FnirtMap", "SynMap", "SlrMap", "AffMap", "ItkMap"]


logger = logging.getLogger('AFQ.definitions.mapping')
logger = logging.getLogger('AFQ')


# For map defintions, get_for_subses should return only the mapping
Expand Down
2 changes: 1 addition & 1 deletion AFQ/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def __init__(self,
matter anatomy and tract-specific quantification. Neuroimage 39:
336-347
"""
self.logger = logging.getLogger('AFQ.Segmentation')
self.logger = logging.getLogger('AFQ')
self.nb_points = nb_points
self.nb_streamlines = nb_streamlines

Expand Down
3 changes: 2 additions & 1 deletion AFQ/tasks/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
__all__ = ["as_file", "as_fit_deriv", "as_img"]


logger = logging.getLogger('AFQ.api')
logger = logging.getLogger('AFQ')
logger.setLevel(logging.INFO)


# get args and kwargs from function
Expand Down
2 changes: 1 addition & 1 deletion AFQ/tasks/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from dipy.io.stateful_tractogram import Space


logger = logging.getLogger('AFQ.api.mapping')
logger = logging.getLogger('AFQ')


@pimms.calc("b0_warped")
Expand Down
2 changes: 1 addition & 1 deletion AFQ/tasks/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from dipy.tracking.streamline import set_number_of_points, values_from_volume


logger = logging.getLogger('AFQ.api.seg')
logger = logging.getLogger('AFQ')


@pimms.calc("bundles")
Expand Down
2 changes: 1 addition & 1 deletion AFQ/tasks/tractography.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from AFQ.tasks.utils import get_default_args
from AFQ.definitions.image import ScalarImage

logger = logging.getLogger('AFQ.api')
logger = logging.getLogger('AFQ')


@pimms.calc("seed")
Expand Down
2 changes: 1 addition & 1 deletion AFQ/tasks/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from plotly.subplots import make_subplots

logger = logging.getLogger('AFQ.api.viz')
logger = logging.getLogger('AFQ')


def _viz_prepare_vol(vol, xform, mapping, scalar_dict):
Expand Down
2 changes: 1 addition & 1 deletion AFQ/tractography.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def track(params_file, directions="prob", max_angle=30., sphere=None,
Descoteaux, M. Towards quantitative connectivity analysis: reducing
tractography biases. NeuroImage, 98, 266-278, 2014.
"""
logger = logging.getLogger('AFQ.tractography')
logger = logging.getLogger('AFQ')

logger.info("Loading Image...")
if isinstance(params_file, str):
Expand Down
2 changes: 1 addition & 1 deletion AFQ/utils/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dipy.tracking.streamline import select_random_set_of_streamlines
import dipy.tracking.utils as dtu

logger = logging.getLogger('AFQ.utils.volume')
logger = logging.getLogger('AFQ')


def transform_inverse_roi(roi, mapping, bundle_name="ROI"):
Expand Down
2 changes: 1 addition & 1 deletion AFQ/viz/fury_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
except (ImportError, ModuleNotFoundError):
raise ImportError(vut.viz_import_msg_error("fury"))

viz_logger = logging.getLogger("AFQ.viz")
viz_logger = logging.getLogger("AFQ")


def _inline_interact(scene, inline, interact):
Expand Down
2 changes: 1 addition & 1 deletion AFQ/viz/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def __init__(self, out_folder, csv_fnames, names, is_special="",
Can be 'ICC1, 'ICC2', 'ICC3', 'ICC1k', 'ICC2k', 'ICC3k'.
Default: "ICC2"
"""
self.logger = logging.getLogger('AFQ.csv')
self.logger = logging.getLogger('AFQ')
self.ICC_func = ICC_func
if "k" in self.ICC_func:
self.ICC_func_name = f"ICC({self.ICC_func[3]},k)"
Expand Down
2 changes: 1 addition & 1 deletion AFQ/viz/plotly_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


scope = pio.kaleido.scope
viz_logger = logging.getLogger("AFQ.viz")
viz_logger = logging.getLogger("AFQ")


def _inline_interact(figure, show, show_inline):
Expand Down
2 changes: 1 addition & 1 deletion AFQ/viz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

__all__ = ["Viz"]

viz_logger = logging.getLogger("AFQ.viz")
viz_logger = logging.getLogger("AFQ")
tableau_20 = [
(0.12156862745098039, 0.4666666666666667, 0.7058823529411765),
(0.6823529411764706, 0.7803921568627451, 0.9098039215686274),
Expand Down
2 changes: 1 addition & 1 deletion bin/pyAFQ
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ with warnings.catch_warnings():
import AFQ.utils.bin as afb

import logging
logger = logging.getLogger('pyAFQ')
logger = logging.getLogger('AFQ')
logger.setLevel(level=logging.INFO)

usage = \
Expand Down
3 changes: 1 addition & 2 deletions examples/plot_callosal_tract_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
# Ensure segmentation logging information is included in this example's output
root = logging.getLogger()
root.setLevel(logging.ERROR)
logging.getLogger('AFQ.Segmentation').setLevel(logging.INFO)
logging.getLogger('AFQ.tractography').setLevel(logging.INFO)
logging.getLogger('AFQ').setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
root.addHandler(handler)
Expand Down

0 comments on commit ec3057b

Please sign in to comment.