minor: logging changes

This commit is contained in:
Stephen McQuay 2011-03-22 16:06:08 -06:00
parent 465bc0d819
commit 1b91fbcfca
4 changed files with 14 additions and 9 deletions

View File

@ -5,7 +5,7 @@ import numpy as np
import itertools
import logging
log = logging.getLogger("interp")
log = logging.getLogger('interp')
def get_phis(X, R):
"""
@ -75,6 +75,8 @@ def get_phis(X, R):
# raise Exception(msg)
phi = np.dot(np.linalg.pinv(A), b)
log.debug("phi: %s", phi)
return phi
def qlinear(X, R):
@ -89,15 +91,19 @@ def qlinear(X, R):
phis = get_phis(X, R.verts)
qlin = np.sum([q_i * phi_i for q_i, phi_i in zip(R.q, phis)])
log.debug("phis: %s", phis)
log.debug("qlin: %s", qlin)
return phis, qlin
def get_error(phi, R, S, order = 2):
log.debug("len(phi): %d"% len(phi))
print "asdf"
B = [] # baker eq 9
w = [] # baker eq 11
p = pattern(order, len(phi), offset = -1)
log.debug("pattern: %s" % p)
log.info("pattern: %s" % p)
for (s,q) in zip(S.verts, S.q):
cur_phi, cur_qlin = qlinear(s, R)
@ -111,8 +117,8 @@ def get_error(phi, R, S, order = 2):
B.append(l)
w.append(q - cur_qlin)
log.debug("B: %s" % B)
log.debug("w: %s" % w)
log.info("B: %s" % B)
log.info("w: %s" % w)
B = np.array(B)
@ -128,8 +134,6 @@ def get_error(phi, R, S, order = 2):
log.error("linear calculation went bad, resorting to np.linalg.pinv: %s" % e)
abc = np.dot(np.linalg.pinv(A), b)
log.debug(len(abc) == len(p))
error_term = 0.0
for (a, i) in zip(abc, p):
cur_sum = a

View File

@ -31,7 +31,6 @@ class rect_grid(grid):
verts.append([cur_x, cur_y])
q.append(exact_func((cur_x, cur_y)))
grid.__init__(self, verts, q)
self.construct_connectivity()
class random_grid(rect_grid):

View File

@ -38,7 +38,6 @@ class rect_grid(grid):
verts.append([cur_x, cur_y, cur_z])
q.append(exact_func_3D((cur_x, cur_y, cur_z)))
grid.__init__(self, verts, q)
# self.construct_connectivity()

View File

@ -10,6 +10,9 @@ from interp.grid import grid
from interp.grid import cell
from interp.tools import exact_func, exact_func_3D
import logging
log = logging.getLogger('interp')
THREE_NODE_TRIANGLE = 2