Forum Replies Created

Viewing 20 posts - 1 through 20 (of 69 total)
  • Author
    Posts
  • in reply to: Get annotation locations from GDS #7078
    Xaveer
    Moderator

    Dear Edgars,

    I think the following should do what you want, or, at least, point you in the right direction.

    import nazca as nd
    gds = nd.load_gds(filename='my_file.gds', topcellsonly=False, asdict=False)
    for params in nd.cell_iter(gds, revisit=True):
      if params.cell_start:
        name = params.cell.cell_name
          for name not in Device_dictionary:
            continue
          # get cell's translation (pointer) and flip w.r.t. cell_top
          pointer, flip = params.transflip_glob
          for annot, xy in params.iters['annotation']:
            if flip:
              p = nd.Pointer(xy[0], -xy[1])
            else:
              p = nd.Pointer(*xy)
            # add pin position in the cell to the cell translation.
            print(name, pointer.copy().move_ptr(p).xya())

    Xaveer

    • This reply was modified 1 year, 9 months ago by Xaveer.
    • This reply was modified 1 year, 9 months ago by Katarzyna.
    • This reply was modified 1 year, 9 months ago by Katarzyna.
    in reply to: Pickling of Nazca cells #7060
    Xaveer
    Moderator

    Dear Szilard,

    I’m not sure what complex cells you create that take minutes to build. Maybe there is a better way to create them. But I would need more information to be of help, if possible.

    For an alternative to pickling, I would suggest you try to just generate one or more libraries of cell objects in one or more GDS files. Writing those should be quite efficient and can be done in parallel.

    In writing you would lose nazca-specific information, but in your case that is probably not an issue.

    A final script would then read the libraries and place the cells. I’m not sure if it would be more efficient than what you’ve tried, but I think it’s easy to implement and worth a try.

    Xaveer

    in reply to: Low Vertex Count in Bend Polygons #6948
    Xaveer
    Moderator

    Dear Lomuc,

    The discretization depends on the setting of the accuracy of the layer)(s) that you draw on. Setting this to 0.001 (1nm) will be good for optical waveguides. It specifies the maximum deviation from the (mathematical) curve. Using a larger setting can be used to reduce the number of points e.g. for metal routing. An example can be found in this post: https://nazca-design.org/forums/topic/angular-discretization-for-bends/

    Xaveer

    in reply to: Import/Export Oasis #6943
    Xaveer
    Moderator

    Dear Lorenzo,

    There are no plans at the moment to support OASIS directly from Nazca.

    But you can easily convert to-from GDS with KLayout, which also comes with command line utilities: strm2oas and strm2gds (no need for the GUI). You can also use KLayout’s python bindings, which could make it (almost) transparent.

    Xaveer

    in reply to: Pins do not seem to be functioning correctly #6873
    Xaveer
    Moderator

    Dear p.forde,

    Indeed, something simple you’re missing: the name you assign to the new cell object (ECC) is the same as the name you assign to the loaded GDS cell (ECC). They should be different as they refer to different objects.

    Xaveer

    in reply to: Angular discretization for bends #6844
    Xaveer
    Moderator

    Dear Jnojic,

    The discretization of bends and other curved interconnects is determined by the accuracy settings of the layer that is written to.

    This example illustrates this:

    import nazca as nd
    nd.add_layer(“one”, layer=1, accuracy=0.1)
    nd.add_layer(“two”, layer=2, accuracy=0.001)
    nd.bend(radius=10, width=2, angle=90, layer=”one”).put(0, 3)
    nd.bend(radius=10, width=2, angle=90, layer=”two”).put(3, 0)
    nd.export_gds()

    The accuracy specifies the maximum deviation from the ideal shape.

    Xaveer

    in reply to: Waveguide roughness #6821
    Xaveer
    Moderator

    Dear Neetesh,

    In principle any geometric shape can be handled by Nazca. I don’t know how practical that will be for studying the roughness roughness in waveguides. There is not a specific functionality implemented for this.

    There is literature on this which might provide a useful solution to your problem, e.g. Melati et al. “A unified approach for radiative losses and backscattering in optical waveguides”, J. of Optics, Vol. 16, 5, 2014.

    Xaveer

    in reply to: Image import: concentric shapes #6808
    Xaveer
    Moderator

    Dear Wiebke,

    Your code should yield the correct result, provided the nazca version is sufficiently new (>= 0.5.13). For that version, make sure that pyclipper is installed (see step 3. of the installation instructions, https://nazca-design.org/installation/).

    For newer versions of nazca, you can alternatively use the ‘merge=False’ argument to the nazca.image() call.

    Xaveer

    in reply to: Fixed Length Waveguide Spiral #6797
    Xaveer
    Moderator

    Hi,

    I’m afraid that there is no standard spiral component in Nazca, so you’ll have to do it yourself!

    Xaveer

    in reply to: Trying to get nazca.trace() to work #6779
    Xaveer
    Moderator

    Dear Raj Patel,

    The path length was not implemented for sine bends. This is fixed and will be in a future release of nazca.

    For now you can use this workaround to calculate the arc length of the center line of the sinebend yourself:

    from scipy.integrate import quad
    from math import sin, pi, sqrt
    
    def length_sinebend(distance, offset):
        def arc_len_sinebend(t, d=distance, s=offset):
            return s / (2 * pi) * sqrt((d / s) ** 2 + (1 - sin(t)) ** 2)
        return quad(arc_len_sinebend, 0, 2 * pi)[0]
    
    # wg=lx.ads.sinebend(distance=1000, offset=1000).put(5000, 10000)
    mylength = length_sinebend(1000, 1000)
    print(mylength)

    Xaveer

    Xaveer
    Moderator

    Dear bhchoi98,

    It should work as advertised. The default pixel size is one micron and the default image size is 256 pixels. You can change both. Keeping the default pixel size, this code produces both the normal and the inverted picture. Note that put(1000) will put the center of the image at (1000, 0) microns in the GDS file and that the size argument changes the resolution of the picture in the GDS file (it’s size in pixels).

    import nazca as nd
    nd.image(‘testimg.png’, size=1000, invert=True, layer=1).put(1000)
    nd.image(‘testimg.png’, size=1000, invert=False, layer=2).put(1000)
    nd.export_gds()

    See the documentation at https://nazca-design.org/manual/nazca.html?highlight=image#nazca.bb_util.image

    Hope that works.

    Xaveer

    in reply to: OCR B font #6743
    Xaveer
    Moderator

    Dear Lorenzo,

    The pickle command should be:

    pickle.dump((version, height, inter_character_space, font), fontfile)

    where version can be anything, height is the font height, measured from lowest (e.g. “j”) to highest (e.g. “A”), inter_character_space is just that, font is the dictionary with the (any) character as key and a list of polygons (x,y tuples) as value. Fontfile is the name of the .nft file to write.

    Xaveer

    in reply to: OCR B font #6736
    Xaveer
    Moderator

    Dear Lorenzo,

    The order should not matter. It is a dictionaly lookup. You use a different font by specifying something like my_font = nd.Font(‘my_font_file’) and then my_font.text() should write the proper text. my_font_file.nft can be in your current directory, or you can specify the full path to the font file.

    You can get a sample of all characters in a font with my_font.sample(height=50).put() or a string with all characters in your font via my_font.characters()

    Hope that helps.

    Xaveer

     

    in reply to: OCR B font #6734
    Xaveer
    Moderator

    Dear Lorenzo,

    Great. I was working on documentation, but reverse engineering should indeed not be too difficult. Glad you found a way to do it.

    Xaveer

    in reply to: Connection offset issue #6726
    Xaveer
    Moderator

    Dear Neetesh,

    I can’t see the attachment, but I assume that you refer to the small (< 1 dbu) gaps. These cannot be avoided, because they are inherent to the integer rounding in GDS. See these two posts for a discussion:

    https://nazca-design.org/forums/topic/interconnect-module-error-in-drc-checking/

    https://nazca-design.org/forums/topic/nm-scale-offset-using-tp_viper-or-curve2polyline-pin-to-pin-at-an-angle/

    Xaveer

    in reply to: Connecting two different pins including rotation #6707
    Xaveer
    Moderator

    Dear Matthew,

    The standard way to do this is shown in the example below.

    import nazca as nd
    
     
    
    s = nd.strt(100, width=2).put(0, 0)  # default connecting pin is 'b0'
    
    # connects default s.pin['b0'] to default taper 'a0'
    
    nd.taper(width1=2, width2=10, length=100).put()
    
     
    
    s = nd.strt(100, width=2).put(0, 20)  # default connecting pin is 'b0'
    
    # connects default s.pin['b0'] to taper 'b0'
    
    nd.taper(width1=2, width2=10, length=100).put('b0')
    
     
    
    s = nd.strt(100, width=2).put(0, 40)  # default connecting pin is 'b0'
    
    # connects s.pin['a0'] to default taper 'a0'
    
    nd.taper(width1=2, width2=10, length=100).put(s.pin['a0'])
    
     
    
    s = nd.strt(100, width=2).put(0, 60)  # default connecting pin is 'b0'
    
    # connects s.pin['a0'] to taper 'b0'
    
    nd.taper(width1=2, width2=10, length=100).put('b0', s.pin['a0'])
    
     
    
    nd.export_plt()

     

    Xaveer

    in reply to: Polygon subtraction function #6696
    Xaveer
    Moderator

    Just an update on this topic: polygons with holes resulting from boolean opearations are now properly handled by recent versions of Nazca, provided the pyclipper module is installed.

    Xaveer

    in reply to: Subtraction of two layers #6644
    Xaveer
    Moderator

    Dear Andreas,

    Nazca does not do boolean operations on cells or layers (yet). However boolean operations are possible on polygons. So something as shown below might do the trick for you.

    import nazca as nd
    
    def invert_text(cell, layer1, layer2):
        lay1 = []
        lay2 = []
        layer1 = nd.get_layer(layer1)
        layer2 = nd.get_layer(layer2)
        for pgon in cell.polygons:
            node, Poly = pgon
            x0, y0, _ = node.xya()
            if Poly.layer == layer1:
                lay1.append([[x + x0, y + y0] for x, y in Poly.points])
            elif Poly.layer == layer2:
                lay2.append([[x + x0, y + y0] for x, y in Poly.points])
        with nd.Cell("newtxt") as newtxt:
            inverse = nd.clipper.diff_polygons(lay2, lay1)
            for pol in inverse:
                nd.Polygon(points=pol, layer=layer2).put()
        return newtxt
    
    txt = nd.text(
        "Nazca-design", layer=1, box_layer=2, box_buf=20, align="cc"
    )
    inv = invert_text(txt, 1, 2)
    inv.put()
    
    nd.export_gds()
    

    Xaveer

    in reply to: Merge two structures #6628
    Xaveer
    Moderator

    Dear Neetesh,

    Would putting the structures in a separate cell solve your problem? E.g.:

    import nazca as nd
    
    with nd.Cell("strt_bend") as strt_bend:
        nd.strt(length=20, width=1, layer=3).put()
        nd.bend(angle=180, width=1, radius=120, layer=3).put()
    
    for i in range(10):
        strt_bend.put(0, 0, i * 36)
    
    nd.export_gds()
    

    Xaveer

    in reply to: Iterate over a cell and return polygons from child cell #6585
    Xaveer
    Moderator

    Dear garbagebag,

    Before going into this, I would like to ask if you can explain why you’d want to do this. It might be that you try something that can better be done in a different way.

    Xaveer

Viewing 20 posts - 1 through 20 (of 69 total)