From 1530396ee8040cb6a55cf3e548765120fde353a0 Mon Sep 17 00:00:00 2001 From: Hideousmon Date: Sun, 25 Aug 2024 15:23:45 +0800 Subject: [PATCH] Version 0.5.6 * Defining material with float refractive index enabled for FDTDSimulation.add_structure_from_gdsii(). --- history.md | 7 +++++-- splayout/__init__.py | 2 +- splayout/lumericalcommun/fdtdapi.py | 16 +++++++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/history.md b/history.md index 7c347b6..8f92e0b 100644 --- a/history.md +++ b/history.md @@ -226,6 +226,9 @@ ### Version 0.5.4 (May 21, 2024) * Automatically search for Ansys Lumerical Python API. * Add use_gpu option for fdtd_region. -* + ### Version 0.5.5 (Jul 21, 2024) -* Add flip rotate scale move operations for layers. \ No newline at end of file +* Add flip rotate scale move operations for layers. + +### Version 0.5.6 (Aug 25, 2024) +* Defining material with float refractive index enabled for FDTDSimulation.add_structure_from_gdsii(). \ No newline at end of file diff --git a/splayout/__init__.py b/splayout/__init__.py index 6ab8efe..74a4328 100644 --- a/splayout/__init__.py +++ b/splayout/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.5.5" +__version__ = "0.5.6" ## Submodules from . import utils diff --git a/splayout/lumericalcommun/fdtdapi.py b/splayout/lumericalcommun/fdtdapi.py index 6731234..04b4e72 100644 --- a/splayout/lumericalcommun/fdtdapi.py +++ b/splayout/lumericalcommun/fdtdapi.py @@ -68,8 +68,9 @@ def add_structure_from_gdsii(self,filename,cellname,layer=1,datatype=0,material= The number of the layer that contains the structure (default: 1). datatype : Int The datatype of the layer that contains the structure (default: 0). - material : String - Material setting for the structure in Lumerical FDTD (Si = "Si (Silicon) - Palik", SiO2 = "SiO2 (Glass) - Palik", default: Si). + material : String or start + Material setting for the structure in Lumerical FDTD (SiO2 = "SiO2 (Glass) - Palik", SiO2 = "SiO2 (Glass) - Palik", default: Si). When it is a float, the material in FDTD will be + , and index will be defined. z_start : Float The start point for the structure in z axis (unit: μm, default: -0.11). z_end : Float @@ -78,7 +79,16 @@ def add_structure_from_gdsii(self,filename,cellname,layer=1,datatype=0,material= New name of the structure in Lumerical FDTD. """ self.fdtd.redrawoff() - self.fdtd.eval("n = gdsimport(\"" + filename + "\",\"" + cellname + "\",\"" +str(layer) +":"+ str(datatype) +"\",\"" + material +"\", "+str(z_start)+"e-6," +str(z_end)+"e-6);") + if type(material) == str: + self.fdtd.eval("n = gdsimport(\"" + filename + "\",\"" + cellname + "\",\"" + str(layer) + ":" + str( + datatype) + "\",\"" + material + "\", " + str(z_start) + "e-6," + str(z_end) + "e-6);") + elif type(material) == float: + self.fdtd.eval("n = gdsimport(\"" + filename + "\",\"" + cellname + "\",\"" + str(layer) + ":" + str( + datatype) + "\",\"" + "" + "\", " + str(z_start) + "e-6," + str(z_end) + "e-6);") + self.fdtd.eval("setnamed(\"::model::"+"GDS_LAYER_" + str(layer) +":" + str(datatype)+"\",\"index\"," + str(material) + ");") + self.fdtd.eval("set(\"index\"," + str(material) + ");") + else: + raise Exception("Wrong material specification!") self.fdtd.redrawon() if (rename != None): self.fdtd.eval("select(\"GDS_LAYER_" + str(layer) +":" + str(datatype) + "\");")