Home › Forums › Nazca › Questions and Answers › Direction for building spiral Bragg gratings › Reply To: Direction for building spiral Bragg gratings
Dear Ronald,
The pictures above didn’t seem to post, so I’ll attach an imgur link of the pictures: https://imgur.com/a/NEC8ubq
Regarding the code I’m considering modifying with the polygons:
def MEMSGSLBG(N=1000,per=0.300,duty=0.5,width=0.5,wmin=0.5,wmax=1.5,layer=1,alph=0.39,n=8,wsleeve=5,layerp=2):#memory efficient super gaussian
#name = 'SGSLBG'
name = 'SGSLBG_N'+str(int(N))+"_P"+str(int(1000*per))+"_D"+str(int(100*duty))+"W"+str(int(width*1000))+"_WX"+str(int(wmax*1000))+"_WM"+str(int(wmin*1000));
#build from (0,0)
maxpg =500 #maximum periods per polygon object
L = N*per;
tooth = per*duty;
gap = per*(1-duty);
bH = wmin/2.;
with nd.Cell(name=name) as cell:
for k in range(0,N):
if k==0: #initialze
polypts=[]
polypts_sleeve_L=[]#initialize sleeve polygons
polypts_sleeve_R=[]
elif k%maxpg == 0: #close polygon exceeding maximum periods per polygon and start new polygon
nd.Polygon(points=polypts,layer=layer).put(0,0,0)#place at true coordinates
nd.Polygon(points=polypts_sleeve_L,layer=layerp).put(0,0,0)
nd.Polygon(points=polypts_sleeve_R,layer=layerp).put(0,0,0)
polypts=[]
polypts_sleeve_L=[]
polypts_sleeve_R=[]
z = per*(k+duty/2.) #eval at major element midpoint
fz = math.exp(-.5*pow(((z/L)-.5)/alph,n))
fzx = (wmax-width)*fz;
fzm = (width-wmin)*fz;
rectx = nd.geometries.transform(points=nd.geometries.box(length=tooth,width=width+fzx),move=(k*per,0,0))
polypts[int(len(polypts)/2):int(len(polypts)/2)] = rectx #insert into polygon list
rectm = nd.geometries.transform(points=nd.geometries.box(length=gap,width=width-fzm),move=((k+duty)*per,0,0))
polypts[int(len(polypts)/2):int(len(polypts)/2)] = rectm #insert into polygon list
nd.Polygon(points=polypts,layer=layer).put(0,0,0)#place at true coordinates any remainder shape
nd.Pin('a0',width=width).put(0,0,180)
nd.Pin('b0',width=width).put(L,0,0)
return cell
I would like to have the grating elements (rectx and rectm) follow a curve, and after talking it over with a colleague, he suggested changing the move part of the code to follow a curve, calculating the points necessary for x, y, and angle. Based off this, we think there will be a problem where the interface where two differently angled elements will have a “dip” in the resulting layout and believe that adding another point on the larger rectangle should do the trick.
Do you think this is similar to the direction you proposed? Is the fix we proposed the correct way to go about it?
Thank you,
Alex