ElectroMagneticPython 2.1.4__tar.gz → 2.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/RCWA.py +0 -8
  2. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/__init__.py +0 -4
  3. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/devices.py +0 -1
  4. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/materials.py +0 -1
  5. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/modesolvers/FD.py +1 -15
  6. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/modesolvers/FMM.py +0 -57
  7. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/modesolvers/geometries.py +0 -2
  8. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/modesolvers/interface.py +0 -2
  9. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/transfer_matrix.py +4 -9
  10. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/utils.py +0 -6
  11. ElectroMagneticPython-2.1.5/EMpy/version.py +1 -0
  12. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/ElectroMagneticPython.egg-info/PKG-INFO +5 -2
  13. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/PKG-INFO +5 -2
  14. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/requirements.txt +12 -14
  15. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/setup.py +1 -1
  16. ElectroMagneticPython-2.1.4/EMpy/version.py +0 -1
  17. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/constants.py +0 -0
  18. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/modesolvers/__init__.py +0 -0
  19. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/EMpy/scattering.py +0 -0
  20. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/ElectroMagneticPython.egg-info/SOURCES.txt +0 -0
  21. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/ElectroMagneticPython.egg-info/dependency_links.txt +0 -0
  22. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/ElectroMagneticPython.egg-info/requires.txt +0 -0
  23. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/ElectroMagneticPython.egg-info/top_level.txt +0 -0
  24. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/LICENSE +0 -0
  25. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/MANIFEST.in +0 -0
  26. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/README.rst +0 -0
  27. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_APRR.py +0 -0
  28. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_NRR.py +0 -0
  29. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_RCWA.py +0 -0
  30. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_RCWA_2.py +0 -0
  31. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_RCWA_3.py +0 -0
  32. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_SRR.py +0 -0
  33. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_laser_etch_monitor.py +0 -0
  34. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_modesolver.py +0 -0
  35. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_modesolver_2.py +0 -0
  36. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_modesolver_3.py +0 -0
  37. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_modesolver_4.py +0 -0
  38. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_modesolver_dch.py +0 -0
  39. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_modesolver_dch_anis.py +0 -0
  40. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_transfer_matrix.py +0 -0
  41. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_transfer_matrix_2.py +0 -0
  42. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/ex_transfer_matrix_3.py +0 -0
  43. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/lc_data.dat +0 -0
  44. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/examples/nk.py +0 -0
  45. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/setup.cfg +0 -0
  46. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/tests/__init__.py +0 -0
  47. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/tests/materials_test.py +0 -0
  48. {ElectroMagneticPython-2.1.4 → ElectroMagneticPython-2.1.5}/tests/utils_test.py +0 -0
@@ -68,7 +68,6 @@ def dispersion_relation_extraordinary(kx, ky, k, nO, nE, c):
68
68
  kz = S.empty_like(kx)
69
69
 
70
70
  for ii in range(0, kx.size):
71
-
72
71
  alpha = nE**2 - nO**2
73
72
  beta = kx[ii] / k * c[0] + ky[ii] / k * c[1]
74
73
 
@@ -234,7 +233,6 @@ class IsotropicRCWA(RCWA):
234
233
  dlt = (i == 0).astype(int)
235
234
 
236
235
  for iwl, wl in enumerate(self.wls):
237
-
238
236
  # free space wavevector
239
237
  k = 2 * pi / wl
240
238
 
@@ -287,7 +285,6 @@ class IsotropicRCWA(RCWA):
287
285
  MTp1.fill(0.0)
288
286
  MTp2.fill(0.0)
289
287
  for nlayer in range(nlayers - 2, 0, -1): # internal layers
290
-
291
288
  layer = multilayer[nlayer]
292
289
  d = layer.thickness
293
290
 
@@ -315,13 +312,11 @@ class IsotropicRCWA(RCWA):
315
312
  A = S.diag((kx / k) ** 2) - E
316
313
 
317
314
  if S.absolute(K[2] / k) > 1e-10:
318
-
319
315
  raise ValueError(
320
316
  "First Order Helmholtz Operator not implemented, yet!"
321
317
  )
322
318
 
323
319
  elif ky == 0 or S.allclose(S.diag(Ky / ky * k), 1):
324
-
325
320
  # lalanne
326
321
  # H_U_reduced = S.dot(Ky, Ky) + A
327
322
  H_U_reduced = (ky / k) ** 2 * I + A
@@ -395,7 +390,6 @@ class IsotropicRCWA(RCWA):
395
390
  )
396
391
 
397
392
  else:
398
-
399
393
  ValueError("Second Order Helmholtz Operator not implemented, yet!")
400
394
 
401
395
  # M = S.asarray(S.bmat([-MR, MT]))
@@ -516,7 +510,6 @@ class AnisotropicRCWA(RCWA):
516
510
  dlt = (i == 0).astype(int)
517
511
 
518
512
  for iwl, wl in enumerate(self.wls):
519
-
520
513
  nO1 = nE1 = multilayer[0].mat.n(wl).item()
521
514
  nO3 = nE3 = multilayer[-1].mat.n(wl).item()
522
515
 
@@ -653,7 +646,6 @@ class AnisotropicRCWA(RCWA):
653
646
  M.fill(0.0)
654
647
 
655
648
  for nlayer in range(nlayers - 2, 0, -1): # internal layers
656
-
657
649
  layer = multilayer[nlayer]
658
650
  thickness = layer.thickness
659
651
 
@@ -22,8 +22,6 @@ __all__ = [
22
22
  ]
23
23
  __author__ = "Lorenzo Bolla"
24
24
 
25
- from numpy.testing import Tester # type: ignore
26
-
27
25
  from . import constants
28
26
  from . import devices
29
27
  from . import materials
@@ -35,5 +33,3 @@ from . import utils
35
33
  from .version import version
36
34
 
37
35
  __version__ = version
38
-
39
- test = Tester().test
@@ -1297,7 +1297,6 @@ class SWG(Device):
1297
1297
  pf400_225 = [1.255208385485759e-007, -1.784557912270417e-003, 4.737972109281652e000]
1298
1298
 
1299
1299
  def __init__(self, w, h, T):
1300
-
1301
1300
  self.w = w
1302
1301
  self.h = h # not used!
1303
1302
  self.T = T
@@ -90,7 +90,6 @@ class RefractiveIndex:
90
90
  def __init__(
91
91
  self, n0_const=None, n0_poly=None, n0_smcoeffs=None, n0_known=None, n0_func=None
92
92
  ):
93
-
94
93
  if n0_const is not None:
95
94
  self.get_rix = partial(self.__from_const, n0_const)
96
95
 
@@ -88,7 +88,6 @@ class SVFDModeSolver(ModeSolver):
88
88
  return eps
89
89
 
90
90
  def build_matrix(self):
91
-
92
91
  from scipy.sparse import coo_matrix
93
92
 
94
93
  wl = self.wl
@@ -134,7 +133,6 @@ class SVFDModeSolver(ModeSolver):
134
133
  # three methods: Ex, Ey and scalar
135
134
 
136
135
  if method == "Ex":
137
-
138
136
  # Ex
139
137
 
140
138
  An = 2 / n / (n + s)
@@ -164,7 +162,6 @@ class SVFDModeSolver(ModeSolver):
164
162
  Ap = ep * k**2 - An - As - Ae * ep / ee - Aw * ep / ew
165
163
 
166
164
  elif method == "Ey":
167
-
168
165
  # Ey
169
166
 
170
167
  An = (
@@ -194,7 +191,6 @@ class SVFDModeSolver(ModeSolver):
194
191
  Ap = ep * k**2 - An * ep / en - As * ep / es - Ae - Aw
195
192
 
196
193
  elif method == "scalar":
197
-
198
194
  # scalar
199
195
 
200
196
  An = 2 / n / (n + s)
@@ -204,7 +200,6 @@ class SVFDModeSolver(ModeSolver):
204
200
  Ap = ep * k**2 - An - As - Ae - Aw
205
201
 
206
202
  else:
207
-
208
203
  raise ValueError("unknown method")
209
204
 
210
205
  ii = numpy.arange(nx * ny).reshape(nx, ny)
@@ -260,7 +255,6 @@ class SVFDModeSolver(ModeSolver):
260
255
  return A
261
256
 
262
257
  def solve(self, neigs, tol):
263
-
264
258
  from scipy.sparse.linalg import eigen
265
259
 
266
260
  self.nmodes = neigs
@@ -388,7 +382,6 @@ class VFDModeSolver(ModeSolver):
388
382
  return epsxx, epsxy, epsyx, epsyy, epszz
389
383
 
390
384
  def build_matrix(self):
391
-
392
385
  from scipy.sparse import coo_matrix
393
386
 
394
387
  wl = self.wl
@@ -814,7 +807,6 @@ class VFDModeSolver(ModeSolver):
814
807
  return A
815
808
 
816
809
  def compute_other_fields(self, neffs, Hxs, Hys):
817
-
818
810
  from scipy.sparse import coo_matrix
819
811
 
820
812
  wl = self.wl
@@ -827,7 +819,6 @@ class VFDModeSolver(ModeSolver):
827
819
  Eys = []
828
820
  Ezs = []
829
821
  for neff, Hx, Hy in zip(neffs, Hxs, Hys):
830
-
831
822
  dx = numpy.diff(x)
832
823
  dy = numpy.diff(y)
833
824
 
@@ -2123,7 +2114,7 @@ class VFDModeSolver(ModeSolver):
2123
2114
  [Hzs, Exs, Eys, Ezs] = self.compute_other_fields(neffs, Hxs, Hys)
2124
2115
 
2125
2116
  self.modes = []
2126
- for (neff, Hx, Hy, Hz, Ex, Ey, Ez) in zip(neffs, Hxs, Hys, Hzs, Exs, Eys, Ezs):
2117
+ for neff, Hx, Hy, Hz, Ex, Ey, Ez in zip(neffs, Hxs, Hys, Hzs, Exs, Eys, Ezs):
2127
2118
  self.modes.append(
2128
2119
  FDMode(
2129
2120
  self.wl, self.x, self.y, neff, Ex, Ey, Ez, Hx, Hy, Hz
@@ -2165,7 +2156,6 @@ class FDMode(Mode):
2165
2156
  return numpy.linspace(self.y[0], self.y[-1], n)
2166
2157
 
2167
2158
  def get_field(self, fname, x=None, y=None):
2168
-
2169
2159
  if fname == "Ex":
2170
2160
  f = self.Ex
2171
2161
  centered = True
@@ -2246,7 +2236,6 @@ class FDMode(Mode):
2246
2236
  return self
2247
2237
 
2248
2238
  def overlap(self, m, x=None, y=None):
2249
-
2250
2239
  x1 = EMpy.utils.centered1d(self.x)
2251
2240
  y1 = EMpy.utils.centered1d(self.y)
2252
2241
 
@@ -2423,7 +2412,6 @@ class FDMode(Mode):
2423
2412
 
2424
2413
 
2425
2414
  def stretchmesh(x, y, nlayers, factor, method="PPPP"):
2426
-
2427
2415
  # OKKIO: check me!
2428
2416
 
2429
2417
  # This function can be used to continuously stretch the grid
@@ -2479,9 +2467,7 @@ def stretchmesh(x, y, nlayers, factor, method="PPPP"):
2479
2467
  factor *= numpy.ones(4)
2480
2468
 
2481
2469
  for idx, (n, f, m) in enumerate(zip(nlayers, factor, method.upper())):
2482
-
2483
2470
  if n > 0 and f != 1:
2484
-
2485
2471
  if idx == 0:
2486
2472
  # north boundary
2487
2473
  kv = numpy.arange(len(y) - 1 - n, len(y))
@@ -342,14 +342,12 @@ class FMMMode2d(Mode):
342
342
  cBzTM = numpy.zeros_like(ExTE)
343
343
 
344
344
  for mx, slice in enumerate(self.slicesx):
345
-
346
345
  idx = numpy.where((slice.x1 <= x) & (x < slice.x2))
347
346
  x2 = x[idx] - slice.x1
348
347
  x1 = slice.x2 - x[idx]
349
348
  dx = slice.x2 - slice.x1
350
349
 
351
350
  for n in range(nmodi):
352
-
353
351
  fi = slice.modih[n].eval(y)
354
352
  fidot = dot(slice.modih[n]).eval(y)
355
353
 
@@ -501,7 +499,6 @@ class FMMMode2d(Mode):
501
499
  return cSz
502
500
 
503
501
  def TEfrac_old(self, x_=None, y_=None):
504
-
505
502
  if x_ is None:
506
503
  x = self.get_x()
507
504
  else:
@@ -517,12 +514,10 @@ class FMMMode2d(Mode):
517
514
  return numpy.abs(cSTE) / (numpy.abs(cSTE) + numpy.abs(cSTM))
518
515
 
519
516
  def TEfrac(self):
520
-
521
517
  Sx, Sy = self.__overlap(self)
522
518
  return Sx / (Sx - Sy)
523
519
 
524
520
  def overlap_old(self, m, x_=None, y_=None):
525
-
526
521
  if x_ is None:
527
522
  x = self.get_x()
528
523
  else:
@@ -545,7 +540,6 @@ class FMMMode2d(Mode):
545
540
  )
546
541
 
547
542
  def __overlap_old(self, mode):
548
-
549
543
  nmodi = len(self.modie)
550
544
  k0 = 2.0 * numpy.pi / self.slicesx[0].wl
551
545
  kz = self.keff
@@ -554,9 +548,7 @@ class FMMMode2d(Mode):
554
548
  Sy = 0j
555
549
 
556
550
  for mx, slice in enumerate(self.slicesx):
557
-
558
551
  for n1 in range(nmodi):
559
-
560
552
  phi_n1 = slice.modih[n1]
561
553
  # phidot_n1 = dot(phi_n1)
562
554
 
@@ -587,7 +579,6 @@ class FMMMode2d(Mode):
587
579
  uedot_n1 = dot(ue_n1)
588
580
 
589
581
  for n2 in range(nmodi):
590
-
591
582
  phi_n2 = mode.slicesx[mx].modih[n2]
592
583
  phidot_n2 = dot(phi_n2)
593
584
 
@@ -637,7 +628,6 @@ class FMMMode2d(Mode):
637
628
  return (Sx, Sy)
638
629
 
639
630
  def __overlap(self, mode):
640
-
641
631
  nmodi = len(self.modie)
642
632
  k0 = 2.0 * numpy.pi / self.slicesx[0].wl
643
633
  kz = self.keff
@@ -646,7 +636,6 @@ class FMMMode2d(Mode):
646
636
  Sy = 0j
647
637
 
648
638
  for mx, slice in enumerate(self.slicesx):
649
-
650
639
  phi_n1s = []
651
640
  phidot_n1s = []
652
641
  psi_n1s = []
@@ -672,7 +661,6 @@ class FMMMode2d(Mode):
672
661
  kfh_n2s = []
673
662
 
674
663
  for n1 in range(nmodi):
675
-
676
664
  phi_n1 = slice.modih[n1]
677
665
  phi_n1s.append(phi_n1)
678
666
  phidot_n1s.append(dot(phi_n1))
@@ -744,7 +732,6 @@ class FMMMode2d(Mode):
744
732
  uedot_n2s.append(dot(ue_n2))
745
733
 
746
734
  for n1 in range(nmodi):
747
-
748
735
  uh_n1 = uh_n1s[n1]
749
736
  ue_n1 = ue_n1s[n1]
750
737
  uedot_n1 = uedot_n1s[n1]
@@ -755,7 +742,6 @@ class FMMMode2d(Mode):
755
742
  kfe_n1 = kfe_n1s[n1]
756
743
 
757
744
  for n2 in range(nmodi):
758
-
759
745
  uh_n2 = uh_n2s[n2]
760
746
  uhdot_n2 = uhdot_n2s[n2]
761
747
  ue_n2 = ue_n2s[n2]
@@ -784,16 +770,13 @@ class FMMMode2d(Mode):
784
770
  return (Sx, Sy)
785
771
 
786
772
  def overlap(self, mode):
787
-
788
773
  Sx, Sy = self.__overlap(mode)
789
774
  return Sx - Sy
790
775
 
791
776
  def norm(self):
792
-
793
777
  return scipy.sqrt(self.overlap(self))
794
778
 
795
779
  def normalize(self):
796
-
797
780
  n = self.norm()
798
781
  for ue, uh in zip(self.modie, self.modih):
799
782
  ue.sl /= n
@@ -850,7 +833,6 @@ class FMMMode2d(Mode):
850
833
  return (Ex_FDTD, Ey_FDTD, Ez_FDTD, Hx_FDTD, Hy_FDTD, Hz_FDTD)
851
834
 
852
835
  def plot(self, x_=None, y_=None):
853
-
854
836
  if x_ is None:
855
837
  x = self.get_x()
856
838
  else:
@@ -995,7 +977,6 @@ class FMM2d(FMM):
995
977
 
996
978
 
997
979
  def analyticalsolution(nmodi, TETM, FMMpars):
998
-
999
980
  betay = FMMpars["beta"]
1000
981
  epsilon = FMMpars["epsilon"]
1001
982
  Uy = FMMpars["Uy"]
@@ -1089,7 +1070,6 @@ def sinxsux(x):
1089
1070
 
1090
1071
 
1091
1072
  def FMMshootingTM(kz_, FMMpars):
1092
-
1093
1073
  betay = FMMpars["beta"]
1094
1074
  eps = FMMpars["epsilon"]
1095
1075
  Uy = FMMpars["Uy"]
@@ -1138,14 +1118,12 @@ def FMMshootingTM(kz_, FMMpars):
1138
1118
  modo = FMMMode1dy()
1139
1119
 
1140
1120
  for m in range(0, len(kz)):
1141
-
1142
1121
  k = k_[m, :]
1143
1122
  sinkdsuk = sinkdsuk_[m, :][0]
1144
1123
  coskd = coskd_[m, :][0]
1145
1124
  sinkdk = sinkdk_[m, :][0]
1146
1125
 
1147
1126
  for idx in range(0, n1):
1148
-
1149
1127
  sr[idx] = sl[idx] * coskd[idx] + al[idx] * sinkdsuk[idx]
1150
1128
  ar[idx] = al[idx] * coskd[idx] - sl[idx] * sinkdk[idx]
1151
1129
 
@@ -1156,7 +1134,6 @@ def FMMshootingTM(kz_, FMMpars):
1156
1134
  # *******************
1157
1135
 
1158
1136
  for idx1 in range(Nregions - 1, n2 - 2, -1):
1159
-
1160
1137
  sl[idx1] = sr[idx1] * coskd[idx1] - ar[idx1] * sinkdsuk[idx1]
1161
1138
  al[idx1] = ar[idx1] * coskd[idx1] + sr[idx1] * sinkdk[idx1]
1162
1139
 
@@ -1172,7 +1149,6 @@ def FMMshootingTM(kz_, FMMpars):
1172
1149
  )
1173
1150
 
1174
1151
  if len(kz) < 2:
1175
-
1176
1152
  # normalize and save only if len(kz) == 1
1177
1153
  # otherwise, modo is ignored and only Delta is useful
1178
1154
 
@@ -1197,7 +1173,6 @@ def FMMshootingTM(kz_, FMMpars):
1197
1173
 
1198
1174
 
1199
1175
  def FMMshooting(kz_, FMMpars):
1200
-
1201
1176
  betay = FMMpars["beta"]
1202
1177
  Uy = FMMpars["Uy"]
1203
1178
  by = FMMpars["boundary"]
@@ -1245,14 +1220,12 @@ def FMMshooting(kz_, FMMpars):
1245
1220
  modo = FMMMode1dy()
1246
1221
 
1247
1222
  for m in range(0, len(kz)):
1248
-
1249
1223
  k = k_[m, :]
1250
1224
  sinkdsuk = sinkdsuk_[m, :][0]
1251
1225
  coskd = coskd_[m, :][0]
1252
1226
  sinkdk = sinkdk_[m, :][0]
1253
1227
 
1254
1228
  for idx in range(0, n1):
1255
-
1256
1229
  sr[idx] = sl[idx] * coskd[idx] + al[idx] * sinkdsuk[idx]
1257
1230
  ar[idx] = al[idx] * coskd[idx] - sl[idx] * sinkdk[idx]
1258
1231
 
@@ -1263,7 +1236,6 @@ def FMMshooting(kz_, FMMpars):
1263
1236
  # *******************
1264
1237
 
1265
1238
  for idx1 in range(Nregions - 1, n2 - 2, -1):
1266
-
1267
1239
  sl[idx1] = sr[idx1] * coskd[idx1] - ar[idx1] * sinkdsuk[idx1]
1268
1240
  al[idx1] = ar[idx1] * coskd[idx1] + sr[idx1] * sinkdk[idx1]
1269
1241
 
@@ -1317,7 +1289,6 @@ def FMMshooting(kz_, FMMpars):
1317
1289
  # compiler = 'gcc')
1318
1290
 
1319
1291
  if len(kz) < 2:
1320
-
1321
1292
  # normalize and save only if len(kz) == 1
1322
1293
  # otherwise, modo is ignored and only Delta is useful
1323
1294
 
@@ -1343,7 +1314,6 @@ def FMMshooting(kz_, FMMpars):
1343
1314
 
1344
1315
 
1345
1316
  def remove_consecutives(x, y):
1346
-
1347
1317
  b = numpy.r_[numpy.diff(x) == 1, 0].astype(int)
1348
1318
 
1349
1319
  ic = 0
@@ -1373,7 +1343,6 @@ def remove_consecutives(x, y):
1373
1343
 
1374
1344
 
1375
1345
  def findzerosnew(x, y, searchinterval):
1376
-
1377
1346
  minsi = 2 * numpy.abs(x[1] - x[0])
1378
1347
  if searchinterval < minsi:
1379
1348
  searchinterval = minsi
@@ -1413,7 +1382,6 @@ def findzerosnew(x, y, searchinterval):
1413
1382
 
1414
1383
 
1415
1384
  def absfzzero2(t, f, xmin, xmax, ymin, ymax):
1416
-
1417
1385
  xmean = numpy.mean([xmin, xmax])
1418
1386
  ymean = numpy.mean([ymin, ymax])
1419
1387
  xwidth = xmax - xmin
@@ -1426,7 +1394,6 @@ def absfzzero2(t, f, xmin, xmax, ymin, ymax):
1426
1394
 
1427
1395
 
1428
1396
  def fzzeroabs2(f, zmin, zmax):
1429
-
1430
1397
  xmin = numpy.real(zmin)
1431
1398
  ymin = numpy.imag(zmin)
1432
1399
  xmax = numpy.real(zmax)
@@ -1459,7 +1426,6 @@ def fzzeroabs2(f, zmin, zmax):
1459
1426
 
1460
1427
 
1461
1428
  def scalarprod(modo1, modo2):
1462
-
1463
1429
  d = numpy.diff(modo1.U)
1464
1430
 
1465
1431
  ky1 = modo1.k
@@ -1478,7 +1444,6 @@ def scalarprod(modo1, modo2):
1478
1444
  scprod = numpy.zeros_like(modo1.sl)
1479
1445
 
1480
1446
  for idy in range(Nlayers):
1481
-
1482
1447
  if numpy.allclose(ky1[idy], ky2[idy]):
1483
1448
  if numpy.linalg.norm(ky1) < 1e-10:
1484
1449
  scprod[idy] = sl1[idy] * sl2[idy] * (modo1.U[idy + 1] - modo1.U[idy])
@@ -1505,7 +1470,6 @@ def scalarprod(modo1, modo2):
1505
1470
 
1506
1471
 
1507
1472
  def sueps(modo):
1508
-
1509
1473
  eps = modo.pars["epsilon"]
1510
1474
  modosueps = copy.deepcopy(modo)
1511
1475
  modosueps.sl /= eps
@@ -1517,7 +1481,6 @@ def sueps(modo):
1517
1481
 
1518
1482
 
1519
1483
  def FMM1d_y(Uy, ny, wl, nmodi, boundaryRL, TETM, verbosity=0):
1520
-
1521
1484
  k0 = 2 * numpy.pi / wl
1522
1485
  betay = ny * k0
1523
1486
  Nstepskz = 1543
@@ -1592,7 +1555,6 @@ def FMM1d_y(Uy, ny, wl, nmodi, boundaryRL, TETM, verbosity=0):
1592
1555
  # inizia il ciclo sugli intervalli
1593
1556
  Message("Refine zeros.", 2).show(verbosity)
1594
1557
  for m in range(0, len(kz1)):
1595
-
1596
1558
  if mk == nmodi:
1597
1559
  break
1598
1560
  if TETM == "TM":
@@ -1629,7 +1591,6 @@ def FMM1d_y(Uy, ny, wl, nmodi, boundaryRL, TETM, verbosity=0):
1629
1591
 
1630
1592
 
1631
1593
  def script1d(Ux, Uy, refindex, wl, boundary, nmodislices, verbosity=0):
1632
-
1633
1594
  nx = refindex.shape[0]
1634
1595
  slices = []
1635
1596
  for m in range(nx):
@@ -1654,7 +1615,6 @@ def script1d(Ux, Uy, refindex, wl, boundary, nmodislices, verbosity=0):
1654
1615
 
1655
1616
 
1656
1617
  def dot(modo):
1657
-
1658
1618
  k = modo.k
1659
1619
  mododot = copy.deepcopy(modo)
1660
1620
  mododot.sl = modo.al
@@ -1665,7 +1625,6 @@ def dot(modo):
1665
1625
 
1666
1626
 
1667
1627
  def genera_rotazione(slices):
1668
-
1669
1628
  nmodi = len(slices[0].modih)
1670
1629
  k0 = 2 * numpy.pi / slices[0].wl
1671
1630
  Nslices = len(slices)
@@ -1722,7 +1681,6 @@ def genera_rotazione(slices):
1722
1681
 
1723
1682
 
1724
1683
  def ortonormalita(slices):
1725
-
1726
1684
  nmodi = len(slices[0].modih)
1727
1685
  k0 = 2 * numpy.pi / slices[0].wl
1728
1686
  Nslices = len(slices)
@@ -1741,7 +1699,6 @@ def ortonormalita(slices):
1741
1699
  M.Rhe = numpy.zeros_like(M.ee)
1742
1700
 
1743
1701
  for idx, slice in enumerate(slices):
1744
-
1745
1702
  for n in range(nmodi):
1746
1703
  Fhn = slice.modih[n]
1747
1704
  Fen = slice.modie[n]
@@ -1787,7 +1744,6 @@ def ortonormalita(slices):
1787
1744
 
1788
1745
 
1789
1746
  def method_of_component(kz_, slices, Rot, uscelto=None, icomp=None):
1790
-
1791
1747
  kz = numpy.atleast_1d(kz_)
1792
1748
  abscomp = numpy.zeros(len(kz))
1793
1749
  # tmp = 500 # OKKIO: perche' 500?
@@ -1815,7 +1771,6 @@ def method_of_component(kz_, slices, Rot, uscelto=None, icomp=None):
1815
1771
 
1816
1772
 
1817
1773
  def creaTeThSeSh(kz, slices):
1818
-
1819
1774
  Nslices = len(slices)
1820
1775
  nmodi = len(slices[0].modie)
1821
1776
  d = numpy.array([s.x2 - s.x1 for s in slices])
@@ -1874,7 +1829,6 @@ def creaTeThSeSh(kz, slices):
1874
1829
 
1875
1830
 
1876
1831
  def Mvec(kz, slices, R):
1877
-
1878
1832
  Nslices = len(slices)
1879
1833
  Rhh = R.Rhh
1880
1834
  Ree = R.Ree
@@ -1897,7 +1851,6 @@ def Mvec(kz, slices, R):
1897
1851
  Dim1 = numpy.arange(dim1)
1898
1852
 
1899
1853
  for idx in range(3, Nslices):
1900
-
1901
1854
  idxeJA = (2 * idx - 4) * dim1
1902
1855
  idxeJB = (2 * idx - 6) * dim1
1903
1856
  idxeJC = (2 * idx - 2) * dim1
@@ -2052,7 +2005,6 @@ def Mvec(kz, slices, R):
2052
2005
 
2053
2006
 
2054
2007
  def check_matching(kz, slices, modo, R):
2055
-
2056
2008
  Te, Th, Se, Sh, Teleft, Teright, Thleft, Thright = creaTeThSeSh(kz, slices)
2057
2009
  Shr = numpy.array([m.sr for m in modo.modih])
2058
2010
  Shl = numpy.array([m.sl for m in modo.modih])
@@ -2131,7 +2083,6 @@ def check_matching(kz, slices, modo, R):
2131
2083
 
2132
2084
 
2133
2085
  def creacoeffx3(kz, solution, slices, R):
2134
-
2135
2086
  Nslices = len(slices)
2136
2087
 
2137
2088
  xl = slices[0].boundary.xleft
@@ -2160,7 +2111,6 @@ def creacoeffx3(kz, solution, slices, R):
2160
2111
  arh = numpy.zeros_like(ale)
2161
2112
 
2162
2113
  if (xl == "Electric Wall") & (xr == "Electric Wall"):
2163
-
2164
2114
  sle = numpy.c_[numpy.zeros((nmodi, 1)), sle2end]
2165
2115
  sre[:, -1] = numpy.zeros(nmodi)
2166
2116
  are[:, -1] = -Se[:, -1] * sle[:, -1]
@@ -2192,7 +2142,6 @@ def creacoeffx3(kz, solution, slices, R):
2192
2142
  )
2193
2143
 
2194
2144
  elif (xl == "Electric Wall") & (xr == "Magnetic Wall"):
2195
-
2196
2145
  sle = numpy.c_[numpy.zeros((nmodi, 1)), sle2end]
2197
2146
  are[:, -1] = numpy.zeros(nmodi)
2198
2147
  sre[:, -1] = Se[:, -1] / Te[:, -1] * sle[:, -1]
@@ -2224,7 +2173,6 @@ def creacoeffx3(kz, solution, slices, R):
2224
2173
  )
2225
2174
 
2226
2175
  elif (xl == "Magnetic Wall") & (xr == "Electric Wall"):
2227
-
2228
2176
  sle = numpy.c_[numpy.zeros((nmodi, 1)), sle2end]
2229
2177
  slh = numpy.c_[numpy.zeros((nmodi, 1)), slh2end]
2230
2178
 
@@ -2256,7 +2204,6 @@ def creacoeffx3(kz, solution, slices, R):
2256
2204
  )
2257
2205
 
2258
2206
  elif (xl == "Magnetic Wall") & (xr == "Magnetic Wall"):
2259
-
2260
2207
  sle = numpy.c_[numpy.zeros((nmodi, 1)), sle2end]
2261
2208
  slh = numpy.c_[numpy.zeros((nmodi, 1)), slh2end]
2262
2209
 
@@ -2296,7 +2243,6 @@ def creacoeffx3(kz, solution, slices, R):
2296
2243
  ke = numpy.zeros_like(kh)
2297
2244
 
2298
2245
  for n in range(nmodi):
2299
-
2300
2246
  for q, slice in enumerate(slices):
2301
2247
  kh[n, q] = slice.modih[n].keff.item()
2302
2248
  ke[n, q] = slice.modie[n].keff.item()
@@ -2323,7 +2269,6 @@ def creacoeffx3(kz, solution, slices, R):
2323
2269
 
2324
2270
 
2325
2271
  def FMM1d_x_component(slices, nmodi, verbosity=0):
2326
-
2327
2272
  Message("Matching 1dmodes on slices interfaces.", 1).show(verbosity)
2328
2273
 
2329
2274
  TolnullEig = 1e-1
@@ -2375,7 +2320,6 @@ def FMM1d_x_component(slices, nmodi, verbosity=0):
2375
2320
  mk = 0
2376
2321
  modi = []
2377
2322
  for m in range(len(kz1)):
2378
-
2379
2323
  if mk == nmodi:
2380
2324
  break
2381
2325
 
@@ -2389,7 +2333,6 @@ def FMM1d_x_component(slices, nmodi, verbosity=0):
2389
2333
  )
2390
2334
 
2391
2335
  if len(valf) > 0:
2392
-
2393
2336
  eigval, eigvec = numpy.linalg.eig(Mvec(z0, slices, Rot))
2394
2337
  mk += 1
2395
2338
  index0 = numpy.where(numpy.abs(eigval) < TolnullEig)[0]
@@ -38,7 +38,6 @@ def T2S(T):
38
38
 
39
39
 
40
40
  class SWG:
41
-
42
41
  # def __init__(self, cs, solver, length, inputLHS=None, inputRHS=None):
43
42
  def __init__(self, solver, length, inputLHS=None, inputRHS=None):
44
43
  # self.cs = cs
@@ -95,7 +94,6 @@ class SWG:
95
94
 
96
95
 
97
96
  class SimpleJoint:
98
-
99
97
  # def __init__(self, cs1, cs2, solver1, solver2, inputLHS=None, inputRHS=None):
100
98
  def __init__(self, solver1, solver2, inputLHS=None, inputRHS=None):
101
99
  # self.cs1 = cs1
@@ -52,7 +52,6 @@ def overlap(m1, m2, x=None, y=None):
52
52
 
53
53
 
54
54
  def interface_matrix(solver1, solver2, x=None, y=None):
55
-
56
55
  neigs = solver1.nmodes
57
56
 
58
57
  O11 = numpy.zeros((neigs, neigs), dtype=complex)
@@ -62,7 +61,6 @@ def interface_matrix(solver1, solver2, x=None, y=None):
62
61
 
63
62
  for i in range(neigs):
64
63
  for j in range(neigs):
65
-
66
64
  O11[i, j] = overlap(solver1.modes[i], solver1.modes[j], x, y)
67
65
  O22[i, j] = overlap(solver2.modes[i], solver2.modes[j], x, y)
68
66
  O12[i, j] = overlap(solver1.modes[i], solver2.modes[j], x, y)
@@ -68,10 +68,10 @@ class IsotropicTransferMatrix(TransferMatrix):
68
68
  nlayers = len(multilayer)
69
69
  d = S.array([l.thickness for l in multilayer]).ravel()
70
70
 
71
- Rs = S.zeros_like(self.wls)
72
- Ts = S.zeros_like(self.wls)
73
- Rp = S.zeros_like(self.wls)
74
- Tp = S.zeros_like(self.wls)
71
+ Rs = S.zeros_like(self.wls, dtype=float)
72
+ Ts = S.zeros_like(self.wls, dtype=float)
73
+ Rp = S.zeros_like(self.wls, dtype=float)
74
+ Tp = S.zeros_like(self.wls, dtype=float)
75
75
 
76
76
  Dp = S.zeros((2, 2), dtype=complex)
77
77
  Ds = S.zeros((2, 2), dtype=complex)
@@ -86,7 +86,6 @@ class IsotropicTransferMatrix(TransferMatrix):
86
86
  ntot[:, i] = l.mat.n(self.wls, l.mat.toc.T0)
87
87
 
88
88
  for iwl, wl in enumerate(self.wls):
89
-
90
89
  n = ntot[iwl, :]
91
90
  theta = snell(theta_inc, n)
92
91
 
@@ -99,7 +98,6 @@ class IsotropicTransferMatrix(TransferMatrix):
99
98
  Mp = inv(Dp)
100
99
 
101
100
  for nn, dd, tt, kk in zip(n[1:-1], d[1:-1], theta[1:-1], k[1:-1, 0]):
102
-
103
101
  Ds = [[1.0, 1.0], [nn * S.cos(tt), -nn * S.cos(tt)]]
104
102
  Dp = [[S.cos(tt), S.cos(tt)], [nn, -nn]]
105
103
  phi = kk * dd
@@ -285,7 +283,6 @@ class AnisotropicTransferMatrix(TransferMatrix):
285
283
  v = S.zeros((4, 3), dtype=complex)
286
284
 
287
285
  for i, g in enumerate(gamma):
288
-
289
286
  # H = K + [
290
287
  # [-beta2 - g ** 2, alpha * beta, alpha * g],
291
288
  # [alpha * beta, -alpha2 - g ** 2, beta * g],
@@ -327,7 +324,6 @@ class AnisotropicTransferMatrix(TransferMatrix):
327
324
  epstot[:, :, :, i] = l.mat.epsilonTensor(self.wls)
328
325
 
329
326
  for iwl, wl in enumerate(self.wls):
330
-
331
327
  epsilon = epstot[:, :, iwl, :]
332
328
 
333
329
  kx = 2 * S.pi / wl * S.sin(theta_inc_x)
@@ -342,7 +338,6 @@ class AnisotropicTransferMatrix(TransferMatrix):
342
338
  P = S.zeros((4, 4, nlayers), dtype=complex)
343
339
 
344
340
  for i in range(nlayers):
345
-
346
341
  k[:, :, i], p[:, :, i], q[:, :, i] = find_roots(
347
342
  wl, epsilon[:, :, i], kx, ky
348
343
  )
@@ -441,7 +441,6 @@ class LiquidCrystalCell:
441
441
  nlayers=100,
442
442
  data_file=None,
443
443
  ):
444
-
445
444
  self.lc = lc
446
445
  self.t_tot = t_tot
447
446
  self.t_anchoring = t_anchoring
@@ -616,7 +615,6 @@ class LiquidCrystalCell:
616
615
  return z, theta, phi, u
617
616
 
618
617
  def _get_angles_from_file(self):
619
-
620
618
  # interpolate data file
621
619
  data = numpy.loadtxt(self.data_file)
622
620
  data_x = numpy.linspace(0, 1, data.shape[0] - 1)
@@ -628,7 +626,6 @@ class LiquidCrystalCell:
628
626
  return angles.squeeze()
629
627
 
630
628
  def _get_angles_from_bvp(self):
631
-
632
629
  # solve bvp
633
630
  self.__apply_tension()
634
631
  z_ = self.normalized_sample_points
@@ -860,7 +857,6 @@ class CrossSection(list):
860
857
  return self.widths().sum()
861
858
 
862
859
  def grid(self, nx_per_region, ny_per_region):
863
-
864
860
  xs = self.xs()
865
861
  ys = self.ys()
866
862
 
@@ -1158,7 +1154,6 @@ def find_peaks(x, y, threshold=1e-6):
1158
1154
 
1159
1155
  peaks = []
1160
1156
  for idx in idxs:
1161
-
1162
1157
  # look around the candidate
1163
1158
  xtol = (x.max() - x.min()) * 1e-6
1164
1159
  xopt = scipy.optimize.fminbound(
@@ -1167,7 +1162,6 @@ def find_peaks(x, y, threshold=1e-6):
1167
1162
  yopt = scipy.interpolate.splev(xopt, tck)
1168
1163
 
1169
1164
  if yopt > threshold * y.max():
1170
-
1171
1165
  # FWHM
1172
1166
  tckFWHM = scipy.interpolate.splrep(x, y - 0.5 * yopt)
1173
1167
  roots = scipy.interpolate.sproot(tckFWHM)
@@ -0,0 +1 @@
1
+ version = "2.1.5"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ElectroMagneticPython
3
- Version: 2.1.4
3
+ Version: 2.1.5
4
4
  Summary: EMpy - ElectroMagnetic Python
5
5
  Home-page: http://lbolla.github.io/EMpy/
6
6
  Download-URL: https://github.com/lbolla/EMpy
@@ -15,11 +15,14 @@ Classifier: Environment :: Console
15
15
  Classifier: Intended Audience :: Science/Research
16
16
  Classifier: License :: OSI Approved :: BSD License
17
17
  Classifier: Natural Language :: English
18
- Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3
19
19
  Classifier: Operating System :: OS Independent
20
20
  Classifier: Topic :: Scientific/Engineering :: Physics
21
21
  Provides: EMpy
22
22
  License-File: LICENSE
23
+ Requires-Dist: numpy>=1.18
24
+ Requires-Dist: scipy>=1.7
25
+ Requires-Dist: matplotlib>=3.1
23
26
 
24
27
  EMpy - ElectroMagnetic Python
25
28
  *****************************
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ElectroMagneticPython
3
- Version: 2.1.4
3
+ Version: 2.1.5
4
4
  Summary: EMpy - ElectroMagnetic Python
5
5
  Home-page: http://lbolla.github.io/EMpy/
6
6
  Download-URL: https://github.com/lbolla/EMpy
@@ -15,11 +15,14 @@ Classifier: Environment :: Console
15
15
  Classifier: Intended Audience :: Science/Research
16
16
  Classifier: License :: OSI Approved :: BSD License
17
17
  Classifier: Natural Language :: English
18
- Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3
19
19
  Classifier: Operating System :: OS Independent
20
20
  Classifier: Topic :: Scientific/Engineering :: Physics
21
21
  Provides: EMpy
22
22
  License-File: LICENSE
23
+ Requires-Dist: numpy>=1.18
24
+ Requires-Dist: scipy>=1.7
25
+ Requires-Dist: matplotlib>=3.1
23
26
 
24
27
  EMpy - ElectroMagnetic Python
25
28
  *****************************
@@ -4,33 +4,31 @@
4
4
  #
5
5
  # pip-compile --output-file=requirements.txt setup.py
6
6
  #
7
- contourpy==1.0.6
7
+ contourpy==1.2.0
8
8
  # via matplotlib
9
- cycler==0.11.0
9
+ cycler==0.12.1
10
10
  # via matplotlib
11
- fonttools==4.38.0
11
+ fonttools==4.49.0
12
12
  # via matplotlib
13
- kiwisolver==1.4.4
13
+ kiwisolver==1.4.5
14
14
  # via matplotlib
15
- matplotlib==3.6.2
15
+ matplotlib==3.8.3
16
16
  # via ElectroMagneticPython (setup.py)
17
- numpy==1.23.5
17
+ numpy==1.26.4
18
18
  # via
19
19
  # ElectroMagneticPython (setup.py)
20
20
  # contourpy
21
21
  # matplotlib
22
22
  # scipy
23
- packaging==21.3
23
+ packaging==23.2
24
24
  # via matplotlib
25
- pillow==9.3.0
25
+ pillow==10.2.0
26
26
  # via matplotlib
27
- pyparsing==3.0.9
28
- # via
29
- # matplotlib
30
- # packaging
31
- python-dateutil==2.8.2
27
+ pyparsing==3.1.1
28
+ # via matplotlib
29
+ python-dateutil==2.9.0.post0
32
30
  # via matplotlib
33
- scipy==1.9.3
31
+ scipy==1.12.0
34
32
  # via ElectroMagneticPython (setup.py)
35
33
  six==1.16.0
36
34
  # via python-dateutil
@@ -35,7 +35,7 @@ setup(
35
35
  "Intended Audience :: Science/Research",
36
36
  "License :: OSI Approved :: BSD License",
37
37
  "Natural Language :: English",
38
- "Programming Language :: Python :: 3.8",
38
+ "Programming Language :: Python :: 3",
39
39
  "Operating System :: OS Independent",
40
40
  "Topic :: Scientific/Engineering :: Physics",
41
41
  ],
@@ -1 +0,0 @@
1
- version = "2.1.4"