Skip to content

Commit

Permalink
Version 0.2.2
Browse files Browse the repository at this point in the history
* Fix bugs for MAKE_COMPONENT rotation errors.
* Microring add_heater should generate conductor layer on the heater layer.
* More functions for MODE varFDTD simulation tools.
* Rename a funciton in fdtdapi: add_source -> add_mode_source.
* Function for removing cells.
* Function for renaming all drawing on Lumerical CAD.
  • Loading branch information
Hideousmon committed Nov 9, 2021
1 parent bcd271e commit 2cbbfb4
Show file tree
Hide file tree
Showing 18 changed files with 832 additions and 135 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,12 @@ A polarization beam splitter inverse design example can be found [here](https://
* ASBend & SBend bugs fixed for 'z_start' attribute missing.
* AQuarBend & QuarBend bugs fixed for unacceptable 'tuple' parameters.
* DoubleBendConnector bugs fixed for wrong type definition.

### Version 0.2.2 (Nov 9, 2021)

* Fix bugs for MAKE_COMPONENT rotation errors.
* Microring add_heater should generate conductor layer on the heater layer.
* More functions for MODE varFDTD simulation tools.
* Rename a funciton in fdtdapi: add_source -> add_mode_source.
* Function for removing cells.
* Function for renaming all drawing on Lumerical CAD.
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ Version 0.2.1 (Nov 3, 2021)
- AQuarBend & QuarBend bugs fixed for 'tuple' parameters unacceptable.
- DoubleBendConnector bugs fixed for wrong type definition.

Version 0.2.2 (Nov 9, 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Fix bugs for MAKE_COMPONENT rotation errors.
- Microring add_heater should generate conductor layer on the heater layer.
- More functions for MODE varFDTD simulation tools.
- Rename a funciton in fdtdapi: add_source -> add_mode_source.
- Function for removing cells.
- Function for renaming all drawing on Lumerical CAD.



.. |GitHub repository| image:: https://img.shields.io/badge/github-SPLayout-blue
:target: https://github.com/Hideousmon/SPLayout
Expand Down
3 changes: 3 additions & 0 deletions docs/apireference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ make_gdsii_file

.. autofunction:: splayout.make_gdsii_file

remove_cell
================

.. autofunction:: splayout.remove_cell

******************************************
FDTD API
Expand Down
4 changes: 2 additions & 2 deletions examples/inversedesign/PBS_DBS.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
make_gdsii_file("PBS.gds")

## add sources and monitors for the FDTD simulation
fdtd.add_source(waveguide_input.get_start_point() + (2, 0), source_name="source_TE", width=1, mode_number=1,
fdtd.add_mode_source(waveguide_input.get_start_point() + (2, 0), source_name="source_TE", width=1, mode_number=1,
wavelength_start=1.525, wavelength_end=1.575)
fdtd.add_source(waveguide_input.get_start_point() + (2, 0), source_name="source_TM", width=1, mode_number=2,
fdtd.add_mode_source(waveguide_input.get_start_point() + (2, 0), source_name="source_TM", width=1, mode_number=2,
wavelength_start=1.525, wavelength_end=1.575)
fdtd.add_mode_expansion(waveguide_output1.get_end_point() - (2, 0), mode_list=[1, 2], width=1,
expansion_name="mode1", points=101)
Expand Down
54 changes: 27 additions & 27 deletions splayout/Selfdefinecomponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def MAKE_COMPONENT(filename,rename=None,relative_start_point=Point(0,0),relative
class SelfDefineComponent():
def __init__(self,start_point,relative_position=RIGHT):
self.start_point = tuple_to_point(start_point) - relative_start_point
self.rotate_radian = (relative_position - initial_relative_position + 360)%360
self.rotate_radian = int(relative_position - initial_relative_position + 360)%360
self.count = SelfDefineCount_local
if (type(relative_start_point) != type(None)):
if (self.rotate_radian == RIGHT):
Expand All @@ -95,85 +95,85 @@ def __init__(self,start_point,relative_position=RIGHT):
else:
self.start_point_for_return = None
if (type(relative_end_point) != type(None)):
relative_end_point_transfer = relative_end_point - relative_start_point
relative_end_point_transfer = relative_end_point
if (self.rotate_radian == RIGHT):
self.end_point_for_return = self.start_point + relative_start_point + relative_end_point_transfer
self.end_point_for_return = self.start_point + relative_end_point_transfer
elif (self.rotate_radian == UP):
self.end_point_for_return = self.start_point + relative_start_point + Point(-relative_end_point_transfer.y,
self.end_point_for_return = self.start_point + Point(-relative_end_point_transfer.y,
relative_end_point_transfer.x)
elif (self.rotate_radian == LEFT):
self.end_point_for_return = self.start_point + relative_start_point + Point(-relative_end_point_transfer.x,
-relative_end_point_transfer.y)
self.end_point_for_return = self.start_point + Point(-relative_end_point_transfer.x,
- relative_end_point_transfer.y)
elif (self.rotate_radian == DOWN):
self.end_point_for_return = self.start_point + relative_start_point + Point(relative_end_point_transfer.y,
self.end_point_for_return = self.start_point + Point(relative_end_point_transfer.y,
-relative_end_point_transfer.x)
else:
raise Exception("Wrong relative position!")
else:
self.end_point_for_return = None
if (type(relative_input_point) != type(None)):
relative_input_point_transfer = relative_input_point - relative_start_point
relative_input_point_transfer = relative_input_point
if (self.rotate_radian == RIGHT):
self.input_point_for_return = self.start_point + relative_start_point + relative_input_point_transfer
self.input_point_for_return = self.start_point + relative_input_point_transfer
elif (self.rotate_radian == UP):
self.input_point_for_return = self.start_point + relative_start_point + Point(-relative_input_point_transfer.y,
self.input_point_for_return = self.start_point + Point(-relative_input_point_transfer.y,
relative_input_point_transfer.x)
elif (self.rotate_radian == LEFT):
self.input_point_for_return = self.start_point + relative_start_point + Point(-relative_input_point_transfer.x,
self.input_point_for_return = self.start_point + Point(-relative_input_point_transfer.x,
-relative_input_point_transfer.y)
elif (self.rotate_radian == DOWN):
self.input_point_for_return = self.start_point + relative_start_point + Point(relative_input_point_transfer.y,
self.input_point_for_return = self.start_point + Point(relative_input_point_transfer.y,
-relative_input_point_transfer.x)
else:
raise Exception("Wrong relative position!")
else:
self.input_point_for_return = None
if (type(relative_through_point) != type(None)):
relative_through_point_transfer = relative_through_point - relative_start_point
relative_through_point_transfer = relative_through_point
if (self.rotate_radian == RIGHT):
self.through_point_for_return = self.start_point + relative_start_point + relative_through_point_transfer
self.through_point_for_return = self.start_point + relative_through_point_transfer
elif (self.rotate_radian == UP):
self.through_point_for_return = self.start_point + relative_start_point + Point(-relative_through_point_transfer.y,
self.through_point_for_return = self.start_point + Point(-relative_through_point_transfer.y,
relative_through_point_transfer.x)
elif (self.rotate_radian == LEFT):
self.through_point_for_return = self.start_point + relative_start_point + Point(-relative_through_point_transfer.x,
self.through_point_for_return = self.start_point + Point(-relative_through_point_transfer.x,
-relative_through_point_transfer.y)
elif (self.rotate_radian == DOWN):
self.through_point_for_return = self.start_point + relative_start_point + Point(relative_through_point_transfer.y,
self.through_point_for_return = self.start_point + Point(relative_through_point_transfer.y,
-relative_through_point_transfer.x)
else:
raise Exception("Wrong relative position!")
else:
self.through_point_for_return = None
if (type(relative_drop_point) != type(None)):
relative_drop_point_transfer = relative_drop_point - relative_start_point
relative_drop_point_transfer = relative_drop_point
if (self.rotate_radian == RIGHT):
self.drop_point_for_return = self.start_point + relative_start_point + relative_drop_point_transfer
self.drop_point_for_return = self.start_point + relative_drop_point_transfer
elif (self.rotate_radian == UP):
self.drop_point_for_return = self.start_point + relative_start_point + Point(-relative_drop_point_transfer.y,
self.drop_point_for_return = self.start_point + Point(-relative_drop_point_transfer.y,
relative_drop_point_transfer.x)
elif (self.rotate_radian == LEFT):
self.drop_point_for_return = self.start_point + relative_start_point + Point(-relative_drop_point_transfer.x,
self.drop_point_for_return = self.start_point + Point(-relative_drop_point_transfer.x,
-relative_drop_point_transfer.y)
elif (self.rotate_radian == DOWN):
self.drop_point_for_return = self.start_point + relative_start_point + Point(relative_drop_point_transfer.y,
self.drop_point_for_return = self.start_point + Point(relative_drop_point_transfer.y,
-relative_drop_point_transfer.x)
else:
raise Exception("Wrong relative position!")
else:
self.drop_point_for_return = None
if (type(relative_add_point) != type(None)):
relative_add_point_transfer = relative_add_point - relative_start_point
relative_add_point_transfer = relative_add_point
if (self.rotate_radian == RIGHT):
self.add_point_for_return = self.start_point + relative_start_point + relative_add_point_transfer
self.add_point_for_return = self.start_point + relative_add_point_transfer
elif (self.rotate_radian == UP):
self.add_point_for_return = self.start_point + relative_start_point + Point(-relative_add_point_transfer.y,
self.add_point_for_return = self.start_point + Point(-relative_add_point_transfer.y,
relative_add_point_transfer.x)
elif (self.rotate_radian == LEFT):
self.add_point_for_return = self.start_point + relative_start_point + Point(-relative_add_point_transfer.x,
self.add_point_for_return = self.start_point + Point(-relative_add_point_transfer.x,
-relative_add_point_transfer.y)
elif (self.rotate_radian == DOWN):
self.add_point_for_return = self.start_point + relative_start_point + Point(relative_add_point_transfer.y,
self.add_point_for_return = self.start_point + Point(relative_add_point_transfer.y,
-relative_add_point_transfer.x)
else:
raise Exception("Wrong relative position!")
Expand Down
2 changes: 1 addition & 1 deletion splayout/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.2.1"
__version__ = "0.2.2"

from splayout.AEMDgrating import MAKE_AEMD_GRATING
from splayout.bend import Bend
Expand Down
7 changes: 5 additions & 2 deletions splayout/bend.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ class Bend:
material : str or float
Material setting for the structure in Lumerical FDTD (SiO2 = "SiO2 (Glass) - Palik", SiO2 = "SiO2 (Glass) - Palik"). When it is a float, the material in FDTD will be
<Object defined dielectric>, and index will be defined. (default: None, only useful when draw on CAD)
rename : String
New name of the structure in Lumerical.
"""
def __init__(self,center_point, start_radian, end_radian, width , radius, z_start = None, z_end = None, material = None):
def __init__(self,center_point, start_radian, end_radian, width , radius, z_start = None, z_end = None, material = None, rename = None):
self.center_point = tuple_to_point(center_point)
self.start_radian = start_radian
self.end_radian = end_radian
Expand All @@ -35,6 +37,7 @@ def __init__(self,center_point, start_radian, end_radian, width , radius, z_star
self.z_start = z_start
self.z_end = z_end
self.material = material
self.rename = rename
self.start_point = Point(self.center_point.x + radius*math.cos(start_radian),
self.center_point.y + radius*math.sin(start_radian))
self.end_point = Point(self.center_point.x + radius * math.cos(end_radian),
Expand Down Expand Up @@ -84,7 +87,7 @@ def draw_on_lumerical_CAD(self, engine):
engine.put_round(self.center_point, inner_radius = self.radius - self.width/2,
outer_radius = self.radius + self.width/2,
start_radian = self.start_radian,
end_radian = self.end_radian, z_start=self.z_start, z_end= self.z_end, material= self.material)
end_radian = self.end_radian, z_start=self.z_start, z_end= self.z_end, material= self.material, rename = self.rename)
else:
raise Exception("Z-axis specification or material specification is missing!")
else:
Expand Down
Loading

0 comments on commit 2cbbfb4

Please sign in to comment.