예제 #1
0
    def __init__(self, params):

        SividdleDevice.__init__(self, name='etchslab')

        # retrieve parameters
        self.id_string = params['id_string']
        self.expose_layer = params['expose_layer']
        self.label_layer = params['label_layer']
        self.length_slab = params['length_slab']
        self.width_slit = params['width_slit']
        self.width_slab = params['width_slab']

        slit = pg.rectangle(size=(self.width_slit, self.length_slab),
                            layer=self.expose_layer).rotate(90)

        self << pg.copy(slit).movey((self.width_slit + self.width_slab) * 0.5)
        self << pg.copy(slit).movey(-(self.width_slit + self.width_slab) * 0.5)
        self.add_label(text='{} \n slab_width = {:.2f} \
                \n slit_width = {:.2f} \
                \n slab_length = {:.2f}'.format(self.id_string,
                                                self.width_slab,
                                                self.width_slit,
                                                self.length_slab),
                       position=(self.xmin, self.ymax),
                       layer=self.label_layer)

        # Shift center of bounding box to origin.
        self.center = [0, 0]
예제 #2
0
def test_copy_deepcopy():
    D = Device()
    A = pg.ellipse(radii=(10, 5), angle_resolution=2.5, layer=1)
    B = pg.ellipse(radii=(10, 5), angle_resolution=2.5, layer=1)
    a = D << A
    b1 = D << B
    b2 = D << B

    Dcopy = pg.copy(D)
    Ddeepcopy = pg.deepcopy(D)
    h = D.hash_geometry(precision=1e-4)
    assert (h == '0313cd7e58aa265b44dd1ea10265d1088a2f1c6d')
    h = Dcopy.hash_geometry(precision=1e-4)
    assert (h == '0313cd7e58aa265b44dd1ea10265d1088a2f1c6d')
    h = Ddeepcopy.hash_geometry(precision=1e-4)
    assert (h == '0313cd7e58aa265b44dd1ea10265d1088a2f1c6d')

    D << pg.ellipse(radii=(12, 5), angle_resolution=2.5, layer=2)
    h = D.hash_geometry(precision=1e-4)
    assert (h == '856cedcbbb53312ff839b9fe016996357e658d33')
    h = Dcopy.hash_geometry(precision=1e-4)
    assert (h == '0313cd7e58aa265b44dd1ea10265d1088a2f1c6d')
    h = Ddeepcopy.hash_geometry(precision=1e-4)
    assert (h == '0313cd7e58aa265b44dd1ea10265d1088a2f1c6d')

    A.add_ref(pg.ellipse(radii=(12, 5), angle_resolution=2.5, layer=2))
    B.add_polygon([[3, 4, 5], [6.7, 8.9, 10.15]], layer=0)
    h = D.hash_geometry(precision=1e-4)
    assert (h == 'c007b674e8053c11c877860f0552fff18676b68e')
    h = Dcopy.hash_geometry(precision=1e-4)
    assert (h == '2590bd786348ab684616eecdfdbcc9735b156e18')
    h = Ddeepcopy.hash_geometry(precision=1e-4)
    assert (h == '0313cd7e58aa265b44dd1ea10265d1088a2f1c6d')
# Device D using the pg.copy(D) or pg.deepcopy(D) function.  pg.copy(D)
# maintains the underlying connections to other Device, so that newly-created
# Device uses the same references as the original device.  Conversely,
# pg.deepcopy() creates completely new copies of every underlying polygon and
# reference, so that the newly-created Device shares no dependencies/references
# with the original Device.  These functions are especially useful if
# you want to flatten a geometry without damaging the structure of the
# original Device.

D = Device()
E1 = pg.ellipse(layer=1)
E2 = pg.rectangle(layer=2)
D.add_ref(E1)
D.add_ref(E2).movex(15)

D_copied = pg.copy(D)
qp(D_copied)

# Observe that if we add geometry to D now, D_copied is unaffected
D.add_ref(pg.circle())
D.rotate(45)
qp(D_copied)

# However, note that if we now modify the underlying Devices (which
# were referenced in D, and whose references were copied to D_copied), both
# the original D and D_copied are affected:
E1.add_polygon([[10, 20, 35], [1, 60, 40]], layer=3)
qp(D_copied)

# If instead we use pg.deepcopy(), all of the underlying references are copied
# and used in the new D_deepcopied device.  So if we change one of the old
예제 #4
0
def connect(x2, y2, middle_e_width, chip_width, chip_height, pos, radius,
            length, e_e_gap, setpos):
    mm = 10**3
    um = 1

    M = Path()
    # Dimensions
    margin = 0.5 * mm
    to_pad_term = 0.1 * mm
    pad = 50 * um
    pitch = 100 * um
    side_e_width = middle_e_width * 2
    rad_gap = e_e_gap + middle_e_width / 2 + side_e_width / 2

    if pos == 't':
        Rt = radius + rad_gap * 2
    elif pos == 'm':
        Rt = radius + rad_gap
    else:
        Rt = radius

    if setpos == 't':
        set_bias = 0.6 * mm
    elif setpos == 'm':
        set_bias = 0.3 * mm
    else:
        set_bias = 0

    x1 = (chip_width - length) / 2 - Rt - set_bias
    y1 = margin + to_pad_term
    points = np.array([(x1, y1), (x1, y2), (x2, y2)])
    points = rotate90(points)

    M = pp.smooth(
        points=points,
        radius=Rt,
        corner_fun=pp.arc,
    )
    M.rotate(90)

    X = CrossSection()
    if pos == 'm':
        X.add(width=middle_e_width, offset=0, layer=3)
    else:
        X.add(width=side_e_width, offset=0, layer=3)

    L = M.extrude(X)  #Left Trace

    if pos == 'm':
        # adding pads
        S = pg.rectangle(size=(pad, pad), layer=3)
        L.add_ref(S).move([x1 - pad / 2, margin])
        L.add_ref(S).move([x1 - pad / 2 - pitch, margin])
        L.add_ref(S).move([x1 - pad / 2 + pitch, margin])

        xm1 = x1 - middle_e_width / 2
        xm2 = x1 + middle_e_width / 2
        xm3 = x1 + pad / 2
        xm4 = x1 - pad / 2
        xpts = (xm1, xm2, xm3, xm4)
        ypts = (y1, y1, margin + pad, margin + pad)
        L.add_polygon([xpts, ypts], layer=3)

        xt1 = xm1 + middle_e_width + e_e_gap
        xt2 = xt1 + side_e_width
        xt3 = xm3 + pitch
        xt4 = xm4 + pitch
        xpts = (xt1, xt2, xt3, xt4)
        ypts = (y1, y1, margin + pad, margin + pad)
        L.add_polygon([xpts, ypts], layer=3)

        xb1 = xm1 - side_e_width - e_e_gap
        xb2 = xm1 - e_e_gap
        xb3 = xm3 - pitch
        xb4 = xm4 - pitch
        xpts = (xb1, xb2, xb3, xb4)
        ypts = (y1, y1, margin + pad, margin + pad)
        L.add_polygon([xpts, ypts], layer=3)

    R = pg.copy(L)  # Right Trace
    R.mirror((chip_width / 2, chip_height), (chip_width / 2, 0))

    D = Device('trace')
    D << L
    D << R
    return D
예제 #5
0
from phidl import quickplot as qp
from phidl import Device

E = Device()
E.add_ref(pg.ellipse(layer = {0,1}))
#X = pg.ellipse(layer = {0,1})
D = pg.extract(E, layers = [0,1])
qp(D) # quickplot the geometry
create_image(D, 'extract')

# example-copy
import phidl.geometry as pg
from phidl import quickplot as qp

X = pg.ellipse()
D = pg.copy(X)
qp(D) # quickplot the geometry
create_image(D, 'copy')

# example-deepcopy
import phidl.geometry as pg
from phidl import quickplot as qp

X = pg.ellipse()
D = pg.deepcopy(X)
qp(D) # quickplot the geometry
create_image(D, 'deepcopy')

# example-copy_layer
import phidl.geometry as pg
from phidl import quickplot as qp
예제 #6
0
y_p = 0

#electrode size and spacing
x_s = 100 * um
y_s = ΔY
x_space = 50 * um

#First one is ground
for i in range(0, 8):
    D << pg.rectangle(size=(x_s, y_s), layer=70).move(
        [x_p + (i * (x_s + x_space)), y_p])

D.write_gds('mac_0.gds')

##make the final layout with all of the device copies and whatnot##

for i in range(0, 9):
    D_cpy = pg.copy(D)
    T << D_cpy.move([0, Y0 + i * ΔY - height / 2])

#Extend electrodes to top and bottom of chip
y_s = y_s + 728
ebond_yoff = 11208
for i in range(0, 8):
    T << pg.rectangle(size=(x_s, y_s), layer=70).move(
        [x_p + (i * (x_s + x_space)), y_p])
    T << pg.rectangle(size=(x_s, y_s), layer=70).move(
        [x_p + (i * (x_s + x_space)), y_p + ebond_yoff])

T.write_gds('mac_0_final.gds')