Skip to content

Commit a2e6215

Browse files
authored
Merge pull request #160 from amccaugh/dev
1.6.2
2 parents 6bb30ef + a3385d7 commit a2e6215

File tree

14 files changed

+485
-60
lines changed

14 files changed

+485
-60
lines changed

.github/workflows/pytest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
pytest:
1010
strategy:
1111
matrix:
12-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
12+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
1313
fail-fast: false
1414
runs-on: ubuntu-latest
1515
steps:

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## 1.6.2 (July 25, 2022)
4+
5+
### New features
6+
- Addition of `pg.snspd_candelabra()` which creates an optimally-rounded SNSPD with low current crowding and arbtitrarily-high fill factor (thanks Dileep Reddy @dileepvr)
7+
- Lazy loading of `matplotlib`, allowing loading the base phidl libraries much faster (thanks Joaquin Matres @joamatab)
8+
9+
10+
### Changes
11+
- Modification to `pg.boolean()` s othat `OR`/union will merge all shapes within one Device, even if the second Device is `None` (thanks
12+
Stijn Balk @sbalk)
13+
14+
### Bugfixes
15+
- Modifying the `parent` of a `DeviceReference` now correctly updates the reference cell (thanks Joaquin Matres @joamatab)
16+
- Fix bug in `pg.outline()` when `distance < 0` (thanks @yoshi74ls181)
17+
- GDS path objects now copy over when using `pg.import_gds()` (thanks Bas Nijholt @basnijholt)
18+
- Preserve Polygon.properties and DeviceReference.properties when saving and loading (thanks Bas Nijholt @basnijholt)
19+
- `D.remove_layers()` works also with GDS path objects (thanks Joaquin Matres @joamatab)
20+
21+
322
## 1.6.1 (April 7, 2022)
423

524
### New features

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ GDS scripting for Python that's intuitive, fast, and powerful.
77
- [**Installation / requirements**](#installation--requirements)
88
- [**Tutorial + examples**](https://phidl.readthedocs.io/en/latest/tutorials.html) (or [try an interactive notebook](https://mybinder.org/v2/gh/amccaugh/phidl/master?filepath=phidl_tutorial_example.ipynb))
99
- [**Geometry library + function documentation**](https://phidl.readthedocs.io/en/latest/geometry_reference.html)
10-
- [Changelog](https://github.com/amccaugh/phidl/blob/master/CHANGELOG.md) (latest update 1.6.1 on April 7, 2022)
10+
- [Changelog](https://github.com/amccaugh/phidl/blob/master/CHANGELOG.md) (latest update 1.6.2 on July 25, 2022)
1111
- Huge new routing rewrite for `phidl.routing`, including automatic manhattan routing with custom cross-sections! See [the routing documentation](https://phidl.readthedocs.io/en/latest/tutorials/routing.html) for details. Big thanks to Jeffrey Holzgrafe @jolzgrafe for this contribution
1212
- `Path`s can now be used to produce sharp angles, in addition to smooth bends. See [the Path documentation](https://phidl.readthedocs.io/en/latest/tutorials/waveguides.html#Sharp/angular-paths)
1313

@@ -30,7 +30,7 @@ If you found PHIDL useful, please consider citing it in (just one!) of your publ
3030

3131
# Installation / requirements
3232
- Install or upgrade with `pip install -U phidl`
33-
- Python version >=3.5
33+
- Python version >=3.6
3434
- If you are on Windows or Mac and don't already have `gdspy` installed, you will need a C++ compiler
3535
- For Windows + Python 3, install ["Build Tools for Visual Studio"](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) (make sure to check the "C++ build tools" checkbox when installing)
3636
- For Mac, install "Xcode" from the App Store, then run the command `xcode-select --install` in the terminal

docs/API.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ snspd_expanded
299299
.. autofunction:: phidl.geometry.snspd_expanded
300300

301301

302+
snspd_candelabra
303+
==============
304+
305+
.. autofunction:: phidl.geometry.snspd_candelabra
306+
307+
302308
straight
303309
========
304310

docs/gen_API.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class B(*):
6262
if os.stat(fwrite).st_size == 0:
6363
fw.write(
6464
"#" * len(main_header)
65-
+ "\n{}\n".format(main_header)
65+
+ f"\n{main_header}\n"
6666
+ "#" * len(main_header)
6767
+ "\n\n\n"
6868
)
@@ -81,7 +81,7 @@ class B(*):
8181
fread_header = fread_header.capitalize()
8282
fw.write(
8383
"*" * (len(fread_header) + len(sub_header))
84-
+ "\n{}{}\n".format(fread_header, sub_header)
84+
+ f"\n{fread_header}{sub_header}\n"
8585
+ "*" * (len(fread_header) + len(sub_header))
8686
+ "\n\n"
8787
)
@@ -116,14 +116,14 @@ class B(*):
116116
fw.write(name[0] + "\n")
117117
fw.write(("=" * len(name[0])) + "\n\n")
118118
if name[1] == "C":
119-
fw.write(".. autoclass:: phidl.{}.{}\n".format(fread_name, name[0]))
119+
fw.write(f".. autoclass:: phidl.{fread_name}.{name[0]}\n")
120120
fw.write(
121121
" :members:\n"
122122
" :inherited-members:\n"
123123
" :show-inheritance:\n\n\n"
124124
)
125125
else:
126-
fw.write(".. autofunction:: phidl.{}.{}\n\n\n".format(fread_name, name[0]))
126+
fw.write(f".. autofunction:: phidl.{fread_name}.{name[0]}\n\n\n")
127127
fw.close()
128128

129129

docs/geometry_reference.ipynb

Lines changed: 66 additions & 14 deletions
Large diffs are not rendered by default.

phidl/device_layout.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737

3838
import hashlib
39+
import numbers
3940
import warnings
4041
from copy import deepcopy as _deepcopy
4142

@@ -51,7 +52,7 @@
5152

5253
gdspy.library.use_current_library = False
5354

54-
__version__ = "1.6.1"
55+
__version__ = "1.6.2"
5556

5657

5758
# ==============================================================================
@@ -540,7 +541,7 @@ def _parse_layer(layer):
540541
gds_layer, gds_datatype = layer[0], 0
541542
elif layer is None:
542543
gds_layer, gds_datatype = 0, 0
543-
elif isinstance(layer, (int, float)):
544+
elif isinstance(layer, numbers.Number):
544545
gds_layer, gds_datatype = layer, 0
545546
else:
546547
raise ValueError(
@@ -1206,9 +1207,13 @@ def add_polygon(self, points, layer=np.nan):
12061207
layers = zip(points.layers, points.datatypes)
12071208
else:
12081209
layers = [layer] * len(points.polygons)
1209-
return [
1210-
self.add_polygon(p, layer) for p, layer in zip(points.polygons, layers)
1211-
]
1210+
1211+
polygons = []
1212+
for p, layer in zip(points.polygons, layers):
1213+
new_polygon = self.add_polygon(p, layer)
1214+
new_polygon.properties = points.properties
1215+
polygons.append(new_polygon)
1216+
return polygons
12121217

12131218
if layer is np.nan:
12141219
layer = 0
@@ -1516,6 +1521,14 @@ def remove_layers(self, layers=(), include_labels=True, invert_selection=False):
15161521
p for p, keep in zip(polygonset.datatypes, polygons_to_keep) if keep
15171522
]
15181523

1524+
paths = []
1525+
for path in D.paths:
1526+
for layer in zip(path.layers, path.datatypes):
1527+
if layer not in layers:
1528+
paths.append(path)
1529+
1530+
D.paths = paths
1531+
15191532
if include_labels:
15201533
new_labels = []
15211534
for l in D.labels:
@@ -1907,7 +1920,6 @@ def __init__(
19071920
x_reflection=x_reflection,
19081921
ignore_missing=False,
19091922
)
1910-
self.parent = device
19111923
self.owner = None
19121924
# The ports of a DeviceReference have their own unique id (uid),
19131925
# since two DeviceReferences of the same parent Device can be
@@ -1916,6 +1928,14 @@ def __init__(
19161928
name: port._copy(new_uid=True) for name, port in device.ports.items()
19171929
}
19181930

1931+
@property
1932+
def parent(self):
1933+
return self.ref_cell
1934+
1935+
@parent.setter
1936+
def parent(self, value):
1937+
self.ref_cell = value
1938+
19191939
def __repr__(self):
19201940
"""Prints a description of the DeviceReference, including parent
19211941
Device, ports, origin, rotation, and x_reflection.

phidl/font.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _get_glyph(font, letter): # noqa: C901
9393
# If there is no postscript name, use the family name
9494
font_name = font.family_name.replace(" ", "_")
9595

96-
block_name = "*char_{}_0x{:2X}".format(font_name, ord(letter))
96+
block_name = f"*char_{font_name}_0x{ord(letter):2X}"
9797

9898
# Load control points from font file
9999
font.load_char(letter, freetype.FT_LOAD_FLAGS["FT_LOAD_NO_BITMAP"])

0 commit comments

Comments
 (0)