mirror of
https://github.com/wassname/simpeg.git
synced 2026-09-12 12:51:28 +08:00
Migrated % string formating
This commit is contained in:
+8
-8
@@ -171,7 +171,7 @@ class TensorView(object):
|
||||
iz = ix + iy*nX
|
||||
if iz < self.nCz:
|
||||
ax.text((ix+1)*(self.vectorNx[-1]-self.x0[0])-pad,(iy)*(self.vectorNy[-1]-self.x0[1])+pad,
|
||||
'#%i'%iz,color=annotationColor,verticalalignment='bottom',horizontalalignment='right',size='x-large')
|
||||
'#{0:d}'.format(iz),color=annotationColor,verticalalignment='bottom',horizontalalignment='right',size='x-large')
|
||||
|
||||
ax.set_title(vType)
|
||||
if showIt: plt.show()
|
||||
@@ -221,10 +221,10 @@ class TensorView(object):
|
||||
vTypeOpts = ['CC', 'CCv','N','F','E','Fx','Fy','Fz','E','Ex','Ey','Ez']
|
||||
|
||||
# Some user error checking
|
||||
assert vType in vTypeOpts, "vType must be in ['%s']" % "','".join(vTypeOpts)
|
||||
assert vType in vTypeOpts, "vType must be in ['{0!s}']".format("','".join(vTypeOpts))
|
||||
assert self.dim == 3, 'Must be a 3D mesh. Use plotImage.'
|
||||
assert view in viewOpts, "view must be in ['%s']" % "','".join(viewOpts)
|
||||
assert normal in normalOpts, "normal must be in ['%s']" % "','".join(normalOpts)
|
||||
assert view in viewOpts, "view must be in ['{0!s}']".format("','".join(viewOpts))
|
||||
assert normal in normalOpts, "normal must be in ['{0!s}']".format("','".join(normalOpts))
|
||||
assert type(grid) is bool, 'grid must be a boolean'
|
||||
|
||||
szSliceDim = getattr(self, 'nC'+normal.lower()) #: Size of the sliced dimension
|
||||
@@ -295,7 +295,7 @@ class TensorView(object):
|
||||
|
||||
ax.set_xlabel('y' if normal == 'X' else 'x')
|
||||
ax.set_ylabel('y' if normal == 'Z' else 'z')
|
||||
ax.set_title('Slice %d' % ind)
|
||||
ax.set_title('Slice {0:d}'.format(ind))
|
||||
return out
|
||||
|
||||
|
||||
@@ -316,11 +316,11 @@ class TensorView(object):
|
||||
vTypeOptsV = ['CCv','F','E']
|
||||
vTypeOpts = vTypeOptsCC + vTypeOptsV
|
||||
if view == 'vec':
|
||||
assert vType in vTypeOptsV, "vType must be in ['%s'] when view='vec'" % "','".join(vTypeOptsV)
|
||||
assert vType in vTypeOpts, "vType must be in ['%s']" % "','".join(vTypeOpts)
|
||||
assert vType in vTypeOptsV, "vType must be in ['{0!s}'] when view='vec'".format("','".join(vTypeOptsV))
|
||||
assert vType in vTypeOpts, "vType must be in ['{0!s}']".format("','".join(vTypeOpts))
|
||||
|
||||
viewOpts = ['real','imag','abs','vec']
|
||||
assert view in viewOpts, "view must be in ['%s']" % "','".join(viewOpts)
|
||||
assert view in viewOpts, "view must be in ['{0!s}']".format("','".join(viewOpts))
|
||||
|
||||
|
||||
if ax is None:
|
||||
|
||||
Reference in New Issue
Block a user