mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-16 11:21:38 +08:00
Bug Fixes in TensorView and test_utils
Updated ipnbs
This commit is contained in:
@@ -13,7 +13,7 @@ class TensorView(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def plotImage(self, I, imageType='CC', figNum=1,ax=None,direction='z',numbering=True):
|
||||
def plotImage(self, I, imageType='CC', figNum=1,ax=None,direction='z',numbering=True,annotationColor='w'):
|
||||
"""
|
||||
Mesh.plotImage(I)
|
||||
|
||||
@@ -126,11 +126,11 @@ class TensorView(object):
|
||||
nY = np.ceil(self.nCz/nX)
|
||||
|
||||
# allocate space for montage
|
||||
C = np.zeros((nX*self.nCx,nY*self.nCz))
|
||||
|
||||
|
||||
nCx = self.nCx
|
||||
nCy = self.nCy
|
||||
|
||||
C = np.zeros((nX*nCx,nY*nCy))
|
||||
|
||||
for iy in range(int(nY)):
|
||||
for ix in range(int(nX)):
|
||||
iz = ix + iy*nX
|
||||
@@ -142,6 +142,7 @@ class TensorView(object):
|
||||
C = np.ma.masked_where(np.isnan(C), C)
|
||||
xx = np.r_[0, np.cumsum(np.kron(np.ones((nX, 1)), self.hx).ravel())]
|
||||
yy = np.r_[0, np.cumsum(np.kron(np.ones((nY, 1)), self.hy).ravel())]
|
||||
# Plot the mesh
|
||||
ph = ax.pcolormesh(xx, yy, C.T)
|
||||
# Plot the lines
|
||||
gx = np.arange(nX+1)*self.vectorNx[-1]
|
||||
@@ -151,8 +152,8 @@ class TensorView(object):
|
||||
gxY = np.kron(np.ones((nX+1, 1)), np.array([0, sum(self.hy)*nY, np.nan])).ravel()
|
||||
gyX = np.kron(np.ones((nY+1, 1)), np.array([0, sum(self.hx)*nX, np.nan])).ravel()
|
||||
gyY = np.c_[gy, gy, gy+np.nan].ravel()
|
||||
ax.plot(gxX, gxY, 'w-', linewidth=2)
|
||||
ax.plot(gyX, gyY, 'w-', linewidth=2)
|
||||
ax.plot(gxX, gxY, annotationColor+'-', linewidth=2)
|
||||
ax.plot(gyX, gyY, annotationColor+'-', linewidth=2)
|
||||
|
||||
if numbering:
|
||||
pad = np.sum(self.hx)*0.04
|
||||
@@ -161,7 +162,7 @@ class TensorView(object):
|
||||
iz = ix + iy*nX
|
||||
if iz < self.nCz:
|
||||
ax.text((ix+1)*self.vectorNx[-1]-pad,(iy)*self.vectorNy[-1]+pad,
|
||||
'#%i'%iz,color='w',verticalalignment='bottom',horizontalalignment='right',size='x-large')
|
||||
'#%i'%iz,color=annotationColor,verticalalignment='bottom',horizontalalignment='right',size='x-large')
|
||||
|
||||
plt.show()
|
||||
return ph
|
||||
|
||||
Reference in New Issue
Block a user