mirror of
https://github.com/wassname/simpeg.git
synced 2026-09-09 11:34:26 +08:00
Fix and test interpolation. Issue #43
This commit is contained in:
+10
-16
@@ -178,19 +178,13 @@ def _interpmat3D(locs, x, y, z):
|
||||
if __name__ == '__main__':
|
||||
from SimPEG import *
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
M = Mesh.TensorMesh([4])
|
||||
M.vectorCCx
|
||||
Q = M.getInterpolationMat(np.array([[0],[0.126],[0.127]]),'CC',zerosOutside=True)
|
||||
print Q.todense()
|
||||
|
||||
# locs = np.random.rand(50)*0.8+0.1
|
||||
# x = np.linspace(0,1,7)
|
||||
# dense = np.linspace(0,1,200)
|
||||
# fun = lambda x: np.cos(2*np.pi*x)
|
||||
# Q = Utils.interpmat(locs, x)
|
||||
# plt.plot(x, fun(x), 'bs-')
|
||||
# plt.plot(dense, fun(dense), 'y:')
|
||||
# plt.plot(locs, Q*fun(x), 'mo')
|
||||
# plt.plot(locs, fun(locs), 'rx')
|
||||
# plt.show()
|
||||
locs = np.random.rand(50)*0.8+0.1
|
||||
x = np.linspace(0,1,7)
|
||||
dense = np.linspace(0,1,200)
|
||||
fun = lambda x: np.cos(2*np.pi*x)
|
||||
Q = Utils.interpmat(locs, x)
|
||||
plt.plot(x, fun(x), 'bs-')
|
||||
plt.plot(dense, fun(dense), 'y:')
|
||||
plt.plot(locs, Q*fun(x), 'mo')
|
||||
plt.plot(locs, fun(locs), 'rx')
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user