Skip to content

Commit

Permalink
Version 0.1.6
Browse files Browse the repository at this point in the history
* README.rst for pypi ducumentation.
* Support numpy array for Polygong definition.
* Annotation for DBS run .
* Support cell flatten.
* Fix a bug: initial_solution in DirectBianrySearchAlgorithm can not be properly defined.
  • Loading branch information
Hideousmon committed Sep 17, 2021
1 parent 08b7f19 commit ff56edc
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 5 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The documentation can be found [here](https://splayout.readthedocs.io/en/latest/
* SBend docs update.
* Variable names: angle -> radian.
* AEMD gratings can have multiple definitions in a file.
* AEMD Grating default relative positionRIGHT.
* AEMD Grating default relative position: RIGHT.
* New cell function: self.remove_components().
* If the input filename of "make_gdsii_file" is not "*.gds", it will automatically add ".gds" to the tail.
* New class: Circle, Rectangle.
Expand All @@ -80,3 +80,11 @@ The documentation can be found [here](https://splayout.readthedocs.io/en/latest/
* FDTD API added.
* Binary Bat Algorithm & Direct Binary Search Algorithm for inverse design.

### Version 0.1.6 (Sep 17, 2021)

* README.rst for pypi ducumentation.
* Support numpy array for Polygong definition.
* Annotation for DBS run .
* Support cell flatten.
* Fix a bug: initial_solution in DirectBianrySearchAlgorithm can not be properly defined.

113 changes: 113 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
SPLayout
========

|GitHub repository| |GitHub license|

Silicon Photonics Design Tools for GDSII Files. It is based on
**gdspy**\ (`heitzmann/gdspy: Python module for creating GDSII stream
files, usually CAD layouts.
(github.com) <https://github.com/heitzmann/gdspy>`__) and can interact
with it.

Dependency
----------

- Python3 (3.6, 3.7, 3.8)
- gdspy
- scipy
- numpy

Installation
------------

use pip:

::

pip install splayout

or download from the source and build/install with:

::

python setup.py install

Documentation
-------------

The documentation can be found
`here <https://splayout.readthedocs.io/en/latest/>`__.


History
-------

Version 0.0.1 (Jun 29, 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Initial release

Version 0.0.2 (Jun 30, 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Fix a fatal bug in version 0.0.1 that Selfdefinecomponent can not
work with multi-components.

Version 0.0.3 (Jul 1, 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Add document.
- Fix a bug that the microring can not return the right pad point when
it is rotated.
- Fix a bug horizonal -> horizontal.
- Fix a bug Point.\_\_eq\_\_ will return False when other==None.

Version 0.0.4 (Jul 21, 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Lift restrictions on taper length.
- Support coordinate transfer for MAKE\_COMPONENT.

Version 0.0.5 (Jul 24, 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Add self.get\_start\_point() for AEMD\_grating.
- New Class: SBend & ASBend.
- Add a constant: pi = math.pi.

Version 0.0.6 (Jul 27,2021) & Version 0.0.7 (Jul 28, 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- SBend docs update.
- Variable names: angle -> radian.
- AEMD gratings can have multiple definitions in a file.
- AEMD Grating default relative position\: RIGHT.
- New cell function: self.remove\_components().
- If the input filename of "make\_gdsii\_file" is not "\*.gds", it will
automatically add ".gds" to the tail.
- New class: Circle, Rectangle.
- Add port points definition for Polygon.

Version 0.1.4 & Version 0.1.5 (Sep 6, 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- FDTD API added.
- Binary Bat Algorithm & Direct Binary Search Algorithm for inverse
design.

Version 0.1.6 (Sep 17, 2021)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- README.rst for pypi ducumentation.
- Support numpy array for Polygong definition.
- Annotation for DBS run .
- Support cell flatten.
- Fix a bug: initial_solution in DirectBianrySearchAlgorithm can not be properly defined.




.. |GitHub repository| image:: https://img.shields.io/badge/github-SPLayout-blue
:target: https://github.com/Hideousmon/SPLayout
.. |GitHub license| image:: https://img.shields.io/badge/lisence-GNU--3.0-green
:target: https://github.com/Hideousmon/SPLayout/blob/main/LICENSE

2 changes: 2 additions & 0 deletions examples/inverse design/powersplitter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@


5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python


from setuptools import setup

with open("README.rst") as fin:
long_description = fin.read()

with open("splayout/__init__.py") as fin:
for line in fin:
Expand All @@ -16,6 +16,7 @@
author='Zhenyu ZHAO',
author_email='[email protected]',
install_requires=['gdspy','numpy','scipy'],
long_description=long_description,
url="https://github.com/Hideousmon/SPLayout",
packages=['splayout']
)
5 changes: 4 additions & 1 deletion splayout/DirectBinarySearchAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self,loS,cost_function,max_iteration = 4,callback_function = None,i
self.cost_function = cost_function
self.max_iteration = max_iteration

if (initial_solution != None):
if (type(initial_solution) != type(None)):
self.__Sol = initial_solution
else:
self.__Sol = np.random.randint(0, 2, size=(self.loS))
Expand All @@ -53,6 +53,9 @@ def __engine_init(self):
self.__iter = 0

def run(self):
"""
Run the DBS engine.
"""
while (self.__iter < self.max_iteration):
self.__undisturbed = np.array(range(0, self.loS))
for i in range(0,self.loS):
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.1.5"
__version__ = "0.1.6"

from splayout.AEMDgrating import MAKE_AEMD_GRATING
from splayout.bend import Bend
Expand Down
9 changes: 9 additions & 0 deletions splayout/polygon.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from splayout.utils import *
import numpy as np

class Polygon:
"""
Expand All @@ -24,13 +25,21 @@ class Polygon:
def __init__(self,point_list, start_point = None, end_point = None, input_point = None, through_point = None, drop_point = None, add_point = None):
self.point_list = []
self.tuple_list = []
if (type(point_list) == np.ndarray):
point_list = point_list.tolist()
for item in point_list:
if type(item) == Point:
self.tuple_list.append(item.to_tuple())
self.point_list.append(item)
elif type(item) == tuple:
self.tuple_list.append(item)
self.point_list.append(Point(item[0],item[1]))
elif type(item) == list:
self.tuple_list.append(tuple(item))
self.point_list.append(Point(item[0], item[1]))
elif type(item) == np.ndarray:
self.tuple_list.append(tuple(item))
self.point_list.append(Point(item[0], item[1]))
else:
raise Exception("Polygon Wrong Type Input!")

Expand Down
7 changes: 7 additions & 0 deletions splayout/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
pi = math.pi
Si = "Si (Silicon) - Palik"
SiO2 = "SiO2 (Glass) - Palik"
ETCH = "etch"
FORWARD = 1
BACKWARD = 0

Expand Down Expand Up @@ -156,6 +157,12 @@ def remove_components(self):
self.cell.flatten()
self.cell.remove_polygons(lambda pts, layer, datatype:any)

def flatten(self):
"""
Flatten all the polygons in the cell.
"""
self.cell.flatten()


def make_gdsii_file(filename,cover_source_layer=None,cover_target_layer=None,inv_source_layer=None,inv_target_layer=None):
"""
Expand Down

0 comments on commit ff56edc

Please sign in to comment.