Forum Replies Created
-
AuthorPosts
-
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorHi,
I’m afraid that there is no standard spiral component in Nazca, so you’ll have to do it yourself!
Xaveer
Xaveer
ModeratorDear 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
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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/
Xaveer
Xaveer
ModeratorDear 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
Xaveer
ModeratorJust 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
Xaveer
ModeratorDear 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
Xaveer
ModeratorDear 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
28 September 2021 at 15:20 in reply to: Iterate over a cell and return polygons from child cell #6585Xaveer
ModeratorDear 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
-
AuthorPosts