Skip to content

Commit f9d8dd2

Browse files
authored
Merge pull request #87 from amccaugh/dev
1.4.3
2 parents 85b9901 + 4099fa0 commit f9d8dd2

File tree

9 files changed

+447
-124
lines changed

9 files changed

+447
-124
lines changed

CHANGELOG.md

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

3+
## 1.4.3 (Dec 11, 2020)
4+
5+
### New features
6+
- Added `open_ports` argument to `pg.outline`, which allows you to cut holes in the outline at Port locations on a Device. See the [outline reference here](https://phidl.readthedocs.io/en/latest/geometry_reference.html#Outline)
7+
8+
![phidl example image](https://amccaugh.github.io/phidl/outline_open_port.png)
9+
10+
- Easier-to-read quickstart tutorial
11+
- Added `num_squares` to `info` dictionary of `pg.optimal_step` (thanks Ekkehart Schmidt)
12+
13+
### Bugfixes
14+
- Fixed bug in `pp.smooth()` that forced paths to start out traveling to the right (orientation = 0 degrees) (thanks to Sebastian Pauka @spauka)
15+
16+
317
## 1.4.2 (Oct 7, 2020)
418

519
Bugfix release

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include LICENSE

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ GDS scripting that's intuitive, fast, and powerful. For Python 2 and 3.
66
- [**Installation / requirements**](#installation--requirements)
77
- [**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))
88
- [**Geometry library + function documentation**](https://phidl.readthedocs.io/)
9-
- [Changelog](https://github.com/amccaugh/phidl/blob/master/CHANGELOG.md) (latest update 1.4.2 (Oct 7, 2020))
9+
- [Changelog](https://github.com/amccaugh/phidl/blob/master/CHANGELOG.md) (latest update 1.4.3, Dec 12, 2020)
1010
- Added font support to `pg.text()` [more info here](https://phidl.readthedocs.io/en/latest/geometry_reference.html#Text)
1111
- Added waypoint-based pathing `pp.smooth()` [more info here](https://phidl.readthedocs.io/en/latest/tutorials/waveguides.html#Waypoint-based-path-creation)
1212
- You can now easily [`Group` objects together](https://phidl.readthedocs.io/en/latest/tutorials/group.html)

docs/geometry_reference.ipynb

Lines changed: 133 additions & 89 deletions
Large diffs are not rendered by default.

docs/tutorials/quickstart.ipynb

Lines changed: 259 additions & 26 deletions
Large diffs are not rendered by default.

phidl/device_layout.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#==============================================================================
77
# Minor TODO
88
#==============================================================================
9+
# Add Group.get_polygons()
10+
# Allow Boolean to use Groups
911
# Add Paths to quickplot2
1012
# Add pp.delay_sine(distance = 10, length = 20, num_periods = 2)
1113
# add wire_basic to phidl.routing. also add endcap parameter
@@ -53,7 +55,7 @@
5355
import gdspy.library
5456
gdspy.library.use_current_library = False
5557

56-
__version__ = '1.4.2'
58+
__version__ = '1.4.3'
5759

5860

5961
#==============================================================================

phidl/geometry.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,9 @@ def boolean(A, B, operation, precision = 1e-4, num_divisions = [1, 1],
579579
for polygon in polygons]
580580
return D
581581

582-
583582
def outline(elements, distance = 1, precision = 1e-4, num_divisions = [1, 1],
584583
join = 'miter', tolerance = 2, join_first = True,
585-
max_points = 4000, layer = 0):
584+
max_points = 4000, open_ports = False, layer = 0):
586585
""" Creates an outline around all the polygons passed in the `elements`
587586
argument. `elements` may be a Device, Polygon, or list of Devices.
588587
@@ -611,8 +610,13 @@ def outline(elements, distance = 1, precision = 1e-4, num_divisions = [1, 1],
611610
adjacent polygon sides.
612611
max_points : int
613612
The maximum number of vertices within the resulting polygon.
613+
open_ports : bool or float
614+
If not False, holes will be cut in the outline such that the Ports are
615+
not covered. If True, the holes will have the same width as the Ports.
616+
If a float, the holes will be be widened by that value (useful for fully
617+
clearing the outline around the Ports for positive-tone processes
614618
layer : int, array-like[2], or set
615-
Specific layer(s) to put polygon geometry on.
619+
Specific layer(s) to put polygon geometry on.)
616620
617621
Returns
618622
-------
@@ -621,18 +625,37 @@ def outline(elements, distance = 1, precision = 1e-4, num_divisions = [1, 1],
621625
"""
622626
D = Device('outline')
623627
if type(elements) is not list: elements = [elements]
628+
port_list = []
624629
for e in elements:
625-
if isinstance(e, Device): D.add_ref(e)
630+
if isinstance(e, Device):
631+
D.add_ref(e)
632+
port_list += list(e.ports.values())
626633
else: D.add(e)
627634
gds_layer, gds_datatype = _parse_layer(layer)
628635

629636
D_bloated = offset(D, distance = distance, join_first = join_first,
630637
num_divisions = num_divisions, precision = precision,
631638
max_points = max_points, join = join,
632639
tolerance = tolerance, layer = layer)
633-
Outline = boolean(A = D_bloated, B = D, operation = 'A-B',
640+
641+
Trim = Device()
642+
if open_ports is not False:
643+
if open_ports is True:
644+
trim_width = 0
645+
else:
646+
trim_width = open_ports*2
647+
for port in port_list:
648+
trim = compass(size=(distance + 6*precision,
649+
port.width + trim_width))
650+
trim_ref = Trim << trim
651+
trim_ref.connect('E', port, overlap = 2*precision)
652+
653+
Outline = boolean(A = D_bloated, B = [D,Trim], operation = 'A-B',
634654
num_divisions = num_divisions, max_points = max_points,
635655
precision = precision, layer = layer)
656+
if open_ports is not False and len(elements) == 1:
657+
for port in port_list:
658+
Outline.add_port(port=port)
636659
return Outline
637660

638661

@@ -4407,6 +4430,9 @@ def fh(eta):
44074430

44084431
ypts[-1] = end_width
44094432
ypts[0] = start_width
4433+
y_num_sq = np.array(ypts)
4434+
x_num_sq = np.array(xpts)
4435+
44104436
if symmetric == False:
44114437
xpts.append(xpts[-1])
44124438
ypts.append(0)
@@ -4445,6 +4471,7 @@ def fh(eta):
44454471
D.add_port(name = 2, midpoint = [max(xpts), 0], width = end_width,
44464472
orientation = 0)
44474473

4474+
D.info['num_squares'] = np.sum(np.diff(x_num_sq) /((y_num_sq[:-1] + y_num_sq[1:])/2) )
44484475
return D
44494476

44504477

phidl/path.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ def smooth(
351351
new_points.append( [points[-1,:]] )
352352
new_points = np.concatenate(new_points)
353353

354-
P = Path(new_points)
354+
P = Path()
355+
P.rotate(theta[0])
356+
P.append(new_points)
355357
P.move(points[0,:])
356358

357359
return P

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
setup(name='phidl',
21-
version='1.4.2',
21+
version='1.4.3',
2222
description='PHIDL',
2323
long_description = long_description,
2424
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)