Better logging practices
Some checks are pending
gitea-physics/pdme/pipeline/head Build queued...

This commit is contained in:
2022-01-23 18:14:17 -06:00
parent 688f76f560
commit 37b58a8f88
2 changed files with 8 additions and 2 deletions

View File

@@ -6,6 +6,9 @@ import pdme.util
import logging
_logger = logging.getLogger(__name__)
class Model():
"""
Interface for models.
@@ -43,7 +46,7 @@ class Model():
----------
Returns the model's cost function.
'''
logging.debug(f"Constructing costs for dots: {dots}")
_logger.debug(f"Constructing costs for dots: {dots}")
def costs_to_return(pts: numpy.ndarray) -> numpy.ndarray:
return numpy.array([self.cost_for_dot(dot, pts) for dot in dots])

View File

@@ -8,6 +8,9 @@ SIGN_ARRAY_7 = numpy.array((-1, -1, -1, 1, 1, 1, 1))
SIGN_ARRAY_4 = numpy.array((-1, 1, 1, 1))
_logger = logging.getLogger(__name__)
def flip_chunk_to_positive_px(pt: numpy.ndarray) -> numpy.ndarray:
if pt[0] > 0:
return pt
@@ -18,7 +21,7 @@ def flip_chunk_to_positive_px(pt: numpy.ndarray) -> numpy.ndarray:
elif len(pt) == 4:
return SIGN_ARRAY_4 * pt
else:
logging.warning(f"Could not normalise pt: {pt}. Returning as is...")
_logger.warning(f"Could not normalise pt: {pt}. Returning as is...")
return pt