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

use logging in importer and serialized sections #107 #108

Merged
merged 4 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion bluecellulab/cell/serialized_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
"""Module that allows morphology sections to be accessed from an array by
index."""

import logging
import warnings
import neuron
from bluecellulab.type_aliases import HocObjectType


logger = logging.getLogger(__name__)
warnings.filterwarnings("once", category=UserWarning, module=__name__)


Expand All @@ -31,7 +33,7 @@ def __init__(self, cell: HocObjectType) -> None:
for index, sec in enumerate(cell.all, start=1):
v_value = sec(0.0001).v
if v_value >= n:
print(f"{sec.name()} v(1)={sec(1).v} n3d()={sec.n3d()}")
logging.debug(f"{sec.name()} v(1)={sec(1).v} n3d()={sec.n3d()}")
raise ValueError("Error: failure in mk2_isec2sec()")

if v_value < 0:
Expand Down
9 changes: 7 additions & 2 deletions bluecellulab/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@
# limitations under the License.
"""Main importer of bluecellulab."""

import logging
import os
from types import ModuleType
import pkg_resources

import neuron

from bluecellulab.exceptions import BluecellulabError


logger = logging.getLogger(__name__)


def import_mod_lib(neuron: ModuleType) -> str:
"""Import mod files."""
res = ""
Expand Down Expand Up @@ -62,8 +67,8 @@ def import_neurodamus(neuron: ModuleType) -> None:

def print_header(neuron: ModuleType, mod_lib_path: str) -> None:
"""Print bluecellulab header to stdout."""
print("Imported NEURON from: %s" % neuron.__file__)
print('Mod lib: ', mod_lib_path)
logger.info("Imported NEURON from: %s" % neuron.__file__)
logger.info('Mod lib: ', mod_lib_path)


mod_lib_paths = import_mod_lib(neuron)
Expand Down