Migrated % string formating

This commit is contained in:
Cody
2016-07-21 12:08:19 -07:00
committed by Lindsey Heagy
parent 8093288391
commit 45f5906554
47 changed files with 190 additions and 190 deletions
+5 -5
View File
@@ -28,14 +28,14 @@ class RegularizationTests(unittest.TestCase):
for i, mesh in enumerate(self.meshlist):
print 'Testing %iD'%mesh.dim
print 'Testing {0:d}D'.format(mesh.dim)
mapping = r.mapPair(mesh)
reg = r(mesh, mapping=mapping)
m = np.random.rand(mapping.nP)
reg.mref = np.ones_like(m)*np.mean(m)
print 'Check: phi_m (mref) = %f' %reg.eval(reg.mref)
print 'Check: phi_m (mref) = {0:f}'.format(reg.eval(reg.mref))
passed = reg.eval(reg.mref) < TOL
self.assertTrue(passed)
@@ -56,7 +56,7 @@ class RegularizationTests(unittest.TestCase):
for i, mesh in enumerate(self.meshlist):
print 'Testing Active Cells %iD'%(mesh.dim)
print 'Testing Active Cells {0:d}D'.format((mesh.dim))
if mesh.dim == 1:
indActive = Utils.mkvc(mesh.gridCC <= 0.8)
@@ -70,7 +70,7 @@ class RegularizationTests(unittest.TestCase):
m = np.random.rand(mesh.nC)[indAct]
reg.mref = np.ones_like(m)*np.mean(m)
print 'Check: phi_m (mref) = %f' %reg.eval(reg.mref)
print 'Check: phi_m (mref) = {0:f}'.format(reg.eval(reg.mref))
passed = reg.eval(reg.mref) < TOL
self.assertTrue(passed)
@@ -87,7 +87,7 @@ class RegularizationTests(unittest.TestCase):
for i, mesh in enumerate(self.meshlist):
print 'Testing %iD'%mesh.dim
print 'Testing {0:d}D'.format(mesh.dim)
# mapping = r.mapPair(mesh)
# reg = r(mesh, mapping=mapping)
+3 -3
View File
@@ -14,9 +14,9 @@ class Doc_Test(unittest.TestCase):
html_path = os.path.sep.join(self.path_to_docs.split(os.path.sep) + ['_build']+['html'])
check = subprocess.call(["sphinx-build", "-nW", "-b", "html", "-d",
"%s"%(doctrees_path) ,
"%s"%(self.path_to_docs),
"%s"%(html_path)])
"{0!s}".format((doctrees_path)) ,
"{0!s}".format((self.path_to_docs)),
"{0!s}".format((html_path))])
assert check == 0
# def test_latex(self):
@@ -21,7 +21,7 @@ SrcList = ['RawVec', 'MagDipole'] #or 'MAgDipole_Bfield', 'CircularLoop', 'RawVe
def adjointTest(fdemType, comp):
prb = getFDEMProblem(fdemType, comp, SrcList, freq)
print 'Adjoint %s formulation - %s' % (fdemType, comp)
print 'Adjoint {0!s} formulation - {1!s}'.format(fdemType, comp)
m = np.log(np.ones(prb.mapping.nP)*CONDUCTIVITY)
mu = np.ones(prb.mesh.nC)*MU
@@ -21,7 +21,7 @@ SrcList = ['RawVec', 'MagDipole'] #or 'MAgDipole_Bfield', 'CircularLoop', 'RawVe
def adjointTest(fdemType, comp):
prb = getFDEMProblem(fdemType, comp, SrcList, freq)
print 'Adjoint %s formulation - %s' % (fdemType, comp)
print 'Adjoint {0!s} formulation - {1!s}'.format(fdemType, comp)
m = np.log(np.ones(prb.mapping.nP)*CONDUCTIVITY)
mu = np.ones(prb.mesh.nC)*MU
@@ -26,7 +26,7 @@ SrcType = ['MagDipole', 'RawVec'] #or 'MAgDipole_Bfield', 'CircularLoop', 'RawVe
def derivTest(fdemType, comp):
prb = getFDEMProblem(fdemType, comp, SrcType, freq)
print '%s formulation - %s' % (fdemType, comp)
print '{0!s} formulation - {1!s}'.format(fdemType, comp)
x0 = np.log(np.ones(prb.mapping.nP)*CONDUCTIVITY)
mu = np.log(np.ones(prb.mesh.nC)*MU)
+1 -1
View File
@@ -55,7 +55,7 @@ def halfSpaceProblemAnaDiff(meshType, sig_half=1e-2, rxOffset=50., bounds=None,
if showIt == True:
plt.loglog(rx.times[bz_calc>0], bz_calc[bz_calc>0], 'r', rx.times[bz_calc<0], -bz_calc[bz_calc<0], 'r--')
plt.loglog(rx.times, abs(bz_ana), 'b*')
plt.title('sig_half = %e'%sig_half)
plt.title('sig_half = {0:e}'.format(sig_half))
plt.show()
return log10diff
+1 -1
View File
@@ -25,7 +25,7 @@ class compareInitFiles(unittest.TestCase):
def get(test):
def test_func(self):
print '\nTesting %s.run(plotIt=False)\n'%test
print '\nTesting {0!s}.run(plotIt=False)\n'.format(test)
getattr(Examples, test).run(plotIt=False)
self.assertTrue(True)
return test_func
+3 -3
View File
@@ -121,7 +121,7 @@ class RichardsTests1D(unittest.TestCase):
tol = TOL*(10**int(np.log10(np.abs(zJv))))
passed = np.abs(vJz - zJv) < tol
print 'Richards Adjoint Test - PressureHead'
print '%4.4e === %4.4e, diff=%4.4e < %4.e'%(vJz, zJv,np.abs(vJz - zJv),tol)
print '{0:4.4e} === {1:4.4e}, diff={2:4.4e} < {3:4e}'.format(vJz, zJv, np.abs(vJz - zJv), tol)
self.assertTrue(passed,True)
def test_Sensitivity(self):
@@ -193,7 +193,7 @@ class RichardsTests2D(unittest.TestCase):
tol = TOL*(10**int(np.log10(np.abs(zJv))))
passed = np.abs(vJz - zJv) < tol
print '2D: Richards Adjoint Test - PressureHead'
print '%4.4e === %4.4e, diff=%4.4e < %4.e'%(vJz, zJv,np.abs(vJz - zJv),tol)
print '{0:4.4e} === {1:4.4e}, diff={2:4.4e} < {3:4e}'.format(vJz, zJv, np.abs(vJz - zJv), tol)
self.assertTrue(passed,True)
def test_Sensitivity(self):
@@ -265,7 +265,7 @@ class RichardsTests3D(unittest.TestCase):
tol = TOL*(10**int(np.log10(np.abs(zJv))))
passed = np.abs(vJz - zJv) < tol
print '3D: Richards Adjoint Test - PressureHead'
print '%4.4e === %4.4e, diff=%4.4e < %4.e'%(vJz, zJv,np.abs(vJz - zJv),tol)
print '{0:4.4e} === {1:4.4e}, diff={2:4.4e} < {3:4e}'.format(vJz, zJv, np.abs(vJz - zJv), tol)
self.assertTrue(passed,True)
def test_Sensitivity(self):