samplemaker-sparrow 5.4.4__tar.gz → 5.4.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 (45) hide show
  1. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/PKG-INFO +1 -1
  2. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/pyproject.toml +1 -1
  3. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/__init__.py +1 -8
  4. samplemaker_sparrow-5.4.5/src/samplemaker/baselib/__init__.py +4 -0
  5. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/baselib/devices.py +0 -1
  6. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/baselib/waveguides.py +0 -1
  7. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/devices.py +7 -8
  8. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/gdsreader.py +1 -2
  9. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/gdswriter.py +10 -11
  10. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/layout.py +2 -3
  11. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/makers.py +12 -14
  12. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/phc.py +17 -19
  13. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/resources/__init__.py +0 -1
  14. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/routers.py +0 -1
  15. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/sequencer.py +0 -1
  16. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/shapes.py +7 -9
  17. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/viewers.py +0 -1
  18. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/00_Tutorial_BasicDrawing.py +0 -1
  19. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/01_Tutorial_Shapes.py +0 -1
  20. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/02_Tutorial_CellReferences.py +0 -1
  21. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/03_Tutorial_GroupManipulation.py +0 -1
  22. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/04_Tutorial_Boolean.py +0 -1
  23. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/05_Tutorial_Devices.py +0 -1
  24. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/06_Tutorial_DeviceTables.py +0 -1
  25. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/07_Tutorial_Waveguides.py +0 -1
  26. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/08_Tutorial_WaveguideDevices.py +0 -1
  27. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/09_Tutorial_Circuits.py +0 -1
  28. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/10_Tutorial_ElectricalPorts.py +0 -1
  29. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/11_Tutorial_LayoutAssembly.py +0 -1
  30. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/12_Tutorial_ImportingCircuits.py +0 -1
  31. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/TutorialCollection.py +0 -1
  32. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/uv.lock +2 -2
  33. samplemaker_sparrow-5.4.4/src/samplemaker/baselib/__init__.py +0 -5
  34. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/.github/workflows/build_wheels.yml +0 -0
  35. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/.gitignore +0 -0
  36. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/BUILD.md +0 -0
  37. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/LICENSE.md +0 -0
  38. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/README.md +0 -0
  39. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/boopy/CMakeLists.txt +0 -0
  40. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/boopy/boopy.cpp +0 -0
  41. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/documentation.md +0 -0
  42. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/resources/boopy.pyi +0 -0
  43. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/src/samplemaker/resources/sm_stencil_font.txt +0 -0
  44. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/.pylint.d/12_Tutorial_LayoutAssembly1.stats +0 -0
  45. {samplemaker_sparrow-5.4.4 → samplemaker_sparrow-5.4.5}/tutorials/CircuitFile.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: samplemaker-sparrow
3
- Version: 5.4.4
3
+ Version: 5.4.5
4
4
  Summary: Lithographic mask design package
5
5
  Author-Email: Leonardo Midolo <midolo@nbi.ku.dk>
6
6
  License-Expression: BSD-3-Clause
@@ -12,7 +12,7 @@ readme = "README.md"
12
12
  requires-python = ">=3.10,<3.14"
13
13
  license-files = ["LICENSE.md"]
14
14
  license = "BSD-3-Clause"
15
- version = "5.4.4"
15
+ version = "5.4.5"
16
16
  dependencies = [
17
17
  "matplotlib>=3.7.5",
18
18
  "numpy==2.*",
@@ -19,14 +19,7 @@ the European Research Council (ERC) under the European Union’s Horizon 2020 re
19
19
  .. include:: ./documentation.md
20
20
  """
21
21
 
22
- from typing import ( # noqa: F401
23
- cast, Any, Callable, Dict, Generator, Iterable, List, Mapping, NewType,
24
- Optional, Set, Tuple, Type, TypeVar, Union,
25
- )
26
-
27
- __version__ = "5.4.3"
28
-
29
- __pdoc__: Dict[str, Union[bool, str]] = {}
22
+ __pdoc__: dict[str, bool | str] = {}
30
23
  __pdoc__["samplemaker.Tutorials"]=False
31
24
  __pdoc__["samplemaker.tests"]=False
32
25
  __pdoc__["samplemaker.resources"]=False
@@ -0,0 +1,4 @@
1
+
2
+ import samplemaker.baselib.devices
3
+
4
+ print("Base library loaded")
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Base device library.
4
3
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Base waveguide library.
4
3
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  This module contains the base classes for generating re-usable device classes.
4
3
 
@@ -684,13 +683,13 @@ class Device:
684
683
 
685
684
  if hsh not in _DevicePool:
686
685
  _DeviceCountPool[srefname] += 1
687
- srefname += "_%0.4i"%_DeviceCountPool[srefname]
686
+ srefname += f"_{_DeviceCountPool[srefname]:04d}"
688
687
  LayoutPool[srefname] = self.geom()
689
688
  _BoundingBoxPool[srefname] = LayoutPool[srefname].bounding_box()
690
689
  _DevicePool[hsh] = srefname
691
690
  _DeviceLocalParamPool[hsh] = deepcopy(self._localp)
692
691
  else:
693
- srefname += "_%0.4i"%_DeviceCountPool[srefname]
692
+ srefname += f"_{_DeviceCountPool[srefname]:04d}"
694
693
  self._localp = _DeviceLocalParamPool[hsh]
695
694
  # now create a ref
696
695
  g = make_sref(self._x0,self._y0, _DevicePool[hsh],
@@ -1047,7 +1046,7 @@ class Circuit(Device):
1047
1046
  dev=_DeviceList[nle.devname].build()
1048
1047
  for key,value in nle.params.items():
1049
1048
  dev.set_param(key,value)
1050
- self.addparameter("dev_%s_%i"%(nle.devname,i), dev._p, "Device parameters for %s"%nle.devname)
1049
+ self.addparameter(f"dev_{nle.devname}_{i:d}", dev._p, f"Device parameters for {nle.devname}")
1051
1050
  i+=1
1052
1051
 
1053
1052
  def set_param(self, param_name: str, value):
@@ -1110,7 +1109,7 @@ class Circuit(Device):
1110
1109
  if(hasattr(dev,"_seq")):
1111
1110
  dev._seq.reset()
1112
1111
  # Set all parameter from Netlist hierarchy
1113
- dev._p = self._p["dev_%s_%i"%(nle.devname,i)]
1112
+ dev._p = self._p[f"dev_{nle.devname}_{i:d}"]
1114
1113
  i+=1
1115
1114
  dev._x0 = nle.x0
1116
1115
  dev._y0 = nle.y0
@@ -1327,18 +1326,18 @@ def ExportDeviceSchematics(filename: str = "SampleMakerLibrary.lel"):
1327
1326
  y = g.data[1::2]
1328
1327
  for i in range(len(x)-1):
1329
1328
  if ((x[i+1]-x[i])**2 +(y[i+1]-y[i])**2 > 0.2):
1330
- f.write("<Line {x0} {y0} {x1} {y1} wire>\n".format(x0=int(x[i]),y0=int(y[i]),x1=int(x[i+1]),y1=int(y[i+1])))
1329
+ f.write(f"<Line {int(x[i])} {int(y[i])} {int(x[i+1])} {int(y[i+1])} wire>\n")
1331
1330
 
1332
1331
  dev.ports()
1333
1332
  for pname, port in dev._ports.items():
1334
- f.write("<Port {x} {y} {name}>\n".format(x=int(port.x0*100/scale),y=int(port.y0*100/scale),name=pname))
1333
+ f.write(f"<Port {int(port.x0*100/scale)} {int(port.y0*100/scale)} {pname}>\n")
1335
1334
 
1336
1335
  f.write("</Symbol>\n")
1337
1336
  #f.write("<Offsetlabel 0 -50 -50>\n")
1338
1337
  f.write("<Netlist spice>\n")
1339
1338
  f.write("$devicename ")
1340
1339
  for pname, port in dev._ports.items():
1341
- f.write("{name} $node({name}) ".format(name=pname))
1340
+ f.write(f"{pname} $node({pname}) ")
1342
1341
  f.write(". ")
1343
1342
  for p,val in oj._p.items():
1344
1343
  f.write(p+" $" + p +" ")
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Binary import of GDS files.
4
3
 
@@ -137,7 +136,7 @@ class GDSReader:
137
136
  if(rtype==16): # XY
138
137
  data = self.buf[(pos+4):(pos+hlen)]
139
138
  npts = int(len(data)/4)
140
- cur_xy = np.array(struct.unpack(">%si"%npts,data))
139
+ cur_xy = np.array(struct.unpack(f">{npts}i",data))
141
140
  if(rtype==17): # ENDEL
142
141
  if(cur_el == 8): # Make a poly
143
142
  p1 = smsh.Poly([0], [0], cur_layer)
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Binary export to GDS files.
4
3
 
@@ -71,8 +70,8 @@ class GDSWriter:
71
70
  if(poly.layer<0): return
72
71
  pdata = poly.int_data()
73
72
  buf = np.array([4,0x0800,6,0x0D02,poly.layer,6,0x0E02,0,4*len(pdata)+4,0x1003]);
74
- self.fid.write(struct.pack(">%sH" % buf.size,*buf))
75
- self.fid.write(struct.pack(">%si" % pdata.size,*pdata))
73
+ self.fid.write(struct.pack(f">{buf.size}H",*buf))
74
+ self.fid.write(struct.pack(f">{pdata.size}i",*pdata))
76
75
  self.fid.write(struct.pack(">2H",4,0x1100))
77
76
 
78
77
  def __write_circle(self,circ):
@@ -80,11 +79,11 @@ class GDSWriter:
80
79
 
81
80
  def __write_path(self,path):
82
81
  buf = np.array([4,0x0900,6,0x0D02,path.layer,6,0x0E02,0,6,0x2102,1,8,0x0F03]);
83
- self.fid.write(struct.pack(">%sH" % buf.size,*buf))
82
+ self.fid.write(struct.pack(f">{buf.size}H",*buf))
84
83
  self.fid.write(struct.pack(">i",math.floor(path.width*1000)))
85
84
  self.fid.write(struct.pack(">2H",8*len(path.xpts)+4,0x1003))
86
- data = np.transpose(np.round_((np.array([path.xpts,path.ypts])*1000)).astype(int)).reshape(-1)
87
- self.fid.write(struct.pack(">%si" % data.size,*data))
85
+ data = np.transpose(np.round(np.array([path.xpts,path.ypts])*1000).astype(int)).reshape(-1)
86
+ self.fid.write(struct.pack(f">{data.size}i",*data))
88
87
  self.fid.write(struct.pack(">2H",4,0x1100))
89
88
 
90
89
  def __write_text(self,text):
@@ -93,7 +92,7 @@ class GDSWriter:
93
92
  buf = np.array([4,0x0C00, 6,0x0D02,text.layer,
94
93
  6,0x1602,0,6,0x1701,text.posu+text.posv*4+16,
95
94
  8,0x0F03]);
96
- self.fid.write(struct.pack(">%sH" % buf.size,*buf))
95
+ self.fid.write(struct.pack(f">{buf.size}H",*buf))
97
96
  self.fid.write(struct.pack(">i",math.floor(text.width*1000)))
98
97
  self.fid.write(struct.pack(">2H",12,0x1003))
99
98
  self.fid.write(struct.pack(">2i",
@@ -115,7 +114,7 @@ class GDSWriter:
115
114
  #if(angle!=0):
116
115
  # strans+=2
117
116
  buf = np.array([6,0x1A01,strans])
118
- self.fid.write(struct.pack(">%sH" % buf.size,*buf))
117
+ self.fid.write(struct.pack(f">{buf.size}H",*buf))
119
118
  if(mag!=1):
120
119
  self.fid.write(struct.pack(">2H",12,0x1B05))
121
120
  self.__write_real8(mag)
@@ -185,7 +184,7 @@ class GDSWriter:
185
184
  #Write header
186
185
  lt=time.localtime(time.time())
187
186
  buf = np.array([6,2,3,28,258,lt.tm_year,lt.tm_mon,lt.tm_mday,lt.tm_hour,lt.tm_min,lt.tm_sec,lt.tm_year,lt.tm_mon,lt.tm_mday,lt.tm_hour,lt.tm_min,lt.tm_sec]);
188
- self.fid.write(struct.pack(">%sH" % buf.size,*buf));
187
+ self.fid.write(struct.pack(f">{buf.size}H",*buf));
189
188
  # Library name
190
189
  self.__write_string(filename,518)
191
190
  # Units
@@ -216,7 +215,7 @@ class GDSWriter:
216
215
  print("Writing structure: " + structure_name)
217
216
  lt=time.localtime(time.time())
218
217
  buf = np.array([28,1282,lt.tm_year,lt.tm_mon,lt.tm_mday,lt.tm_hour,lt.tm_min,lt.tm_sec,lt.tm_year,lt.tm_mon,lt.tm_mday,lt.tm_hour,lt.tm_min,lt.tm_sec]);
219
- self.fid.write(struct.pack(">%sH" % buf.size,*buf));
218
+ self.fid.write(struct.pack(f">{buf.size}H",*buf));
220
219
  self.__write_string(structure_name,1542)
221
220
 
222
221
  def write_geomgroup(self,geom_group: GeomGroup):
@@ -361,7 +360,7 @@ class GDSWriter:
361
360
  self.fid.write(struct.pack('>2H',4,1024));
362
361
  pos = self.fid.tell()
363
362
  buf = np.zeros(2048-pos%2048,dtype=int);
364
- self.fid.write(struct.pack("%sb" % buf.size,*buf))
363
+ self.fid.write(struct.pack(f"{buf.size}b",*buf))
365
364
  print('Writing to GDS complete.')
366
365
  self.fid.close()
367
366
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  This module contains the classes to configure the mask layout.
4
3
 
@@ -683,7 +682,7 @@ class DeviceTable:
683
682
  # Store external ports to expose them
684
683
  for pp in portmap[j][i].values():
685
684
  p1 = deepcopy(pp)
686
- p1.name+="_%i_%i"%(j,i)
685
+ p1.name+=f"_{j:d}_{i:d}"
687
686
  self._external_ports[p1.name]=p1
688
687
  self._getgeom_ran = True
689
688
  return g
@@ -889,7 +888,7 @@ class Mask:
889
888
  _DevicePool[key]=data[3][key]
890
889
  for key in data[4].keys():
891
890
  _BoundingBoxPool[key]=data[4][key]
892
- except IOError:
891
+ except OSError:
893
892
  pass
894
893
 
895
894
  def __cleanup_cellref(self):
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Functions that generate shapes into `samplemaker.shapes.GeomGroup` objects.
4
3
 
@@ -18,8 +17,7 @@ directly.
18
17
  import math
19
18
  import samplemaker.shapes as smsh
20
19
  from samplemaker.shapes import GeomGroup
21
- from typing import List
22
-
20
+
23
21
  def make_dot(x0: float, y0: float)-> "smsh.Dot":
24
22
  """
25
23
  Creates a dot object. Dots cannot be exported to GDS but they are useful
@@ -41,7 +39,7 @@ def make_dot(x0: float, y0: float)-> "smsh.Dot":
41
39
  return smsh.Dot(x0,y0)
42
40
 
43
41
 
44
- def make_poly(xpts: List[float],ypts: List[float],
42
+ def make_poly(xpts: list[float],ypts: list[float],
45
43
  layer: int = 1)-> 'GeomGroup':
46
44
  """
47
45
  Creates a closed polygon object.
@@ -49,9 +47,9 @@ def make_poly(xpts: List[float],ypts: List[float],
49
47
 
50
48
  Parameters
51
49
  ----------
52
- xpts : List[float]
50
+ xpts : list[float]
53
51
  x coordinates in um.
54
- ypts : List[float]
52
+ ypts : list[float]
55
53
  y coordinates in um.
56
54
  layer : int, optional
57
55
  layer. The default is 1.
@@ -66,7 +64,7 @@ def make_poly(xpts: List[float],ypts: List[float],
66
64
  g.add(smsh.Poly(xpts,ypts,layer))
67
65
  return g
68
66
 
69
- def make_path(xpts: List[float],ypts: List[float],
67
+ def make_path(xpts: list[float],ypts: list[float],
70
68
  width: float,layer: int = 1,
71
69
  to_poly: bool = 0)-> 'GeomGroup':
72
70
  """
@@ -75,9 +73,9 @@ def make_path(xpts: List[float],ypts: List[float],
75
73
 
76
74
  Parameters
77
75
  ----------
78
- xpts : List[float]
76
+ xpts : list[float]
79
77
  x coordinates in um.
80
- ypts : List[float]
78
+ ypts : list[float]
81
79
  y coordinates in um.
82
80
  width : float
83
81
  path width in um.
@@ -494,19 +492,19 @@ def make_rounded_rect(x0: float,y0: float,width: float,
494
492
  r1.translate(xoff*(width+2*corner_radius)/2,yoff*(height+2*corner_radius)/2)
495
493
  return r1
496
494
 
497
- def make_tapered_path(xpts: List[float],ypts: List[float],
498
- widths: List[float],layer: int = 1)-> 'GeomGroup':
495
+ def make_tapered_path(xpts: list[float],ypts: list[float],
496
+ widths: list[float],layer: int = 1)-> 'GeomGroup':
499
497
  """
500
498
  Creates a path with variable width. A list of path widths is given
501
499
  so that at each point the width can be changed. A polygon is produced
502
500
 
503
501
  Parameters
504
502
  ----------
505
- xpts : List[float]
503
+ xpts : list[float]
506
504
  x coordinates in um.
507
- ypts : List[float]
505
+ ypts : list[float]
508
506
  y coordinates in um.
509
- widths : List[float]
507
+ widths : list[float]
510
508
  path widths in um at each point (should be the same size as xpts).
511
509
  layer : int, optional
512
510
  The path layer. The default is 1.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Classes for drawing photonic crystals and periodic sturctures.
4
3
 
@@ -34,24 +33,23 @@ import samplemaker.makers as sm
34
33
  from samplemaker.shapes import GeomGroup
35
34
  import math
36
35
  import numpy as np
37
- from typing import List
38
36
  from samplemaker.layout import LayoutPool
39
37
  from copy import deepcopy
40
38
 
41
39
  class Crystal:
42
- def __init__(self,xpts: List[float] =[],ypts: List[float] = [],params: List[float]=[]):
40
+ def __init__(self,xpts: list[float] =[],ypts: list[float] = [],params: list[float]=[]):
43
41
  """
44
42
  Initialize a Crystal template.
45
43
 
46
44
 
47
45
  Parameters
48
46
  ----------
49
- xpts : List[float], optional
47
+ xpts : list[float], optional
50
48
  List of x-coordinates (normalized) of the lattice sites. The default is [].
51
- ypts : List[float], optional
49
+ ypts : list[float], optional
52
50
  List of y-coordinates (normalized) of the lattice sites. The default is [].
53
- params : List[float], optional
54
- 2D List of paramter values of the lattice sites. Should be of the form params[pindex,site_index].
51
+ params : list[float], optional
52
+ 2D list of paramter values of the lattice sites. Should be of the form params[pindex,site_index].
55
53
  The default is [].
56
54
 
57
55
  Returns
@@ -65,13 +63,13 @@ class Crystal:
65
63
  params=np.float64(params)
66
64
  self.params = params
67
65
 
68
- def remove_at_index(self, index: List[int]):
66
+ def remove_at_index(self, index: list[int]):
69
67
  """
70
68
  Removes lattice sites from a list of indices
71
69
 
72
70
  Parameters
73
71
  ----------
74
- index : List[int]
72
+ index : list[int]
75
73
  indexes to be removed from the list used to initialize the crystal.
76
74
 
77
75
  Returns
@@ -84,14 +82,14 @@ class Crystal:
84
82
  self.ypts=np.delete(self.ypts, index)
85
83
  self.params=np.delete(self.params, index,axis=1)
86
84
 
87
- def shift_at_index(self, index: List[int], shift_x: float, shift_y: float,
85
+ def shift_at_index(self, index: list[int], shift_x: float, shift_y: float,
88
86
  relative: bool = False, orig_x: float = 0, orig_y: float = 0):
89
87
  """
90
88
  Shifts the lattice sites specified in the list
91
89
 
92
90
  Parameters
93
91
  ----------
94
- index : List[int]
92
+ index : list[int]
95
93
  A list of indexes to be shifted.
96
94
  shift_x : float
97
95
  x-amount of shift (in normalized units).
@@ -152,7 +150,7 @@ class Crystal:
152
150
 
153
151
  Returns
154
152
  -------
155
- sel : List[float]
153
+ sel : list[float]
156
154
  A list of coordinate indices.
157
155
 
158
156
  """
@@ -307,7 +305,7 @@ class Crystal:
307
305
 
308
306
  @classmethod
309
307
  def triangular_heterophc(cls,Nx: float, Ny: float,
310
- spacing: List[float], periods: List[int],
308
+ spacing: list[float], periods: list[int],
311
309
  Nparams: int = 1):
312
310
  """
313
311
  Creates a triangular photonic crystal in the shape of a rectangular
@@ -323,9 +321,9 @@ class Crystal:
323
321
  Ny : int
324
322
  Number of holes in the y direction, note that we consider Ny=1 the
325
323
  row where y=sqrt(3). The crystal will span from -Ny to Ny.
326
- spacing : List[float]
324
+ spacing : list[float]
327
325
  Array of lattice constants to be used for the various sections of the hetero phc.
328
- periods : List[int]
326
+ periods : list[int]
329
327
  How many times should each spacing be repeated (always end with 1 for the remaining).
330
328
  Nparams : int, optional
331
329
  Number of parameters to be controlled for each lattice site.
@@ -392,7 +390,7 @@ def __circref_cellfun__(x,y,params):
392
390
  else:
393
391
  return sm.make_sref(x, y, "_CIRCLE",LayoutPool["_CIRCLE"],mag=params[0])
394
392
 
395
- def make_phc(crystal: "Crystal", scaling: float, cellparams: List[float], x0: float, y0: float,
393
+ def make_phc(crystal: "Crystal", scaling: float, cellparams: list[float], x0: float, y0: float,
396
394
  cellfun = __circ_cellfun__, name: str = ""):
397
395
  """
398
396
  Creates a photonic crystal geometry
@@ -403,7 +401,7 @@ def make_phc(crystal: "Crystal", scaling: float, cellparams: List[float], x0: fl
403
401
  The crystal template.
404
402
  scaling : float
405
403
  An overall scaling factor in um.
406
- cellparams : List[float]
404
+ cellparams : list[float]
407
405
  A list with the scaling parameters to be passed to the cell function.
408
406
  x0 : float
409
407
  Position x-coordinate in um.
@@ -435,7 +433,7 @@ def make_phc(crystal: "Crystal", scaling: float, cellparams: List[float], x0: fl
435
433
  phc.translate(x0,y0)
436
434
  return phc
437
435
 
438
- def make_phc_inpoly(crystal: "Crystal", poly: "sm.Poly", scaling: float, cellparams: List[float],
436
+ def make_phc_inpoly(crystal: "Crystal", poly: "sm.Poly", scaling: float, cellparams: list[float],
439
437
  x0: float, y0: float, cellfun = __circ_cellfun__, name: str = ""):
440
438
  """
441
439
  Creates a photonic crystal geometry clipped inside a polygon area.
@@ -448,7 +446,7 @@ def make_phc_inpoly(crystal: "Crystal", poly: "sm.Poly", scaling: float, cellpar
448
446
  The polygon used to clip. Should be created with samplemaker.shapes.Poly
449
447
  scaling : float
450
448
  An overall scaling factor in um.
451
- cellparams : List[float]
449
+ cellparams : list[float]
452
450
  A list with the scaling parameters to be passed to the cell function.
453
451
  x0 : float
454
452
  Position x-coordinate in um.
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Resources module for samplemaker.
4
3
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Automatic port-to-port routing functions.
4
3
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Classes to handle custom sequences of shapes (e.g. waveguides).
4
3
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Shape classes supported by the GDS format and most lithography systems / pattern generators.
4
3
 
@@ -68,7 +67,6 @@ import numpy as np
68
67
  from copy import deepcopy
69
68
  import math
70
69
  import samplemaker.resources.boopy as boopy
71
- from typing import List
72
70
  from samplemaker import _BoundingBoxPool
73
71
 
74
72
  _glyphs = dict()
@@ -136,7 +134,7 @@ class GeomGroup:
136
134
  """
137
135
  return deepcopy(self)
138
136
 
139
- def flatten(self, layer_list: List[int] = []) -> "GeomGroup":
137
+ def flatten(self, layer_list: list[int] = []) -> "GeomGroup":
140
138
  """
141
139
  Flattens the entire group. Turns all SREF and AREF objects in flattened objects.
142
140
  All references to cell are removed. A new flattened group is returned and no
@@ -144,7 +142,7 @@ class GeomGroup:
144
142
 
145
143
  Parameters
146
144
  ----------
147
- layer_list : List[int], optional
145
+ layer_list : list[int], optional
148
146
  A list of layers that should be used when flattening. The default is [] (=all).
149
147
 
150
148
  Returns
@@ -495,13 +493,13 @@ class GeomGroup:
495
493
  g.add(geom)
496
494
  return g
497
495
 
498
- def select_layers(self,layers: List[int]) -> 'GeomGroup':
496
+ def select_layers(self,layers: list[int]) -> 'GeomGroup':
499
497
  """
500
498
  Create a new GeomGroup containing only shapes in a list of layers.
501
499
 
502
500
  Parameters
503
501
  ----------
504
- layers : List[int]
502
+ layers : list[int]
505
503
  The selected layer list.
506
504
 
507
505
  Returns
@@ -516,13 +514,13 @@ class GeomGroup:
516
514
  g.add(geom)
517
515
  return g
518
516
 
519
- def deselect_layers(self, layers: List[int])-> 'GeomGroup':
517
+ def deselect_layers(self, layers: list[int])-> 'GeomGroup':
520
518
  """
521
519
  Create a new GeomGroup containing only shapes that are not in layer list
522
520
 
523
521
  Parameters
524
522
  ----------
525
- layers : List[int]
523
+ layers : list[int]
526
524
  A list of layer to deselect.
527
525
 
528
526
  Returns
@@ -658,7 +656,7 @@ class GeomGroup:
658
656
 
659
657
  Returns
660
658
  -------
661
- res : List
659
+ res : list
662
660
  A list of coordinate pairs, corresponding to the location of the pattern.
663
661
 
664
662
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Basic functions to plot and inspect geometries.
4
3
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  00_Tutorial_BasicDrawing
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  01_Tutorial_Shapes
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  02_Tutorial_CellReferences
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  03_Tutorial_GroupManipulation
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  04_Tutorial_Boolean
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  05_Tutorial_Devices
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  06_Tutorial_DeviceTables
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  07_Tutorial_Waveguides
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  08_Tutorial_WaveguideDevices
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  09_Tutorial_Circuits
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  10_Tutorial_ElectricalPorts
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  11_Tutorial_LayoutAssembly
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  12_Tutorial_ImportingCircuits
4
3
  """
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  """
3
2
  Tutorial device collection
4
3
 
@@ -563,8 +563,8 @@ wheels = [
563
563
  ]
564
564
 
565
565
  [[package]]
566
- name = "samplemaker"
567
- version = "5.4.3"
566
+ name = "samplemaker-sparrow"
567
+ version = "5.4.5"
568
568
  source = { editable = "." }
569
569
  dependencies = [
570
570
  { name = "matplotlib" },
@@ -1,5 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- import samplemaker.baselib.devices
4
-
5
- print("Base library loaded")