luceda ipkiss教程 59:画圆形螺旋线2

2024-01-28 04:44

本文主要是介绍luceda ipkiss教程 59:画圆形螺旋线2,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

案例分享:画同端口螺旋线
在这里插入图片描述
代码如下:

from si_fab import all as pdk
from ipkiss3 import all as i3
import numpy as npclass Spiral(i3.PCell):_name_prefix = "Spiral_C"width = i3.PositiveNumberProperty(doc="Core width of the bend waveguide", default=1.0)radius = i3.PositiveNumberProperty(doc="Horizontal length of the waveguide", default=20.0)decouple = i3.PositiveNumberProperty(doc="Separation between adjacent waveguides", default=2.0)length = i3.PositiveNumberProperty(doc="Length of the total snp.piral waveguide", default=4000.0)layout_properties = i3.NumpyArrayProperty(doc="Calculated layout properties of the snp.piral.", locked=True)def _default_layout_properties(self):r = self.radiusw = self.widthtot_sep = self.decouple + wb_val = 0.5 + 2.0 * r / tot_sepc_val = (4.0 * r + 0.5 * tot_sep - self.length / np.pi) / tot_sepn_o_loops_act = -b_val + np.sqrt(b_val**2.0 - c_val)n_o_loops = np.floor(n_o_loops_act)theta_nom = (self.length- 4.0 * r * np.pi * (1.0 + n_o_loops)- 0.5 * tot_sep * np.pi- (n_o_loops + n_o_loops**2.0) * tot_sep * np.pi)theta_denom = 4.0 * self.radius + (2.0 * n_o_loops + 2.0) * tot_septheta_m = theta_nom / theta_denomdy0 = ((n_o_loops + 1.0) * tot_sep+ (2.0 * r + tot_sep * 0.5) * (1.0 - np.cos(theta_m))+ 2.0 * self.radius * np.cos(theta_m))dx0 = tot_sep * 0.5 * np.sin(theta_m)radius_in = 2.0 * r + (2.0 * n_o_loops + 3.0) * tot_sep * 0.5radius_out = 2.0 * r + (2.0 * n_o_loops + 1.0) * tot_sep * 0.5return np.array([r, w, tot_sep, n_o_loops, theta_m, dx0, dy0, radius_in, radius_out])class Layout(i3.LayoutView):def _generate_instances(self, insts):(r,w,tot_sep,n_o_loops,theta_m,dx0,dy0,radius_in,radius_out,) = self.layout_properties# snp.piral waveguidefor index in range(int(n_o_loops + 2)):sign = 1.0 if index % 2 == 0 else -1.0if index == 0:radius, dy = r, 0.0else:radius, dy = (2.0 * r + (2.0 * index - 1.0) * tot_sep * 0.5,2.0 * r + (index - 1.0) * tot_sep,)shape_wg1 = [(0.0, -sign * dy),(sign * radius, -sign * dy),(sign * radius, -sign * (dy - radius)),(sign * radius, -sign * (dy - 2.0 * radius)),(0.0, -sign * (dy - 2.0 * radius)),]shape_wg2 = [(0.0, sign * dy),(-sign * radius, sign * dy),(-sign * radius, sign * (dy - radius)),(-sign * radius, sign * (dy - 2.0 * radius)),(0.0, sign * (dy - 2.0 * radius)),]wg1 = i3.RoundedWaveguide(trace_template=pdk.SWG450())wg2 = i3.RoundedWaveguide(trace_template=pdk.SWG450())wg1.Layout(bend_radius=radius,shape=shape_wg1,)wg2.Layout(bend_radius=radius,shape=shape_wg2,)transf = i3.Rotation(rotation=theta_m * (-180.0 / np.pi)) + i3.Translation(translation=(dx0, -dy0))if index == int(n_o_loops + 1):if n_o_loops % 2 == 0:insts += i3.SRef(wg2, transformation=transf)else:insts += i3.SRef(wg1, transformation=transf)else:insts += i3.SRef(wg1, transformation=transf)insts += i3.SRef(wg2, transformation=transf)# output waveguideswg_in = i3.RoundedWaveguide(trace_template=pdk.SWG450())wg_out = i3.RoundedWaveguide(trace_template=pdk.SWG450())if theta_m <= np.pi / 2.0:shape_wg_in = [(0.0, 0.0),(radius_in * np.tan(theta_m / 2.0), 0.0),(radius_in * np.sin(theta_m), -radius_in * (1.0 - np.cos(theta_m))),]shape_wg_out = [(0.0, -tot_sep),(radius_out * np.tan(theta_m / 2.0), -tot_sep),(radius_out * np.sin(theta_m),-tot_sep - radius_out * (1.0 - np.cos(theta_m)),),]else:shape_wg_in = [(0.0, 0.0),(radius_in, 0.0),(radius_in, -radius_in),(radius_in,-radius_in - radius_in * np.tan((theta_m - np.pi / 2.0) / 2.0),),(radius_in * np.sin(theta_m), -radius_in * (1.0 - np.cos(theta_m))),]shape_wg_out = [(0.0, -tot_sep),(radius_out, -tot_sep),(radius_out, -tot_sep - radius_out),(radius_out,-tot_sep- radius_out- radius_out * np.tan((theta_m - np.pi / 2.0) / 2.0),),(radius_out * np.sin(theta_m),-tot_sep - radius_out * (1.0 - np.cos(theta_m)),),]wg_in.Layout(bend_radius=radius_in,shape=shape_wg_in,)wg_out.Layout(bend_radius=radius_out,shape=shape_wg_out,)insts += i3.SRef(wg_in, name="wg_in")insts += i3.SRef(wg_out, name="wg_out")return instsdef _generate_ports(self, ports):w = self.layout_properties[1]tot_sep = self.layout_properties[2]ports += i3.OpticalPort(name="in0",position=(0.0, 0.0),angle=180.0,trace_template=pdk.SWG450(),)ports += i3.OpticalPort(name="out0",position=(0.0, -tot_sep),angle=180.0,trace_template=pdk.SWG450(),)return portsif __name__ == "__main__":Spiral().Layout().visualize(legacy=True, annotate=True)

这篇关于luceda ipkiss教程 59:画圆形螺旋线2的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/652508

相关文章

Linux卸载自带jdk并安装新jdk版本的图文教程

《Linux卸载自带jdk并安装新jdk版本的图文教程》在Linux系统中,有时需要卸载预装的OpenJDK并安装特定版本的JDK,例如JDK1.8,所以本文给大家详细介绍了Linux卸载自带jdk并... 目录Ⅰ、卸载自带jdkⅡ、安装新版jdkⅠ、卸载自带jdk1、输入命令查看旧jdkrpm -qa

Java使用Curator进行ZooKeeper操作的详细教程

《Java使用Curator进行ZooKeeper操作的详细教程》ApacheCurator是一个基于ZooKeeper的Java客户端库,它极大地简化了使用ZooKeeper的开发工作,在分布式系统... 目录1、简述2、核心功能2.1 CuratorFramework2.2 Recipes3、示例实践3

springboot简单集成Security配置的教程

《springboot简单集成Security配置的教程》:本文主要介绍springboot简单集成Security配置的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,... 目录集成Security安全框架引入依赖编写配置类WebSecurityConfig(自定义资源权限规则

MySQL Workbench 安装教程(保姆级)

《MySQLWorkbench安装教程(保姆级)》MySQLWorkbench是一款强大的数据库设计和管理工具,本文主要介绍了MySQLWorkbench安装教程,文中通过图文介绍的非常详细,对大... 目录前言:详细步骤:一、检查安装的数据库版本二、在官网下载对应的mysql Workbench版本,要是

通过Docker Compose部署MySQL的详细教程

《通过DockerCompose部署MySQL的详细教程》DockerCompose作为Docker官方的容器编排工具,为MySQL数据库部署带来了显著优势,下面小编就来为大家详细介绍一... 目录一、docker Compose 部署 mysql 的优势二、环境准备与基础配置2.1 项目目录结构2.2 基

Linux安装MySQL的教程

《Linux安装MySQL的教程》:本文主要介绍Linux安装MySQL的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux安装mysql1.Mysql官网2.我的存放路径3.解压mysql文件到当前目录4.重命名一下5.创建mysql用户组和用户并修

最新Spring Security实战教程之Spring Security安全框架指南

《最新SpringSecurity实战教程之SpringSecurity安全框架指南》SpringSecurity是Spring生态系统中的核心组件,提供认证、授权和防护机制,以保护应用免受各种安... 目录前言什么是Spring Security?同类框架对比Spring Security典型应用场景传统

最新Spring Security实战教程之表单登录定制到处理逻辑的深度改造(最新推荐)

《最新SpringSecurity实战教程之表单登录定制到处理逻辑的深度改造(最新推荐)》本章节介绍了如何通过SpringSecurity实现从配置自定义登录页面、表单登录处理逻辑的配置,并简单模拟... 目录前言改造准备开始登录页改造自定义用户名密码登陆成功失败跳转问题自定义登出前后端分离适配方案结语前言

Centos环境下Tomcat虚拟主机配置详细教程

《Centos环境下Tomcat虚拟主机配置详细教程》这篇文章主要讲的是在CentOS系统上,如何一步步配置Tomcat的虚拟主机,内容很简单,从目录准备到配置文件修改,再到重启和测试,手把手带你搞定... 目录1. 准备虚拟主机的目录和内容创建目录添加测试文件2. 修改 Tomcat 的 server.X

Python中的输入输出与注释教程

《Python中的输入输出与注释教程》:本文主要介绍Python中的输入输出与注释教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、print 输出功能1. 基础用法2. 多参数输出3. 格式化输出4. 换行控制二、input 输入功能1. 基础用法2. 类