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

相关文章

springboot使用Scheduling实现动态增删启停定时任务教程

《springboot使用Scheduling实现动态增删启停定时任务教程》:本文主要介绍springboot使用Scheduling实现动态增删启停定时任务教程,具有很好的参考价值,希望对大家有... 目录1、配置定时任务需要的线程池2、创建ScheduledFuture的包装类3、注册定时任务,增加、删

如何为Yarn配置国内源的详细教程

《如何为Yarn配置国内源的详细教程》在使用Yarn进行项目开发时,由于网络原因,直接使用官方源可能会导致下载速度慢或连接失败,配置国内源可以显著提高包的下载速度和稳定性,本文将详细介绍如何为Yarn... 目录一、查询当前使用的镜像源二、设置国内源1. 设置为淘宝镜像源2. 设置为其他国内源三、还原为官方

Maven的使用和配置国内源的保姆级教程

《Maven的使用和配置国内源的保姆级教程》Maven是⼀个项目管理工具,基于POM(ProjectObjectModel,项目对象模型)的概念,Maven可以通过一小段描述信息来管理项目的构建,报告... 目录1. 什么是Maven?2.创建⼀个Maven项目3.Maven 核心功能4.使用Maven H

IDEA自动生成注释模板的配置教程

《IDEA自动生成注释模板的配置教程》本文介绍了如何在IntelliJIDEA中配置类和方法的注释模板,包括自动生成项目名称、包名、日期和时间等内容,以及如何定制参数和返回值的注释格式,需要的朋友可以... 目录项目场景配置方法类注释模板定义类开头的注释步骤类注释效果方法注释模板定义方法开头的注释步骤方法注

Python虚拟环境终极(含PyCharm的使用教程)

《Python虚拟环境终极(含PyCharm的使用教程)》:本文主要介绍Python虚拟环境终极(含PyCharm的使用教程),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,... 目录一、为什么需要虚拟环境?二、虚拟环境创建方式对比三、命令行创建虚拟环境(venv)3.1 基础命令3

使用Node.js制作图片上传服务的详细教程

《使用Node.js制作图片上传服务的详细教程》在现代Web应用开发中,图片上传是一项常见且重要的功能,借助Node.js强大的生态系统,我们可以轻松搭建高效的图片上传服务,本文将深入探讨如何使用No... 目录准备工作搭建 Express 服务器配置 multer 进行图片上传处理图片上传请求完整代码示例

python连接本地SQL server详细图文教程

《python连接本地SQLserver详细图文教程》在数据分析领域,经常需要从数据库中获取数据进行分析和处理,下面:本文主要介绍python连接本地SQLserver的相关资料,文中通过代码... 目录一.设置本地账号1.新建用户2.开启双重验证3,开启TCP/IP本地服务二js.python连接实例1.

Python 安装和配置flask, flask_cors的图文教程

《Python安装和配置flask,flask_cors的图文教程》:本文主要介绍Python安装和配置flask,flask_cors的图文教程,本文通过图文并茂的形式给大家介绍的非常详细,... 目录一.python安装:二,配置环境变量,三:检查Python安装和环境变量,四:安装flask和flas

Spring Security基于数据库的ABAC属性权限模型实战开发教程

《SpringSecurity基于数据库的ABAC属性权限模型实战开发教程》:本文主要介绍SpringSecurity基于数据库的ABAC属性权限模型实战开发教程,本文给大家介绍的非常详细,对大... 目录1. 前言2. 权限决策依据RBACABAC综合对比3. 数据库表结构说明4. 实战开始5. MyBA

Ubuntu中远程连接Mysql数据库的详细图文教程

《Ubuntu中远程连接Mysql数据库的详细图文教程》Ubuntu是一个以桌面应用为主的Linux发行版操作系统,这篇文章主要为大家详细介绍了Ubuntu中远程连接Mysql数据库的详细图文教程,有... 目录1、版本2、检查有没有mysql2.1 查询是否安装了Mysql包2.2 查看Mysql版本2.