Skip to content

Commit

Permalink
use logging in importer and serialized sections
Browse files Browse the repository at this point in the history
  • Loading branch information
anilbey committed Nov 10, 2023
1 parent a86cd4e commit 2572581
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

0 comments on commit 2572581

Please sign in to comment.