Skip to content

Commit

Permalink
fix tests, and python3 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jsenellart committed May 7, 2022
1 parent 440bf17 commit c407364
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions camfr/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class Rectangle:

def __init__(self, p1, p2, mat):
p = [p1, p2]
p.sort(sort_point)
p.sort(key=lambda p: p.x)
self.p1, self.p2 = p
self.mat = mat
self.type = "Rectangle"
Expand Down Expand Up @@ -210,7 +210,7 @@ class Triangle:

def __init__(self, p1, p2, p3, mat):
self.p = [p1, p2, p3]
self.p.sort(sort_point)
self.p.sort(key=lambda p: p.x)
self.p1, self.p2, self.p3 = self.p
self.mat = mat
self.type = "Triangle"
Expand Down
2 changes: 1 addition & 1 deletion testsuite/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def testfield(self):
print(f1, "expected", f_OK)
f1_pass = abs(f1 - f_OK) < eps.testing_eps

inc = zeros(N())
inc = np.zeros(N())
inc[1] = 1
stack.set_inc_field(inc)

Expand Down
2 changes: 1 addition & 1 deletion testsuite/fw_bw.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def testfw_bw(self):

s = Stack(s1(0)+s2(1)+s1(0))

inc = zeros(N())
inc = np.zeros(N())
inc[0] = 1
s.set_inc_field(inc)

Expand Down
2 changes: 1 addition & 1 deletion testsuite/metal_coupler.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_metal_coupler(self):

guided = 0
campmax = 0
for k in arange(0,nom,1):
for k in np.arange(0,nom,1):
camp = abs(waveguide.mode(k).field(Coord(d_sub+dclad+\
guide_thickness/2,0,0)).E1())
if campmax < camp:
Expand Down
10 changes: 5 additions & 5 deletions testsuite/metal_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ def testRT(self):

splitter.calc()

plot(cen)
plot(arm)
plot(ver)
#plot(cen)
#plot(arm)
#plot(ver)

inc = zeros(N())
inc = np.zeros(N())
inc[0] = 1
splitter.set_inc_field(inc)

plot(splitter)
#plot(splitter)

R = splitter.R12(0,0)
R_OK = 0.844654989543+0.499289083195j
Expand Down
4 changes: 2 additions & 2 deletions testsuite/planar_VCSEL.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def testRT(self):

vcsel = Stack(bottom + cavity + top)

incL = zeros(N())
incR = zeros(N())
incL = np.zeros(N())
incR = np.zeros(N())
incR[0] = 1
vcsel.set_inc_field(incL,incR)

Expand Down
2 changes: 1 addition & 1 deletion testsuite/stack1.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def teststack1(self):

s = Stack(wg(0) + gap(1) + wg(0))

inc = zeros(N())
inc = np.zeros(N())
inc[0] = 1
s.set_inc_field(inc)

Expand Down
6 changes: 3 additions & 3 deletions testsuite/taper.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def testtaper(self):

s_inf = InfStack(e_inf)

rx = arange(0.0, (x_periods+1)*a, a/10.)
rz = arange(0.0, s.length(), a/10.)
rx = np.arange(0.0, (x_periods+1)*a, a/10.)
rz = np.arange(0.0, s.length(), a/10.)

taper = Stack(e + s_inf)

Expand All @@ -79,7 +79,7 @@ def testtaper(self):

taper.calc()

inc=zeros(N())
inc=np.zeros(N())
inc[0]=1
taper.set_inc_field(inc)

Expand Down
8 changes: 4 additions & 4 deletions testsuite/w1reson.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class w1reson(unittest.TestCase):
def create_w1_period(self,period,rad,periods,topbuf,matcore,matclad):
tussen=sqrt(3)/2 *period
tussen2 = sqrt(3)*period
numodd = periods/2
numeven = (periods+1)/2
numodd = int(periods/2)
numeven = int((periods+1)/2)
propstart,propend,propprec = 0,2*rad+period/2,period/5
transstart,transend,transprec = 0,tussen*periods+rad+topbuf,period/5
gi = Geometry(matcore)
Expand All @@ -29,8 +29,8 @@ def create_w1_period(self,period,rad,periods,topbuf,matcore,matclad):
def create_w1_1def_period(self,period,rad,defrad,periods,topbuf,matcore,matclad):
tussen=sqrt(3)/2 *period
tussen2 = sqrt(3)*period
numodd = periods/2
numeven = (periods+1)/2
numodd = int(periods/2)
numeven = int((periods+1)/2)
propstart,propend,propprec = 0,2*rad+period/2,period/30
transstart,transend,transprec = 0,tussen*periods+rad+topbuf,period/30
gi = Geometry(matcore)
Expand Down

0 comments on commit c407364

Please sign in to comment.