smbinterp/lib/baker/tools.py
smcquay@cfdviz2 c5d8fff883 moved some files around to conform to python best practicies
--HG--
rename : lib/baker.py => lib/baker/__init__.py
rename : lib/tools.py => lib/baker/tools.py
rename : lib/grid.py => lib/grid/__init__.py
rename : lib/smcqdelaunay.py => lib/grid/smcqdelaunay.py
2010-03-08 13:05:42 -07:00

27 lines
520 B
Python

import numpy as np
class smberror(Exception):
"""
this is a silly little exception subclass
"""
def __init__(self, val):
self.value = val
def __str__(self):
return repr(self.value)
def rms(errors):
"""
root mean square calculation
"""
r = 0.0
for i in errors:
r += np.power(i, 2)
r = np.sqrt(r / len(errors))
return r
def exact_func(x, y):
"""
the exact function used from baker's article (for testing)
"""
return np.power((np.sin(x * np.pi) * np.cos(y * np.pi)), 2)