optical pins name revised. Pin type added

This commit is contained in:
=
2026-06-07 22:56:33 +08:00
parent a4ac88f002
commit 8462c3397f
262 changed files with 3251 additions and 1134 deletions
+75 -25
View File
@@ -234,14 +234,18 @@ class spiral:
SPR_U = Conchoid(R0=R_act,kR=kR,T=self.cycles*pi,w=self.width*(a1-a2)+(b1-b2),
layer=layers,final_flat=None,begin_flat=None,res=self.res)
# layer=layers,final_flat=0,begin_flat=spr_bend.vtx_center[-1,0]/spr_bend.vtx_center[-1,1],res=self.res)
SPR_U_INST = SPR_U.cell.put('a1',IN_L.pin['b0'].x,IN_L.pin['b0'].y,90,flip=1)
## revised in 2026.06.07 by Qin Yue
# legacy: SPR_U_INST = SPR_U.cell.put('a1',IN_L.pin['b0'].x,IN_L.pin['b0'].y,90,flip=1)
SPR_U_INST = SPR_U.cell.put('opt_a1',IN_L.pin['b0'].x,IN_L.pin['b0'].y,90,flip=1)
""" relative part """
SPR_D = Conchoid(R0=R_act,kR=kR,T=self.cycles*pi+pi-self.port_angle/180*np.pi,w=self.width*(a1-a2)+(b1-b2),layer=layers,
final_flat=None,
begin_flat=None,res=self.res)
# begin_flat=spr_bend.vtx_center[-1,0]/spr_bend.vtx_center[-1,1],res=self.res)
SPR_D_INST = SPR_D.cell.put('a1',IN_R.pin['b0'].x,IN_R.pin['b0'].y,-90,flip=1)
## revised in 2026.06.07 by Qin Yue
# legacy: SPR_D_INST = SPR_D.cell.put('a1',IN_R.pin['b0'].x,IN_R.pin['b0'].y,-90,flip=1)
SPR_D_INST = SPR_D.cell.put('opt_a1',IN_R.pin['b0'].x,IN_R.pin['b0'].y,-90,flip=1)
if (self.sharp_patch==True and b1!=0 and b2!=0):
sz = (R_act+pitch*self.cycles+self.port_angle/180*np.pi*kR + self.width*a1+b1)*2
@@ -251,14 +255,26 @@ class spiral:
self.Ru = SPR_U.R_end
self.Rd = SPR_D.R_end
if (self.width!=self.w_port):
nd.taper(xs=self.xs,width1=self.width,width2=self.w_port,length=self.Ltp_port).put(SPR_U_INST.pin['b1'])
nd.Pin(name='a1',width=self.w_port).put()
nd.taper(xs=self.xs,width1=self.width,width2=self.w_port,length=self.Ltp_port).put(SPR_D_INST.pin['b1'])
nd.Pin(name='b1',width=self.w_port).put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.taper(xs=self.xs,width1=self.width,width2=self.w_port,length=self.Ltp_port).put(SPR_U_INST.pin['b1'])
nd.taper(xs=self.xs,width1=self.width,width2=self.w_port,length=self.Ltp_port).put(SPR_U_INST.pin['opt_b1'])
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='a1',width=self.w_port).put()
nd.Pin(name='opt_a1',width=self.w_port,type="optical:").put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.taper(xs=self.xs,width1=self.width,width2=self.w_port,length=self.Ltp_port).put(SPR_D_INST.pin['b1'])
nd.taper(xs=self.xs,width1=self.width,width2=self.w_port,length=self.Ltp_port).put(SPR_D_INST.pin['opt_b1'])
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='b1',width=self.w_port).put()
nd.Pin(name='opt_b1',width=self.w_port,type="optical:").put()
else :
nd.Pin(name='a1',width=self.w_port).put(SPR_U_INST.pin['b1'])
nd.Pin(name='b1',width=self.width).put(SPR_D_INST.pin['b1'])
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='a1',width=self.w_port).put(SPR_U_INST.pin['b1'])
nd.Pin(name='opt_a1',width=self.w_port,type="optical:").put(SPR_U_INST.pin['opt_b1'])
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='b1',width=self.width).put(SPR_D_INST.pin['b1'])
nd.Pin(name='opt_b1',width=self.width,type="optical:").put(SPR_D_INST.pin['opt_b1'])
if show_pins:
nd.put_stub()
@@ -281,8 +297,12 @@ class spiral:
else:
with nd.Cell(instantiate=False) as bend_cell:
inst = circle(radius=self.R_bend,width=self.width,theta_start=0,theta_stop=90,xs=self.xs,res=self.res,sharp_patch=self.sharp_patch).cell.put(0,0,0)
nd.Pin(name='a0',pin=inst.pin['a1']).put()
nd.Pin(name='b0',pin=inst.pin['b1']).put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='a0',pin=inst.pin['a1']).put()
nd.Pin(name='a0',pin=inst.pin['opt_a1']).put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='b0',pin=inst.pin['b1']).put()
nd.Pin(name='b0',pin=inst.pin['opt_b1']).put()
bend_sz = [self.R_bend,self.R_bend]
L_bend = np.pi/2*self.R_bend
@@ -379,19 +399,31 @@ class spiral:
if (self.w_port !=self.width) :
if (self.rib2strip):
nd.taper(length=self.Ltp_port,width1=self.width,width2=self.w_port,xs='strip').put(pin_D_pre)
nd.Pin(name='b1',width=self.w_bend_port).put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='b1',width=self.w_bend_port).put()
nd.Pin(name='opt_b1',width=self.w_bend_port,type="optical:").put()
nd.taper(length=self.Ltp_port,width1=self.width,width2=self.w_port,xs='strip').put(pin_U_pre)
nd.Pin(name='a1',width=self.w_bend_port).put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='a1',width=self.w_bend_port).put()
nd.Pin(name='opt_a1',width=self.w_bend_port,type="optical:").put()
else :
nd.taper(length=self.Ltp_port,width1=self.width,width2=self.w_port,xs=self.xs).put(pin_D_pre)
nd.Pin(name='b1',width=self.w_bend_port).put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='b1',width=self.w_bend_port).put()
nd.Pin(name='opt_b1',width=self.w_bend_port,type="optical:").put()
nd.taper(length=self.Ltp_port,width1=self.width,width2=self.w_port,xs=self.xs).put(pin_U_pre)
nd.Pin(name='a1',width=self.w_bend_port).put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='a1',width=self.w_bend_port).put()
nd.Pin(name='opt_a1',width=self.w_bend_port,type="optical:").put()
else:
nd.Pin(name='b1',width=self.w_bend_port).put(pin_D_pre)
nd.Pin(name='a1',width=self.w_bend_port).put(pin_U_pre)
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='b1',width=self.w_bend_port).put(pin_D_pre)
nd.Pin(name='opt_b1',width=self.w_bend_port,type="optical:").put(pin_D_pre)
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='a1',width=self.w_bend_port).put(pin_U_pre)
nd.Pin(name='opt_a1',width=self.w_bend_port,type="optical:").put(pin_U_pre)
self.L = L
@@ -745,8 +777,12 @@ class spiral_rectangle:
taper = self.cell_xs_transition.put(pin_U_pre)
pin_U_pre = taper.pin['b0']
nd.Pin(name='b1',width=self.w_port).put(pin_D_pre)
nd.Pin(name='a1',width=self.w_port).put(pin_U_pre)
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='b1',width=self.w_port).put(pin_D_pre)
nd.Pin(name='opt_b1',width=self.w_port,type="optical:").put(pin_D_pre)
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='a1',width=self.w_port).put(pin_U_pre)
nd.Pin(name='opt_a1',width=self.w_port,type="optical:").put(pin_U_pre)
self.L = L
@@ -1088,7 +1124,9 @@ class spiral_circle:
# print("")
SPR_U_INST = SPR_U.cell.put('a1',IN_L.pin['b0'].x,IN_L.pin['b0'].y,90 + Arot,flip=1)
## revised in 2026.06.07 by Qin Yue
# legacy: SPR_U_INST = SPR_U.cell.put('a1',IN_L.pin['b0'].x,IN_L.pin['b0'].y,90 + Arot,flip=1)
SPR_U_INST = SPR_U.cell.put('opt_a1',IN_L.pin['b0'].x,IN_L.pin['b0'].y,90 + Arot,flip=1)
w_cur = self.width*(a1-a2)+(b1-b2)
## adding connection patch
@@ -1102,11 +1140,15 @@ class spiral_circle:
res=self.res)
SPR_D_INST = SPR_D.cell.put('a1',IN_R.pin['b0'].x,IN_R.pin['b0'].y,-90 + Arot,flip=1)
## revised in 2026.06.07 by Qin Yue
# legacy: SPR_D_INST = SPR_D.cell.put('a1',IN_R.pin['b0'].x,IN_R.pin['b0'].y,-90 + Arot,flip=1)
SPR_D_INST = SPR_D.cell.put('opt_a1',IN_R.pin['b0'].x,IN_R.pin['b0'].y,-90 + Arot,flip=1)
nd.taper(layer=layers,width1=w_cur,width2=w_cur-0.01,length=0.01).put(IN_R.pin['b0'].x,IN_R.pin['b0'].y,-90-self.Atilt+Arot)
nd.taper(layer=layers,width1=w_cur,width2=w_cur-0.01,length=0.01).put(IN_R.pin['b0'].x,IN_R.pin['b0'].y, 90-self.Atilt+Arot)
self.Rmax = np.sqrt(SPR_D_INST.pin['b1'].x**2 + SPR_D_INST.pin['b1'].y**2)
## revised in 2026.06.07 by Qin Yue
# legacy: self.Rmax = np.sqrt(SPR_D_INST.pin['b1'].x**2 + SPR_D_INST.pin['b1'].y**2)
self.Rmax = np.sqrt(SPR_D_INST.pin['opt_b1'].x**2 + SPR_D_INST.pin['opt_b1'].y**2)
if (self.sharp_patch==True and b1!=0 and b2!=0):
sz = (R_act+pitch*self.cycles+self.port_angle/180*np.pi*kR + self.width*a1+b1)*2
@@ -1116,10 +1158,18 @@ class spiral_circle:
self.Ru = SPR_U.R_end
self.Rd = SPR_D.R_end
nd.taper(xs=self.xs,width1=self.w_port,width2=self.w_port,length=self.Lport).put(SPR_U_INST.pin['b1'])
nd.Pin(name='a1',width=self.w_port).put()
nd.taper(xs=self.xs,width1=self.w_port,width2=self.w_port,length=self.Lport).put(SPR_D_INST.pin['b1'])
nd.Pin(name='b1',width=self.w_port).put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.taper(xs=self.xs,width1=self.w_port,width2=self.w_port,length=self.Lport).put(SPR_U_INST.pin['b1'])
nd.taper(xs=self.xs,width1=self.w_port,width2=self.w_port,length=self.Lport).put(SPR_U_INST.pin['opt_b1'])
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='a1',width=self.w_port).put()
nd.Pin(name='opt_a1',width=self.w_port,type="optical:").put()
## revised in 2026.06.07 by Qin Yue
# legacy: nd.taper(xs=self.xs,width1=self.w_port,width2=self.w_port,length=self.Lport).put(SPR_D_INST.pin['b1'])
nd.taper(xs=self.xs,width1=self.w_port,width2=self.w_port,length=self.Lport).put(SPR_D_INST.pin['opt_b1'])
## revised in 2026.06.07 by Qin Yue
# legacy: nd.Pin(name='b1',width=self.w_port).put()
nd.Pin(name='opt_b1',width=self.w_port,type="optical:").put()
if show_pins:
nd.put_stub()