コード例 #1
0
def align_TE_on_via():

    cell = dl.Device("Align TE on VIA")

    circle = pg.circle(radius=50, layer=pt.LayoutDefault.layerVias)

    cross = pg.cross(width=30, length=250, layer=pt.LayoutDefault.layerVias)

    g = Group([circle, cross])

    g.align(alignment='x')
    g.align(alignment='y')
    circle.add(cross)

    viapattern = pg.union(circle, 'A+B', layer=pt.LayoutDefault.layerVias)

    TEpattern = pg.union(circle, 'A+B',
                         layer=pt.LayoutDefault.layerTop).copy('tmp',
                                                               scale=0.8)

    cell.add(viapattern)
    cell.add(TEpattern)

    cell.align(alignment='x')
    cell.align(alignment='y')

    cell.flatten()

    return cell
コード例 #2
0
    def draw(self):

        if self.shape == 'square':

            cell=pg.rectangle(size=(self.size,self.size),\
                layer=self.layer)

        elif self.shape == 'circle':

            cell=pg.circle(radius=self.size/2,\
            layer=self.layer)

        else:

            raise ValueError("Via shape can be \'square\' or \'circle\'")

        cell.move(origin=(0,0),\
            destination=self.origin.coord)

        cell.add_port(Port(name='conn',\
        midpoint=cell.center,\
        width=cell.xmax-cell.xmin,\
        orientation=90))

        return cell
コード例 #3
0
    C4 = make_device(complicated_waveguide, config=cwg_parameters, height=h)
    c4 = D.add_ref(C4)
    c4.ymin = D.ymax + 10
qp(D)

#==============================================================================
# Keeping track of geometry using the "alias" functionality
#==============================================================================
# It can be useful to keep track of our DeviceReferences without
# needing to assign the reference to a variable.  We can do this by specifying
# an 'alias' for the added DeviceReference.

# For instance, if we wanted to keep track of a circle references twice in D,
# we might normally assign each reference to a separate variable:
D = Device()
C = pg.circle()
c1 = D.add_ref(C)  # Add first reference
c2 = D.add_ref(C)  # Add second reference
c2.x += 15  # Move the second circle over by 15
qp(c2)
qp(D)

# But rather than cluttering up the list of variables with these refernces,
# we can instead create 'aliases' to each reference, and call them directly
# out of D like you would with a Python dictionary.  For example:
D = Device()
C = pg.circle()
D.add_ref(C, alias='circle1')  # Add first reference
D['circle2'] = D.add_ref(C)  # Add second reference in a different style
D['circle3'] = D << C  # Add third reference in yet another way!
コード例 #4
0
D = pg.cross(length = 10, width = 0.5, layer = 0)
qp(D) # quickplot the geometry
create_image(D, 'cross')

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

D = pg.ellipse(radii = (10,5), angle_resolution = 2.5, layer = 0)
create_image(D, 'ellipse')

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

D = pg.circle(radius = 10, angle_resolution = 2.5, layer = 0)
qp(D) # quickplot the geometry
create_image(D, 'circle')

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

D = pg.ring(radius = 5, width = 0.5, angle_resolution = 2.5, layer = 0)
qp(D) # quickplot the geometry
create_image(D, 'ring')

# example-arc
import phidl.geometry as pg
from phidl import quickplot as qp
コード例 #5
0
def test_circle():
    D = pg.circle(radius=10, angle_resolution=2.5, layer=0)
    h = D.hash_geometry(precision=1e-4)
    assert (h == '15a748245d7bdfd4987f081e1494b41096e9c95a')
コード例 #6
0
def some_device(width=10, height=20):
    D = Device('somedevice')
    r1 = D << pg.rectangle((width, height), layer=some_layer)
    r2 = D << pg.circle(radius=width, layer=some_layer)
    r2.movex(30)
    return D