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

相关文章

Ubuntu固定虚拟机ip地址的方法教程

《Ubuntu固定虚拟机ip地址的方法教程》本文详细介绍了如何在Ubuntu虚拟机中固定IP地址,包括检查和编辑`/etc/apt/sources.list`文件、更新网络配置文件以及使用Networ... 1、由于虚拟机网络是桥接,所以ip地址会不停地变化,接下来我们就讲述ip如何固定 2、如果apt安

PyCharm 接入 DeepSeek最新完整教程

《PyCharm接入DeepSeek最新完整教程》文章介绍了DeepSeek-V3模型的性能提升以及如何在PyCharm中接入和使用DeepSeek进行代码开发,本文通过图文并茂的形式给大家介绍的... 目录DeepSeek-V3效果演示创建API Key在PyCharm中下载Continue插件配置Con

Deepseek R1模型本地化部署+API接口调用详细教程(释放AI生产力)

《DeepseekR1模型本地化部署+API接口调用详细教程(释放AI生产力)》本文介绍了本地部署DeepSeekR1模型和通过API调用将其集成到VSCode中的过程,作者详细步骤展示了如何下载和... 目录前言一、deepseek R1模型与chatGPT o1系列模型对比二、本地部署步骤1.安装oll

在不同系统间迁移Python程序的方法与教程

《在不同系统间迁移Python程序的方法与教程》本文介绍了几种将Windows上编写的Python程序迁移到Linux服务器上的方法,包括使用虚拟环境和依赖冻结、容器化技术(如Docker)、使用An... 目录使用虚拟环境和依赖冻结1. 创建虚拟环境2. 冻结依赖使用容器化技术(如 docker)1. 创

Spring Boot整合log4j2日志配置的详细教程

《SpringBoot整合log4j2日志配置的详细教程》:本文主要介绍SpringBoot项目中整合Log4j2日志框架的步骤和配置,包括常用日志框架的比较、配置参数介绍、Log4j2配置详解... 目录前言一、常用日志框架二、配置参数介绍1. 日志级别2. 输出形式3. 日志格式3.1 PatternL

MySQL8.2.0安装教程分享

《MySQL8.2.0安装教程分享》这篇文章详细介绍了如何在Windows系统上安装MySQL数据库软件,包括下载、安装、配置和设置环境变量的步骤... 目录mysql的安装图文1.python访问网址2javascript.点击3.进入Downloads向下滑动4.选择Community Server5.

CentOS系统Maven安装教程分享

《CentOS系统Maven安装教程分享》本文介绍了如何在CentOS系统中安装Maven,并提供了一个简单的实际应用案例,安装Maven需要先安装Java和设置环境变量,Maven可以自动管理项目的... 目录准备工作下载并安装Maven常见问题及解决方法实际应用案例总结Maven是一个流行的项目管理工具

本地私有化部署DeepSeek模型的详细教程

《本地私有化部署DeepSeek模型的详细教程》DeepSeek模型是一种强大的语言模型,本地私有化部署可以让用户在自己的环境中安全、高效地使用该模型,避免数据传输到外部带来的安全风险,同时也能根据自... 目录一、引言二、环境准备(一)硬件要求(二)软件要求(三)创建虚拟环境三、安装依赖库四、获取 Dee

MySql9.1.0安装详细教程(最新推荐)

《MySql9.1.0安装详细教程(最新推荐)》MySQL是一个流行的关系型数据库管理系统,支持多线程和多种数据库连接途径,能够处理上千万条记录的大型数据库,本文介绍MySql9.1.0安装详细教程,... 目录mysql介绍:一、下载 Mysql 安装文件二、Mysql 安装教程三、环境配置1.右击此电脑

在idea中使用mysql数据库超详细教程

《在idea中使用mysql数据库超详细教程》:本文主要介绍如何在IntelliJIDEA中连接MySQL数据库,并使用控制台执行SQL语句,还详细讲解了如何使用MyBatisGenerator快... 目录一、连接mysql二、使用mysql三、快速生成实体、接口、sql文件总结一、连接mysql在ID