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

相关文章

Nexus安装和启动的实现教程

《Nexus安装和启动的实现教程》:本文主要介绍Nexus安装和启动的实现教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、Nexus下载二、Nexus安装和启动三、关闭Nexus总结一、Nexus下载官方下载链接:DownloadWindows系统根

CnPlugin是PL/SQL Developer工具插件使用教程

《CnPlugin是PL/SQLDeveloper工具插件使用教程》:本文主要介绍CnPlugin是PL/SQLDeveloper工具插件使用教程,具有很好的参考价值,希望对大家有所帮助,如有错... 目录PL/SQL Developer工具插件使用安装拷贝文件配置总结PL/SQL Developer工具插

Java中的登录技术保姆级详细教程

《Java中的登录技术保姆级详细教程》:本文主要介绍Java中登录技术保姆级详细教程的相关资料,在Java中我们可以使用各种技术和框架来实现这些功能,文中通过代码介绍的非常详细,需要的朋友可以参考... 目录1.登录思路2.登录标记1.会话技术2.会话跟踪1.Cookie技术2.Session技术3.令牌技

Python使用Code2flow将代码转化为流程图的操作教程

《Python使用Code2flow将代码转化为流程图的操作教程》Code2flow是一款开源工具,能够将代码自动转换为流程图,该工具对于代码审查、调试和理解大型代码库非常有用,在这篇博客中,我们将深... 目录引言1nVflRA、为什么选择 Code2flow?2、安装 Code2flow3、基本功能演示

Java Spring 中的监听器Listener详解与实战教程

《JavaSpring中的监听器Listener详解与实战教程》Spring提供了多种监听器机制,可以用于监听应用生命周期、会话生命周期和请求处理过程中的事件,:本文主要介绍JavaSprin... 目录一、监听器的作用1.1 应用生命周期管理1.2 会话管理1.3 请求处理监控二、创建监听器2.1 Ser

MySQL 安装配置超完整教程

《MySQL安装配置超完整教程》MySQL是一款广泛使用的开源关系型数据库管理系统(RDBMS),由瑞典MySQLAB公司开发,目前属于Oracle公司旗下产品,:本文主要介绍MySQL安装配置... 目录一、mysql 简介二、下载 MySQL三、安装 MySQL四、配置环境变量五、配置 MySQL5.1

MQTT SpringBoot整合实战教程

《MQTTSpringBoot整合实战教程》:本文主要介绍MQTTSpringBoot整合实战教程,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考... 目录MQTT-SpringBoot创建简单 SpringBoot 项目导入必须依赖增加MQTT相关配置编写

在Java中基于Geotools对PostGIS数据库的空间查询实践教程

《在Java中基于Geotools对PostGIS数据库的空间查询实践教程》本文将深入探讨这一实践,从连接配置到复杂空间查询操作,包括点查询、区域范围查询以及空间关系判断等,全方位展示如何在Java环... 目录前言一、相关技术背景介绍1、评价对象AOI2、数据处理流程二、对AOI空间范围查询实践1、空间查

Logback在SpringBoot中的详细配置教程

《Logback在SpringBoot中的详细配置教程》SpringBoot默认会加载classpath下的logback-spring.xml(推荐)或logback.xml作为Logback的配置... 目录1. Logback 配置文件2. 基础配置示例3. 关键配置项说明Appender(日志输出器

Kali Linux安装实现教程(亲测有效)

《KaliLinux安装实现教程(亲测有效)》:本文主要介绍KaliLinux安装实现教程(亲测有效),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、下载二、安装总结一、下载1、点http://www.chinasem.cn击链接 Get Kali | Kal