Skip to content

Commit fc002f8

Browse files
committed
fixes for move to python3 and change of python_packages location
1 parent 7fbcbe0 commit fc002f8

22 files changed

Lines changed: 64 additions & 61 deletions

examples/diode/diode_1d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from devsim import *
16-
from python_packages.simple_physics import *
16+
from devsim.python_packages.simple_physics import *
1717
import diode_common
1818
#####
1919
# dio1

examples/diode/diode_2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from devsim import *
16-
from python_packages.simple_physics import *
16+
from devsim.python_packages.simple_physics import *
1717
import diode_common
1818

1919
# dio1

examples/diode/diode_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from devsim import *
16-
from python_packages.simple_physics import *
16+
from devsim.python_packages.simple_physics import *
1717
#####
1818
# dio1
1919
#

examples/diode/gmsh_diode2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from devsim import *
16-
from python_packages.simple_physics import *
16+
from devsim.python_packages.simple_physics import *
1717
import diode_common
1818

1919
device="diode2d"

examples/diode/gmsh_diode3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from devsim import *
16-
from python_packages.simple_physics import *
16+
from devsim.python_packages.simple_physics import *
1717
import diode_common
1818

1919
device="diode3d"

examples/diode/gmsh_diode3d_equil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# this test added specifically to create a mesh for gmsh_diode3d_equil.py
1616

1717
from devsim import *
18-
from python_packages.simple_physics import *
18+
from devsim.python_packages.simple_physics import *
1919
import diode_common
2020

2121
device="diode3d"

examples/diode/laux2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import numpy
3939
import numpy.linalg
4040
except:
41-
print "numpy is not available with your installation and is not being run"
41+
print("numpy is not available with your installation and is not being run")
4242
sys.exit(-1)
4343

4444

examples/diode/laux3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import numpy
3939
import numpy.linalg
4040
except:
41-
print "numpy is not available with your installation and is not being run"
41+
print("numpy is not available with your installation and is not being run")
4242
sys.exit(-1)
4343

4444

examples/diode/laux_common.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@
3333
# address = {Riverton, NJ, USA},
3434
#}
3535

36+
# handle the new way of integer division
37+
from __future__ import division
38+
3639
import sys
3740
try:
3841
import numpy
3942
import numpy.linalg
4043
except:
41-
print "numpy is not available with your installation and is not being run"
44+
print("numpy is not available with your installation and is not being run")
4245
sys.exit(0)
4346

4447

@@ -295,44 +298,44 @@ def SetupOutputCompare(device, region, model, variable, output):
295298
for i in range(dim):
296299
mname = "ElectricField_" + directions[i]
297300
output[:,k] = numpy.array(get_element_model_values(device=device, region=region, name=mname))
298-
print "%d %s" % (k, mname)
301+
print("%d %s" % (k, mname))
299302
k += 1
300303
for j in range(nen):
301304
for i in range(dim):
302305
mname = "ElectricField_" + directions[i]
303306
dname = mname + ":Potential@en%d" % j
304307
output[:,k] = numpy.array(get_element_model_values(device=device, region=region, name=dname))
305-
print "%d %s" % (k, dname)
308+
print("%d %s" % (k, dname))
306309
k += 1
307310

308311
def DoCompare(output, output_compare, number_test):
309312
test2 = output[0:nee*number_test] - output_compare[0:nee*number_test]
310-
print numpy.linalg.norm(test2, ord=numpy.inf )
313+
print(numpy.linalg.norm(test2, ord=numpy.inf ))
311314
for row in range(number_test):
312315
for col in range(5):
313316
sl1 = slice(nee*row,nee*(row+1))
314317
sl2 = slice(dim*col,dim*(col+1))
315318
norm = numpy.linalg.norm(output[(sl1, sl2)]-output_compare[(sl1,sl2)])
316319
if norm > 1e-4:
317-
print "%d %d %g" % (row, col, norm)
320+
print("%d %d %g" % (row, col, norm))
318321

319322
row = 0
320323
if True:
321324
#for row in range(10):
322325
col = 0
323326
sl1 = slice(nee*row,nee*(row+1))
324327
sl2 = slice(dim*col,dim*(col+1))
325-
print output[(sl1, sl2)]
326-
print output_compare[(sl1,sl2)]
327-
print output[(sl1, sl2)] - output_compare[(sl1,sl2)]
328+
print(output[(sl1, sl2)])
329+
print(output_compare[(sl1,sl2)])
330+
print(output[(sl1, sl2)] - output_compare[(sl1,sl2)])
328331

329332
def RunTest(device, region, number_test):
330333
scalar_efield = GetScalarField(device, region, "scalar_efield", "ElectricField")
331334
scalar_efield_derivatives = GetScalarFieldDerivatives(device, region, "scalar_efield_n", "ElectricField", "Potential")
332335
node_indexes = GetNodeIndexes(device, region)
333336
unit_vectors = GetUnitVectors(device, region)
334337

335-
number_elements = len(scalar_efield)/nee
338+
number_elements = len(scalar_efield)//nee
336339

337340
if number_test < 1:
338341
number_test = number_elements

examples/diode/pythonmesh3d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from devsim import *
2-
import python_packages.pythonmesh
2+
import devsim.python_packages.pythonmesh
33

44

55
def gmsh_reader(mesh, device, filename="", coordinates="", physical_names="", elements=""):
@@ -13,7 +13,7 @@ def gmsh_reader(mesh, device, filename="", coordinates="", physical_names="", el
1313
finalize_mesh (mesh=mesh)
1414
create_device (mesh=mesh, device=device)
1515

16-
data = python_packages.pythonmesh.read_gmsh_file("gmsh_diode3d.msh")
16+
data = devsim.python_packages.pythonmesh.read_gmsh_file("gmsh_diode3d.msh")
1717
coordinates=data['coordinates']
1818
elements=data['elements']
1919
physical_names=data['physical_names']

0 commit comments

Comments
 (0)