Home Forums Nazca Questions and Answers Circular array of a cell from a gds file – how to do it?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #6103
    Cameron
    Member

    I have created a cell in a separate layout software. The cell is a small object which needs to be arrayed, however my software only allows me to create square-shaped arrays. What I’d like to do is create a circular array of instances of my existing cell.

    So I’d like to first import my gds file which contains only the cell and the object of interest, and instance the cell therein into an array with an overall circular shape. It would be great if I could specify the total number of devices (and their spacing) to define the diameter of the circle, then the Nazca script would fill in the circle with as many complete instances of the object as will fit into that circle.

    Thank you in advance!

    #6105
    Ronald
    Keymaster

    Dear Cameron,

    GDS natively supports arrays on cell instances that span two vectors (dx1, dy1) and (dx2, dy2), not circles. For a circular array you have to place cells simply on a circle.

    from math import sin, cos, pi
    import nazca as nd
    
    cell = nd.load_gds(filename="my.gds", cellname="my_cell_name")
    
    with nd.Cell('circle') as C: 
        N = 20
        radius = 500
        for i in range(N):
            cell.put(radius*cos(i*2*pi/N), radius*sin(i*2*pi/N), 0)
     
    C.put()
    nd.export_gds()

    For a native cell array check out the gds arrays tutorial.

    Ronald

    #6106
    Cameron
    Member

    Just to clarify: I mean the elements in the array can be spaced equally in x and y directions from each other (i.e., it is a square array in that sense), however the bounds of the array (i.e., the length of any row or height of any column in the array) is defined by a circular shape. So a row across the center will have devices filling the diameter of the cirlce but a row near the edge of circule will be few or even just one device. So the whole array fills in circular area, although the spacing of devices is a simple fixed distance in x and y directions from each other.

    Thanks!

    • This reply was modified 5 months ago by Cameron.
    #6108
    Ronald
    Keymaster

    Dear Cameron,

    Only place the cells that are < radius from a center (x0, y0):

    from math import sqrt
    import nazca as nd
    
    cell = nd.load_gds(filename="my.gds", cellname="my_cell_name")
    
    with nd.Cell('circle') as C:
        N = 50
        M = 50
        dx = 40
        dy = 70
        x0 = 1000
        y0 = 1000
        radius = 1000
        for n in range(N):
            for m in range(M):
                x = dx*n
                y = dy*m
                if (x-x0)**2 + (y-y0)**2 < radius**2:
                    cell.put(x, y, 0)
    
    C.put()
    nd.export_gds()

    Ronald

    #6109
    Cameron
    Member

    Thank you a bunch Ronald, this is great! I have another question about wiring, but to keep the forum organized I’ll create a new topic.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.