Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Fixes logger error w/reports #192

Merged
merged 1 commit into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions abagen/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,16 @@ def coerce_atlas_to_dict(atlas, donors, atlas_info=None, data_dir=None):
if len(missing) > 0:
raise ValueError('Provided `atlas` does not have entry for all '
f'requested donors. Missing donors: {donors}.')
LGR.info('Donor-specific atlases provided; using native coords for '
'tissue samples')
except AttributeError:
atlas = check_atlas(atlas, atlas_info)
atlas = {donor: atlas for donor in donors}

if group_atlas:
LGR.info('Group-level atlas provided; using MNI coords for '
'tissue samples')
else:
LGR.info('Donor-specific atlases provided; using native coords for '
'tissue samples')

# update group atlas status based on what was decided / derived
for atl in atlas.values():
Expand Down
10 changes: 9 additions & 1 deletion abagen/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
<https://creativecommons.org/publicdomain/zero/1.0/>`_.
"""

import logging

import numpy as np

from . import __version__
from .datasets import check_donors, fetch_donor_info
from .images import coerce_atlas_to_dict
from .utils import first_entry


LGR = logging.getLogger('abagen')
METRICS = {
np.mean: 'mean',
np.median: 'median'
Expand Down Expand Up @@ -65,6 +67,10 @@ def __init__(self, atlas, atlas_info=None, *, ibf_threshold=0.5,
region_agg='donors', agg_metric='mean', corrected_mni=True,
reannotated=True, donors='all', return_donors=False,
data_dir=None, counts=None, n_probes=None, n_genes=None):

efflevel = LGR.getEffectiveLevel()
LGR.setLevel(100)

atlas, self.group_atlas = \
coerce_atlas_to_dict(atlas, donors, atlas_info=atlas_info,
data_dir=data_dir)
Expand All @@ -91,6 +97,8 @@ def __init__(self, atlas, atlas_info=None, *, ibf_threshold=0.5,
self.n_genes = n_genes
self.body = self.gen_report()

LGR.setLevel(efflevel)

def gen_report(self):
""" Generates main text of report
"""
Expand Down