Forum Replies Created
-
AuthorPosts
-
Xaveer
ModeratorHi Raphael,
You can just define the points of the ellipse yourself in a loop, or you could use the Nazca circle() and transform the points. Here is an example:
import nazca as nd circle = nd.geometries.circle(radius=5, N=20) ellipse = [(x * 0.5, y) for x, y in circle] nd.Polygon(points=ellipse, layer=1).put() nd.export_gds()
Xaveer
16 July 2020 at 10:43 in reply to: Structure or loop too big? plus why can't I re-run same script? #6191Xaveer
ModeratorDear Cameron,
You should check your program: the area you are trying to write is over 3 meters high, which exceeds the GDS capabilities when using 1 nm precision. So what you see is an integer overflow.
Your for loop multiplies by j twice, e.g. in calculating ypos and in the put() statement ypos is again multiplied by j. Same for i. This is probably not what you want.
For the font, if you want to use “cousine”, you have to use f.text() in stead of nd.text().
And for running multiple times in spyder, you could try to clear some parameters after loading nazca. E.g. this may help:
import nazca as nd nd.clear_layout() nd.clear_layers() nd.clear_xsections()
Xaveer
Xaveer
ModeratorDear ale35,
I notice that this went unanswered, so I hope this may still be useful.
The interconnect definition should be outside the cell definition. The width specified is the default width for the interconnect and can be overridden when needed. Your code would then look something like:
ic = Interconnect(width=4, xs="XXXX") @hashme("wg") def wgs(WG_width): with nd.Cell() as wg: ic.taper(width2=WG_width, length=10).put() return wg wgs(1).put(0, 0) wgs(2).put(0, 10)Xaveer
Xaveer
ModeratorDear iv_tern,
If you specify width1 and width2 and they are different, then a parabolic taper will be generated (with the large angle closest to the smallest width). If you want a different function, you have to specify the shape yourself. Then the width1 argument should be a parametric function w(t), where the width starts at w(0) and ends at w(1). An example is show below.
import nazca as nd import nazca.demofab as demo from math import sin # Connect two waveguides and adapt the width at the same time s1 = demo.deep.strt(200, width=2).put(0, -200, 0) s2 = demo.deep.strt(200, width=5).put(1000, -250, 170) demo.deep.cobra_p2p(pin2=s1.pin['b0'], width1=5).put() def wsin(t): """Useless fast width variation for demonstration.""" w = 2 + 5 * t + 5 * t * sin(t * 200) return w # Connect two waveguides and vary the width in some useless way. c1 = demo.deep.bend(radius=70, angle=50, width=wsin(0)).put(0, -400, 0) c2 = demo.deep.bend(radius=100, angle=-50, width=wsin(1)).put(1000, -400, 0) demo.deep.cobra_p2p(c1.pin['b0'], c2.pin['a0'], width1=wsin, radius1=70, radius2=-100).put() nd.export_gds()Please note that Nazca cannot do a lot of sanity-checking on such connections, so it should be used with care.
Xaveer
Xaveer
ModeratorDear Chenhiu,
BTW, the pcurve_p2p() doesn’t work well now, and it changes the width from the “set width” to “default width”. That means it is not possible to set a constant width unless we use the default one.
Thanks for pointing this out. It has been fixed and will be available in a new version. However, pcurve_p2p() should not be used anymore anyway: cobra_p2p() is to be used instead.
Xaveer
Xaveer
ModeratorDear ale35,
Because your cell does not seem to take any parameters, the hashme (and even the function definition) are not needed. Just define the cell (in a with statement) and use it:
import nazca as nd with nd.Cell("MMI_1x2") as mmi1x2: nd.strt(length=10, width=5).put() for i in range(100): mmi1x2.put(i * 10, i * 10) nd.export_gds()Xaveer
Xaveer
ModeratorDear killian.keller,
This should be straightforward. Suppose your template file (containing the Wafer layout etc.) is called template.gds and your design is called user.gds with top cell name “my_design”, then the following Nazca program should do the trick:
import nazca as nd
scellmap = {“user.gds”: {“user_design”: “my_design”}}
nd.replaceCells(gdsin=”template.gds”, ScellMapping=scellmap)If needed, you can replace multiple cells in the template with cells from
different user designs, by extending the scellmap dictionary.Xaveer
Xaveer
ModeratorDear Eric,
The library support is a feature of KLayout. It generates a specially crafted GDS file structure to support this, since GDS itself does not.
Of course, with Nazca you can import cells from KLayout libraries, just as you could with every other GDS file. See for example the tutorial make a BB from GDS.
This will even update your GDS when the library changes, but you have to rerun the Nazca source program. Full Nazca support for the KLayout library feature is possible, but it is not there at the moment.
Xaveer
Xaveer
ModeratorDear Theflyingpengin,
When you put() an object, the return type is None, which explains the error message. You can easily check this by printing e.g. the type of base:
print(type(base))
The polygon operations of the clipper module require lists of polygons, where a polygon is a list of (x,y) values. So the first and second argument of diff_polygons() should be something like [[(1,2),(3,4),(5,1)]].
A small working example similar to your example (but with different polygon placement) would be:
import nazca as nd import nazca.geometries as geom base = geom.parallelogram(length=7333.87, height=3803.27, angle=90, position=1, shift=(0, 0)) # base is a polygon and [base] is a list of polygons (with only one polygon). straights = geom.parallelogram(length=6180.09, height=758, angle=90, position=1, shift=(0, 0)) polygons = nd.clipper.diff_polygons([base], [straights], accuracy=0.001) for pol in polygons: # There is only one polygon in the result in this case. nd.Polygon(pol, layer=4).put() nd.export_gds()Hope that helps you to go on.
Lastly a word of warning: subtracting or combining polygons may result in a “hole”. This is not handled by Nazca, because GDS cannot handle such polygons.
Xaveer
Xaveer
ModeratorDear Paul,
The OCR-B font will be available in the next Nazca release.
Nazca font files have the following structure:
- version: font file version number
- height: total height of the font
- space: interword spacing (=0 for fixed fonts)
- font: dictionary of characters:
- key: character
- w: width of that character
- p: list of polygons, of which each is a list of (x,y) coordinate points
Xaveer
Xaveer
ModeratorDear Paul,
Currently there is no OCR-B font for Nazca. Indeed they are loaded from a ‘font.nft’ file. I’ll look into providing this font and inform you when it’s available. The nft file itself is a (pickled) set of polygons and size+spacing info, that is a Nazca-specific format. You can (of course) generate it yourself, but the details are not documented yet.
Xaveer
Xaveer
ModeratorDear Yuyang Ding,
There is not a ready-made component for that in Nazca (yet). You may get some inspiration from the following article:
“Integrated Optical Delay Lines for Time-Division Multiplexers”, by Stopinski et al., https://doi.org/10.1109/JPHOT.2013.2280519
Xaveer
Xaveer
ModeratorDear Paul,
Also note that the leading underscore in _trapezoid() indicates that this function is for internal use, which means that it is not guaranteed to behave in the same way (or even exist) in a next version of Nazca.
The implementation of polyline2polygon() has changed significantly in version 0.5.2, where the width can vary along the curve.
To help us understand the problem, please remember next time to mention the specific Nazca version you’re referring to.Xaveer
Xaveer
ModeratorDear Chenhui,
In Nazca 0.5.2 there is now an interconnect cobra_p2p() which has this functionality (and more).
Xaveer
Xaveer
ModeratorIn this case the eopm has four ports: a0, b0 and c0, c1. a0 and b0 are the optical ports, c0, c1 the electrical ports. They can be at the same location, depending on the specific component. a0 and b0 are the ports that by default are connected to.
If you want to connect an optical waveguide to the eopm, it has to be at b0 (or a0, but that is already connected). You can tell from the color of the stub if the connections match, deep-deep, or shallow-shallow, for the demofab technology. You should have loaded the demofab_klayout_colors.lyp file in klayout for proper visual feedback. Colors are very important in Nazca. See https://nazca-design.org/manage-klayout-technologies for instructions.
After the eopm you indeed have to add a deep to shallow junction and continue with shallow waveguides, or you can just continue with waveguides in the deep cross section, in which case of course there is no need for the transition.
Xaveer
ModeratorHi Aleksandar,
The phase shifter has a different cross section (“deep”) and you therefore need to add a shallow-to-deep junction. Also, placing the pad directly on top of the modulator is not advised, because the underlying structure could be damaged during electrical probing or bonding. So I added an offset w.r.t. the phase modulator.
Instead of the bend_strt_bend I used an sbend, which is usually what you’d have in such cases.
import nazca as nd import nazca.demofab as demo with nd.Cell("Coupler") as coupler: # Upper arm demo.shallow.sinebend(distance=100, offset=-40).put(0, 50) demo.shallow.strt(length=20).put() demo.shallow.sinebend(distance=100, offset=40).put() # Lower arm demo.shallow.sinebend(distance=100, offset=40).put(0, -50) demo.shallow.strt(length=20).put() demo.shallow.sinebend(distance=100, offset=-40).put() # Pins nd.Pin("a0").put(0, 50, 180) nd.Pin("a1").put(0, -50, 180) nd.Pin("b0").put(220, 50, 0) nd.Pin("b1").put(220, -50, 0) C = coupler.put(0) demo.s2d().put() eopm = demo.eopm_dc(length=150).put() pad = demo.pad_dc().put(eopm.pin["c1"].move(200, 100, 0)) demo.metaldc.sbend_p2p(eopm.pin["c1"], Lstart=100).put() nd.export_gds()Xaveer
Xaveer
ModeratorDear Aleksandar,
There are many ways to do this. The example below uses the built-in demofab cross-section. You can use a very similar implementation for your own technology, by following the cross-section tutorial https://nazca-design.org/implement-a-cross-section/. You can make your directional coupler into a building block and re-use it many times by encapsulating it in a cell and adding pins to it. Look at https://nazca-design.org/crate-bb-using-polygon/ for inspiration.
Here’s an example for the directional coupler, using sinebend curves.
import nazca as nd import nazca.demofab as demo with nd.Cell("Coupler") as coupler: # Upper arm demo.shallow.sinebend(distance=100, offset=-40).put(0, 50) demo.shallow.strt(length=20).put() demo.shallow.sinebend(distance=100, offset=40).put() # Lower arm demo.shallow.sinebend(distance=100, offset=40).put(0, -50) demo.shallow.strt(length=20).put() demo.shallow.sinebend(distance=100, offset=-40).put() # Add pins nd.Pin("a0").put(0, 50, 180) nd.Pin("a1").put(0, -50, 180) nd.Pin("b0").put(220, 50, 0) nd.Pin("b1").put(220, -50, 0) coupler.put(0, 0) coupler.put(0, -200, 10) nd.export_plt()Xaveer
Xaveer
ModeratorDear Chenhui,
There is a low-level function that will do it, but it is not yet available for the interconnections.
An example is given here:
import math import nazca as nd def testcurve(t): x = (2 + 15 * t) * math.exp(t) y = (2 + 20 * t) * math.cos(t * 5) return (x, y) xy = [testcurve(t / 200) for t in range(201)] # The width will increase linearly in the given range, proportional to the # length of the curve. XY = nd.util.polyline2polygon(xy, width=0.5, width2=5) nd.Polygon(XY, layer=1).put() nd.export_gds()Best regards,
XaveerXaveer
ModeratorDear Doug,
This is really a question for Klayout. Try posting it on their forum: https://www.klayout.de/forum/
Matthias is usually very responsive.Xaveer
Xaveer
ModeratorDear Wanshu,
Here is one way to achieve what you want:
import nazca as nd with nd.Cell(name='Cell') as C: nd.strt(10).put(0) nd.taper(length=10, width1=1, width2=5).put() nd.bend(angle=90).put() C.put(0, 0, 0) C.put(-10, -10, 0, flip=True) nd.export_gds()There is also a flop argument that flips backwards.
Xaveer
-
AuthorPosts