diff options
author | Pjotr Prins | 2015-04-18 08:54:07 +0200 |
---|---|---|
committer | Pjotr Prins | 2015-04-18 08:54:07 +0200 |
commit | 0929b16a5183538811260aef5c37f7406c302026 (patch) | |
tree | bef582d538af5e3cd43bfee4209f7195ce39dc9f | |
parent | bb8e466e00c622f7b28209378c1871a1d8469572 (diff) | |
download | genenetwork2-0929b16a5183538811260aef5c37f7406c302026.tar.gz |
Use reduced outputter for GN2 logs too
-rw-r--r-- | wqflask/wqflask/my_pylmm/pyLMM/gn2.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/gn2.py b/wqflask/wqflask/my_pylmm/pyLMM/gn2.py index 7bceb089..40b2021d 100644 --- a/wqflask/wqflask/my_pylmm/pyLMM/gn2.py +++ b/wqflask/wqflask/my_pylmm/pyLMM/gn2.py @@ -1,7 +1,10 @@ -# Genenetwork2 specific methods and callback handler +# Standalone specific methods and callback handler # # Copyright (C) 2015 Pjotr Prins (pjotr.prins@thebird.nl) # +# Set the log level with +# +# logging.basicConfig(level=logging.DEBUG) from __future__ import absolute_import, print_function, division @@ -9,8 +12,10 @@ import numpy as np import sys import logging -# logging.basicConfig(level=logging.DEBUG) -# np.set_printoptions() +# logger = logging.getLogger(__name__) +logger = logging.getLogger('lmm2') +logging.basicConfig(level=logging.DEBUG) +np.set_printoptions(precision=3,suppress=True) progress_location = None progress_current = None @@ -37,13 +42,20 @@ def progress(location, count, total): logger.info("Progress: %s %d%%" % (location,perc)) progress_location = location progress_prev_perc = perc - + def mprint(msg,data): """ Array/matrix print function """ m = np.array(data) - print(msg,m.shape,"=\n",m) + if m.ndim == 1: + print(msg,m.shape,"=\n",m[0:3]," ... ",m[-3:]) + if m.ndim == 2: + print(msg,m.shape,"=\n[", + m[0][0:3]," ... ",m[0][-3:],"\n ", + m[1][0:3]," ... ",m[1][-3:],"\n ...\n ", + m[-2][0:3]," ... ",m[-2][-3:],"\n ", + m[-1][0:3]," ... ",m[-1][-3:],"]") def fatal(msg): logger.critical(msg) @@ -68,7 +80,7 @@ def uses(*funcs): Some sugar """ return [callbacks()[func] for func in funcs] - + # ----- Minor test cases: if __name__ == '__main__': |