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集成redisson实现延时队列教程

《SpringBoot集成redisson实现延时队列教程》文章介绍了使用Redisson实现延迟队列的完整步骤,包括依赖导入、Redis配置、工具类封装、业务枚举定义、执行器实现、Bean创建、消费... 目录1、先给项目导入Redisson依赖2、配置redis3、创建 RedissonConfig 配

基于C#实现PDF转图片的详细教程

《基于C#实现PDF转图片的详细教程》在数字化办公场景中,PDF文件的可视化处理需求日益增长,本文将围绕Spire.PDFfor.NET这一工具,详解如何通过C#将PDF转换为JPG、PNG等主流图片... 目录引言一、组件部署二、快速入门:PDF 转图片的核心 C# 代码三、分辨率设置 - 清晰度的决定因

Java Scanner类解析与实战教程

《JavaScanner类解析与实战教程》JavaScanner类(java.util包)是文本输入解析工具,支持基本类型和字符串读取,基于Readable接口与正则分隔符实现,适用于控制台、文件输... 目录一、核心设计与工作原理1.底层依赖2.解析机制A.核心逻辑基于分隔符(delimiter)和模式匹

spring AMQP代码生成rabbitmq的exchange and queue教程

《springAMQP代码生成rabbitmq的exchangeandqueue教程》使用SpringAMQP代码直接创建RabbitMQexchange和queue,并确保绑定关系自动成立,简... 目录spring AMQP代码生成rabbitmq的exchange and 编程queue执行结果总结s

python使用Akshare与Streamlit实现股票估值分析教程(图文代码)

《python使用Akshare与Streamlit实现股票估值分析教程(图文代码)》入职测试中的一道题,要求:从Akshare下载某一个股票近十年的财务报表包括,资产负债表,利润表,现金流量表,保存... 目录一、前言二、核心知识点梳理1、Akshare数据获取2、Pandas数据处理3、Matplotl

Python pandas库自学超详细教程

《Pythonpandas库自学超详细教程》文章介绍了Pandas库的基本功能、安装方法及核心操作,涵盖数据导入(CSV/Excel等)、数据结构(Series、DataFrame)、数据清洗、转换... 目录一、什么是Pandas库(1)、Pandas 应用(2)、Pandas 功能(3)、数据结构二、安

2025版mysql8.0.41 winx64 手动安装详细教程

《2025版mysql8.0.41winx64手动安装详细教程》本文指导Windows系统下MySQL安装配置,包含解压、设置环境变量、my.ini配置、初始化密码获取、服务安装与手动启动等步骤,... 目录一、下载安装包二、配置环境变量三、安装配置四、启动 mysql 服务,修改密码一、下载安装包安装地

电脑提示d3dx11_43.dll缺失怎么办? DLL文件丢失的多种修复教程

《电脑提示d3dx11_43.dll缺失怎么办?DLL文件丢失的多种修复教程》在使用电脑玩游戏或运行某些图形处理软件时,有时会遇到系统提示“d3dx11_43.dll缺失”的错误,下面我们就来分享超... 在计算机使用过程中,我们可能会遇到一些错误提示,其中之一就是缺失某个dll文件。其中,d3dx11_4

Linux下在线安装启动VNC教程

《Linux下在线安装启动VNC教程》本文指导在CentOS7上在线安装VNC,包含安装、配置密码、启动/停止、清理重启步骤及注意事项,强调需安装VNC桌面以避免黑屏,并解决端口冲突和目录权限问题... 目录描述安装VNC安装 VNC 桌面可能遇到的问题总结描js述linux中的VNC就类似于Window

Go语言编译环境设置教程

《Go语言编译环境设置教程》Go语言支持高并发(goroutine)、自动垃圾回收,编译为跨平台二进制文件,云原生兼容且社区活跃,开发便捷,内置测试与vet工具辅助检测错误,依赖模块化管理,提升开发效... 目录Go语言优势下载 Go  配置编译环境配置 GOPROXYIDE 设置(VS Code)一些基本