コード例 #1
0
def _example():
    from gdshelpers.geometry.chip import Cell
    from gdshelpers.parts.waveguide import Waveguide
    from gdshelpers.parts.resonator import RingResonator

    # ==== create some sample structures (straight line with ring resonator)
    wg = Waveguide(origin=(0, 0), angle=np.deg2rad(-90), width=1)
    wg.add_straight_segment(length=5)
    wg.add_bend(np.pi / 2, 5)
    wg2 = Waveguide.make_at_port(wg.current_port)
    wg2.add_straight_segment(15)
    reso = RingResonator.make_at_port(port=wg2.current_port, gap=0.2, radius=5)
    wg2.add_straight_segment(length=15)
    coupler2 = GratingCoupler.make_traditional_coupler_from_database_at_port(
        wg2.current_port, db_id='si220', wavelength=1550)

    underetching_parts = geometric_union([wg2, reso, coupler2])
    structure = geometric_union([underetching_parts, wg])
    # create the holes with a radius of 0.5 microns, a distance of 2 microns to the structure borders and
    # a distance of 2 microns between the holes
    holes = create_holes_for_under_etching(underetch_parts=underetching_parts,
                                           complete_structure=structure,
                                           hole_radius=0.5,
                                           hole_distance=2,
                                           hole_spacing=3,
                                           hole_length=3)

    # create a cell with the structures in layer 1 and the holes in layer 2
    cell = Cell('CELL')
    cell.add_to_layer(1, structure)
    cell.add_to_layer(2, holes)
    # Show the cell
    cell.show()
コード例 #2
0
ファイル: resonator.py プロジェクト: philomathie/gdshelpers
def _example():
    from gdshelpers.geometry.chip import Cell

    cell = Cell('test')

    wg1 = Waveguide.make_at_port(Port((0, 0), 0, 1.))
    wg1.add_straight_segment(100)
    ring1 = RingResonator.make_at_port(wg1.current_port,
                                       1.,
                                       50.,
                                       race_length=30,
                                       straight_feeding=True,
                                       draw_opposite_side_wg=True)

    wg2 = Waveguide.make_at_port(ring1.port)
    wg2.add_straight_segment(100)
    ring2 = RingResonator.make_at_port(wg2.current_port,
                                       1.,
                                       50.,
                                       vertical_race_length=30,
                                       straight_feeding=True,
                                       draw_opposite_side_wg=True)

    wg3 = Waveguide.make_at_port(ring2.port)
    wg3.add_straight_segment(100)
    ring3 = RingResonator.make_at_port(wg3.current_port,
                                       -1.,
                                       50.,
                                       vertical_race_length=30,
                                       straight_feeding=True,
                                       draw_opposite_side_wg=True)

    cell.add_to_layer(1, wg1, ring1, wg2, ring2, wg3, ring3)
    cell.show()
コード例 #3
0
def example():
    start_port = Port((0, 0), 0.5 * np.pi, 1.)
    wg1 = Waveguide.make_at_port(start_port)
    wg1.add_straight_segment(100.)
    # wg1.add_bend(0, 60.)
    detector = SNSPD.make_at_port(wg1.current_port, **snspd_parameters)
    wg = detector.get_waveguide()
    electrodes = detector.get_electrodes()
    pl = detector.get_passivation_layer(passivation_buffer=0.2)

    wg2 = Waveguide.make_at_port(detector.current_port)
    wg2.add_straight_segment(50.)
    # cell = gdsCAD.core.Cell('test')
    cell = Cell('test')
    cell.add_to_layer(3, Point(detector.get_aux_top()[0]).buffer(0.05))
    cell.add_to_layer(4, Point(detector.get_aux_top()[1]).buffer(0.05))
    cell.add_to_layer(3, Point(detector.get_aux_bottom()[0]).buffer(0.05))
    cell.add_to_layer(4, Point(detector.get_aux_bottom()[1]).buffer(0.05))
    cell.add_to_layer(3, wg1)

    cell.add_to_layer(1, detector)
    cell.add_to_layer(2, detector.get_waveguide())
    cell.add_to_layer(6, detector.get_electrodes())
    cell.add_to_layer(5, pl)

    # cell.add_to_layer(6, detector.right_electrode_port.debug_shape)
    # cell.add_to_layer(6, detector.left_electrode_port.debug_shape)
    cell.add_to_layer(3, wg2)
    cell.save('SNSPD_test.gds')
    cell.show()
コード例 #4
0
def _example():
    from gdshelpers.geometry.chip import Cell
    from gdshelpers.parts.port import Port
    from gdshelpers.parts.waveguide import Waveguide
    from gdshelpers.parts.mode_converter import StripToSlotModeConverter

    wg_1 = Waveguide.make_at_port(
        Port(origin=(0, 0), angle=0,
             width=1.2))  # scalar as width -> strip waveguide
    wg_1.add_straight_segment(5)

    mc_1 = StripToSlotModeConverter.make_at_port(
        wg_1.current_port, 5, [0.4, 0.2, 0.4], 2,
        0.2)  # array as width -> slot waveguide

    wg_2 = Waveguide.make_at_port(mc_1.out_port)
    wg_2.add_bend(angle=np.pi, radius=5)

    mc_2 = StripToSlotModeConverter.make_at_port(
        wg_2.current_port, 5, 1, 2, 0.2)  # scalar as width -> strip waveguide

    wg_3 = Waveguide.make_at_port(mc_2.out_port)
    wg_3.add_straight_segment(5)

    cell = Cell('CELL')
    cell.add_to_layer(1, wg_1, mc_1, wg_2, mc_2, wg_3)
    cell.show()
コード例 #5
0
def _example():
    from gdshelpers.geometry.chip import Cell
    from gdshelpers.parts.splitter import Splitter
    from gdshelpers.parts.coupler import GratingCoupler

    port = Port([0, 0], 0, 1)
    path = Waveguide.make_at_port(port)

    path.add_straight_segment(10)
    path.add_bend(np.pi / 2, 10, final_width=0.5)
    path.add_bend(-np.pi / 2, 10, final_width=1)
    path.add_arc(np.pi * 3 / 4, 10, )

    splitter = Splitter.make_at_root_port(path.current_port, 30, 10)
    path2 = Waveguide.make_at_port(splitter.right_branch_port)
    path2.add_bend(-np.pi / 4, 10)

    n = 10
    path2.add_parameterized_path(lambda t: (n * 10 * t, np.cos(n * 2 * np.pi * t) - 1),
                                 path_derivative=lambda t: (n * 10, -n * 2 * np.pi * np.sin(n * 2 * np.pi * t)),
                                 width=lambda t: np.cos(n * 2 * np.pi * t) * 0.2 + np.exp(-t) * 0.3 + 0.5,
                                 width_function_supports_numpy=True)
    path2.add_straight_segment(10, width=[.5, .5, .5])
    print(path2.length)
    print(path2.length_last_segment)

    path2.add_cubic_bezier_path((0, 0), (5, 0), (10, 10), (5, 10))
    path2.add_bend(-np.pi, 40)

    coupler1 = GratingCoupler([100, 50], 0, 1, np.deg2rad(30), [10, 0.1, 2, 0.1, 2], start_radius_absolute=True)

    path3 = Waveguide((0, -50), np.deg2rad(0), 1)
    path3.add_bezier_to(coupler1.port.origin, coupler1.port.inverted_direction.angle, bend_strength=50)

    splitter2 = Splitter.make_at_left_branch_port(splitter.left_branch_port, 30, 10, wavelength_root=2)

    path4 = Waveguide.make_at_port(splitter2.root_port)
    path4.add_straight_segment(20)
    path4.width = 1
    path4.add_straight_segment(20)

    empty_path = Waveguide.make_at_port(path4.current_port)

    whole_layout = (path, splitter, path2, splitter2, coupler1, path3, path4, empty_path)

    layout = Cell('LIBRARY')
    cell = Cell('TOP')
    cell.add_to_layer(1, *whole_layout)
    cell.add_to_layer(2, empty_path)
    cell.add_to_layer(4, splitter.root_port.debug_shape)

    layout.add_cell(cell)

    cell_df = Cell('TOP_DF')
    cell_df.add_to_layer(1, convert_to_positive_resist(whole_layout, buffer_radius=1.5))
    layout.add_cell(cell_df)

    layout.save('output.gds')
    cell.show()
コード例 #6
0
def _example():
    from gdshelpers.geometry.chip import Cell

    img = GdsImage([0, 0], "wolfram_monochrome_100.png", 10)

    cell = Cell('TEST_IMAGE')
    cell.add_to_layer(1, img)
    cell.show()
    return cell
コード例 #7
0
ファイル: logo.py プロジェクト: philomathie/gdshelpers
def _example():
    from gdshelpers.geometry.chip import Cell

    kit_logo = KITLogo([0, 0], 1)
    wwu_logo = WWULogo([0, 0], 1, 1)

    cell = Cell('LOGOS')
    cell.add_to_layer(1, kit_logo)
    cell.add_to_layer(1, translate(wwu_logo.get_shapely_object(), 2.5))
    cell.show()
コード例 #8
0
def _example():
    text = Text([100, 100], 10, 'The quick brown fox jumps over the lazy dog\n123\n4567',
                alignment='left-bottom', angle=0.1)
    print(text.bounding_box)

    from gdshelpers.geometry.chip import Cell

    cell = Cell('FONTS')
    cell.add_to_layer(2, shapely.geometry.box(*text.bounding_box.reshape(4)))
    cell.add_to_layer(1, text)
    cell.show()
コード例 #9
0
def _example():
    from gdshelpers.geometry.chip import Cell

    wg = Waveguide((0, 0), 1, 1)
    wg.add_straight_segment(30)
    spiral = Spiral.make_at_port(wg.current_port, 2, 5, 50)
    wg2 = Waveguide.make_at_port(spiral.out_port)
    wg2.add_straight_segment(100)

    print(spiral.length)

    cell = Cell('Spiral')
    cell.add_to_layer(1, wg, spiral, wg2)
    cell.show()
コード例 #10
0
def _example():
    from gdshelpers.geometry.chip import Cell
    from gdshelpers.geometry import geometric_union

    # Generate a coupler, which ought to be identical to
    # coupler_sn330_1550_bf_ff_ap( 0:0 1550 0.7 22 0.96 10 22 1 "active")
    # also known as
    # coupler_bf_ap_mff( 0:0 1 40.0 1.13 0.7 22 0.96 10 22 200 "active")
    coupler = GratingCoupler.make_traditional_coupler([150, 0],
                                                      1,
                                                      np.deg2rad(40),
                                                      1.13,
                                                      0.7,
                                                      22,
                                                      0.96,
                                                      10,
                                                      22,
                                                      angle=-np.pi)

    coupler2 = GratingCoupler.make_traditional_coupler_from_database([0, 0], 1,
                                                                     'sn330',
                                                                     1550)

    print(coupler.get_description_str())

    whole_layout = (coupler, coupler2)

    layout = Cell('LIBRARY')
    cell = Cell('TOP')
    cell.add_to_layer(1, *whole_layout)
    cell.add_to_layer(StandardLayers.parnamelayer1,
                      coupler.get_description_text())
    cell.add_to_layer(StandardLayers.parnamelayer1,
                      coupler2.get_description_text())

    cell.add_to_layer(1, coupler.get_description_text())
    cell.add_to_layer(1, coupler2.get_description_text())
    cell.add_to_layer(1, coupler2.get_description_text(side='left'))
    layout.add_cell(cell)

    # We could also easily generate a dark field layout out of this
    def make_dark_field(obj, buffer_size=1.5):
        return obj.buffer(buffer_size).difference(obj)

    cell_df = Cell('TOP_DF')
    cell_df.add_to_layer(2, make_dark_field(geometric_union(whole_layout)))
    layout.add_cell(cell_df)

    layout.save('coupler.gds')
    cell.show()
コード例 #11
0
ファイル: optical_codes.py プロジェクト: ydwu0810/gdshelpers
def _example():
    qr_code = QRCode([0, 0], 'A0.0', 1.0, version=1, error_correction=QRCode.ERROR_CORRECT_M)

    from gdshelpers.geometry.chip import Cell

    device = Cell('test')
    device.add_to_layer(1, qr_code)

    device.show()

    chip = Cell('optical_codes')
    chip.add_cell(device)
    chip.start_viewer()
    chip.save()
コード例 #12
0
ファイル: snspd.py プロジェクト: philomathie/gdshelpers
def _example():
    from gdshelpers.geometry.chip import Cell

    cell = Cell('test')

    wg1 = Waveguide((0, 0), 0.5 * np.pi, 1.)
    wg1.add_straight_segment(10.)
    cell.add_to_layer(3, wg1)

    detector = SNSPD.make_at_port(wg1.current_port, nw_width=0.1, nw_gap=0.1, nw_length=70, passivation_buffer=0.2,
                                  waveguide_tapering=True)
    cell.add_to_layer(1, detector)
    cell.add_to_layer(2, detector.get_waveguide())
    cell.add_to_layer(5, detector.get_passivation_layer())

    # cell.add_to_layer(6, detector.right_electrode_port.debug_shape)
    # cell.add_to_layer(6, detector.left_electrode_port.debug_shape)
    wg2 = Waveguide.make_at_port(detector.current_port)
    wg2.add_straight_segment(20.)
    cell.add_to_layer(3, wg2)
    cell.save('SNSPD_test.gds')
    cell.show()
コード例 #13
0
ファイル: ntron.py プロジェクト: philomathie/gdshelpers
        x_off = self.origin[0] + np.cos(self._angle) * x - np.sin(
            self._angle) * y
        y_off = self.origin[1] + np.sin(self._angle) * x + np.cos(
            self._angle) * y

        return Port((x_off, y_off), self._angle - np.pi / 2,
                    self._outer_channel_width)


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

    part1 = Ntron(origin=(5, -5),
                  angle=0,
                  gate_width_1=0.3,
                  gate_width_2=0.06,
                  choke_width_1=0.06,
                  choke_width_2=0.015,
                  choke_length_2=0.06,
                  choke_length_3=0.03)
    wgdrain = Waveguide.make_at_port(part1.port_drain)
    wgdrain.add_straight_segment(0.5)
    wggate = Waveguide.make_at_port(part1.port_gate)
    wggate.add_straight_segment(0.5)
    wgsource = Waveguide.make_at_port(part1.port_source)
    wgsource.add_straight_segment(0.5)
    cell = Cell('_channel')
    cell.add_to_layer(1, part1)
    cell.show()
コード例 #14
0
                                               datatype)
            if sub_geometry.is_empty:
                continue
            sub_geometry = scale(
                sub_geometry, *[reference.magnification] *
                2) if reference.magnification else sub_geometry
            sub_geometry = scale(
                sub_geometry, -1) if reference.x_reflection else sub_geometry
            sub_geometry = rotate(
                sub_geometry, reference.rotation,
                origin=(0, 0)) if reference.rotation else sub_geometry
            sub_geometry = translate(sub_geometry, *reference.origin)
            geometry.extend(sub_geometry)

        return MultiPolygon(geometry)

    def get_shapely_object(self):
        return self.get_as_shapely(self.cell_name, self.layer, self.datatype)


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

    _example()  # make sure the "output.gds" exists

    test_cell = Cell('test')
    test_cell.add_to_layer(1,
                           GDSIIImport('output.gds', cell_name='TOP', layer=1))
    test_cell.show()
コード例 #15
0
        self.add_dlw_data('taper', str(label), {'origin': taper_port.origin.tolist(), 'angle': port.angle,
                                                'starting_width': port.width, 'taper_length': taper_length})
        if with_markers:
            for i, (v, l) in enumerate(itertools.product((-20, 20), (taper_length, 0))):
                self.add_dlw_marker(str(label) + '-' + str(i), layer,
                                    port.parallel_offset(v).longitudinal_offset(l).origin)


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

    # Create a cell-like object that offers a save output command '.save' which creates the .gds or .oas file by using
    # gdsCAD,gdspy or fatamorgana
    device_cell = Cell('my_cell')
    # Create a port to connect waveguide structures to
    port = Port(origin=(0, 0), width=1, angle=0)
    waveguide = Waveguide.make_at_port(port)
    for i in range(9):
        waveguide.add_bend(angle=np.pi, radius=60 + i * 40)
    # Add direct laser writing taper and alignment marker for postprocessing with a dlw printer to the cell-like object.
    # The cell dlw files will be saved with the cell.
    device_cell.add_dlw_taper_at_port('A0', 2, port.inverted_direction, 30)
    device_cell.add_dlw_taper_at_port('A1', 2, waveguide.current_port, 30)
    device_cell.add_to_layer(1, waveguide)
    device_cell.show()
    # Creates the output file by using gdspy,gdsCAD or fatamorgana. To use the implemented parallell processing, set
    # parallel=True.
    device_cell.save(name='my_design', parallel=True, library='gdspy')