Ejemplo n.º 1
0
            diff = np.array(center_coordinates.interpolate(pos + padding / 2)) - np.array(
                center_coordinates.interpolate(pos - padding / 2))
            d1 = np.array((-diff[1], diff[0])) / np.linalg.norm(diff)
            for direction in [-1, 1]:
                point = Point(xy + direction * (offset + spacing / 2 * (i % 2)) * d1)
                if outline.contains(point):
                    new_circles = True
                if area_for_holes.contains(point):
                    circles.append(point.buffer(hole_radius))
        offset += spacing
    return unary_union(circles)


if __name__ == '__main__':
    from gdshelpers.geometry.chip import Cell
    from gdshelpers.parts.waveguide import Waveguide

    wg = Waveguide((0, 0), 0, [3, 3, 3, 3, 3])
    wg.add_straight_segment(5)
    wg.add_bend(np.pi / 2, 20)
    wg.width = 15
    wg.add_straight_segment(4)
    wg.add_bend(-np.pi / 2, 20)

    cell = Cell('vortex_traps')
    cell.add_to_layer(1, wg)
    cell.add_to_layer(2, fill_waveguide_with_holes_in_honeycomb_lattice(wg, 1, .1, .15))
    cell.add_to_layer(2, surround_with_holes(wg.get_shapely_outline(), 3, 1, 1, 15))
    cell.show()
    cell.save()
Ejemplo n.º 2
0
            for direction in [-1, 1]:
                point = Point(xy + direction * (offset + spacing / 2 *
                                                (i % 2)) * d1)
                if outline.contains(point):
                    new_circles = True
                if area_for_holes.contains(point):
                    circles.append(point.buffer(hole_radius))
        offset += spacing
    return cascaded_union(circles)


if __name__ == '__main__':
    from gdshelpers.geometry.chip import Cell
    from gdshelpers.parts.waveguide import Waveguide

    wg = Waveguide((0, 0), 0, [3, 3, 3, 3, 3])
    wg.add_straight_segment(5)
    wg.add_bend(np.pi / 2, 20)
    wg.width = 15
    wg.add_straight_segment(4)
    wg.add_bend(-np.pi / 2, 20)

    cell = Cell('vortex_traps')
    cell.add_to_layer(1, wg)
    cell.add_to_layer(
        2, fill_waveguide_with_holes_in_honeycomb_lattice(wg, 1, .1, .15))
    cell.add_to_layer(
        2, surround_with_holes(wg.get_shapely_outline(), 3, 1, 1, 15))
    cell.show()
    cell.save()