diff options
Diffstat (limited to 'ka_debug.py')
-rw-r--r-- | ka_debug.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ka_debug.py b/ka_debug.py index 9456259..03ed3f1 100644 --- a/ka_debug.py +++ b/ka_debug.py @@ -18,6 +18,7 @@ import logging import os import time +import math #Add support for design by contract to all classes except blacklist. @@ -32,6 +33,7 @@ _try_once, locale_testrun = False, False if os.path.exists(DEBUG_ACTIVITY_PATH): locale_testrun = True _try_once = True + _try_once = False is_DbC_activated = False @@ -54,6 +56,33 @@ def info(msg): _logger.debug(msg) # _logger.debug(caller()) +def _matrix(mtrx, context): + """Log an info message.""" + xx, yx, xy, yy, x0, y0 = mtrx + det = xx * yy + yx * xy + if math.fabs(det) < (0.004 ** 2): + global _last_clock, locale_testrun + clock_now = time.clock() + if locale_testrun: + print 'matrix', int((time.time()-_start_time)*1000), \ + int((clock_now-_last_clock)*1000), ':', context, mtrx, ', det=', det + _last_clock = clock_now + _avtivate_logger() + _logger.debug(mtrx) +# raise ValueError('det=' + str(det) + ', ' + str(mtrx)) + +def matrix(mtrx): + """Log an info message.""" + _matrix(mtrx, '') + +def matrix_s(mtrx): + """Log matrix after save.""" + _matrix(mtrx, 'save') + +def matrix_r(mtrx): + """Log matrix before restore.""" + _matrix(mtrx, 'restore') + def err(msg): """Log an error message.""" global _last_clock, locale_testrun |