Skip to content

Commit

Permalink
update (#228)
Browse files Browse the repository at this point in the history
* wip #205

* Bump black in /klayout_dot_config/python/SiEPIC/tidy3d/requirements

Bumps [black](https://github.com/psf/black) from 22.3.0 to 24.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](psf/black@22.3.0...24.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update extend.py

* Update run-layout-tests.yml

* Update run-layout-tests.yml

* Fix number of periods not passing to CDC model

* Fix OPICS loading contraDC element parameters

simulation results are now appended to xml

* opics fixes WIP

* Update utils.py

* Create pcell_python_GDSfactory2.lym

* Update run-layout-tests.yml

* Update run-layout-tests.yml

* Component min spacing (#210)

* minimum-gc-spacing implemented, from DFT.xml, using <minimum-gc-spacing>60</minimum-gc-spacing>

* v0.5.7

* Update run-layout-tests.yml

* Update docker-image.yml

* verification: print error messages

* Update Functional Layout Check.lym

* verification fix

Verification.xml wasn't being read for PDK installed via PyPi.

* v0.5.8

* Update __init__.py

* Update sampling.py

`ptp` was removed from the ndarray class in NumPy 2.0. Use np.ptp(arr, ...) instead

* v0.5.9

* Update Dockerfile (#213)

* layout_waveguide2/3 update

- docstring
- parameter checking: CML
- added option for drawing PinRec & DevRec layers in layout_waveguide3()

* create_cell2 function

Wrapper for KLayout's Layout.create_cell(name, library), with error handling, and debugging information if unsuccessful

* strip2rib pcell function

* make_pin: option for layer name

* Create KLayout-SiEPIC-Tools Python Programming.ipynb

* find_pins, hierarchical improvement (WIP)

- allow for overlapping pins, in different cells. Look for exact pin match. Implemented in PinA. Needs to be done for PinB.
@lukasc-ubc

* cell.find_pin improvement

* new load_layout function

* new SiEPIC.utils.waveguide_length function

* sliver fix #214

* verification: shapesoutside check, fix

* v0.5.10

* fixes to SiEPIC.scripts.connect_pins_with_waveguide

* netlist via Script, updated unit test

* unit tests

connect_pin_with_waveguide: relaxed_pinnames
connect_pin_with_waveguide: for connecting between different cells, hierarchially.
delete_extra_topcells
find_automated_measurement_labels
calculate_area

* unit testing

test all fixed and PCells.
fixes to two cells.

* unit testing, SiEPIC.utils

SiEPIC.utils.load_layout
SiEPIC.utils.create_cell2
SiEPIC.utils.waveguide_length

* Pin verification #215

* Pin verification #215 (fix)

* Update run-layout-tests.yml

* Unit testing: SiEPIC.scripts.instantiate_all_library_cells: add terminators (#216)

Improved unit testing, where we test all cells by connecting a terminator, and run verification.

And other cell fixes necessary to get this to work.

* Update run-layout-tests.yml

* Jupyter notebook, Programming

new functions, Cell.plot (show an image), Cell.show (show in KLayout) in SiEPIC.extend

* Update extend.py

* Update run-layout-tests.yml

* minor errors

* bezier bend, sbend, taper

* Update __init__.py

* bezier update

* fix menu Layout > Show selected components

* Update README.md

* remove Radius check in Verification

Disabled for EBeam PDK, since we now have S-Bends, and the checker doesn't recognize them.

* simply loading PDK libraries

* Update test_load_libraries.py

* Update run-layout-tests.yml

* Create python-publish.yml

* update scripts.load_klayout_library

* Update run-layout-tests.yml

* v0.5.14

* Update python-publish.yml

* benchmark 100 MZIs

conclusion: faster than gdsfactory for generic (lightweight) technology

* FaML function and tests

- new PCell GSiP.FaML_Si_1550_BB, for a facet-attached micro-lens
- new function SiEPIC.utils.layout.FaML_two() to create a facet-attached micro-lens array (two channels), with test labels
- new layer BlackBox
- new unit test for the function and PCell
- fix WAVEGUIDES.xml, by adding DevRec layer to Strip waveguide

* v0.5.15

* pytest update

* SiEPIC.utils.geometry.box_bezier_corners (new)

* Update .gitignore

* Update scripts.py

- SiEPIC.scripts.export_layout (): export cell rather than entire layout

* Update layout.py

FaML defaults

* Update test_FaML.py

* SiEPIC.scripts.load_klayout_library: abs path

allow either relative path or absolute path as input

* Create check-path-length.yml

* Update layout.py

* Update check-path-length.yml

* fix for SiEPIC.scripts.replace_cell()

* fix for SiEPIC.utils.layout.coupler_array()

* version check

@mustafacc

I think it would be nice to add an automated check when SiEPIC-Tools (and also the PDKs) are loaded.  This takes 0.2 s.  I tried to use concurrent.futures, but it doesn't seem to speed things up.

* remove temporary files

* requirements

* new: SiEPIC.scripts.layout_diff

Compare the difference between layouts.
Useful for blackbox replacement double-checking.

* Update __init__.py

* Update test_scripts_layout_diff.py

* test SiEPIC.utils.layout.coupler_array()

* v0.5.16

* unit tests, remove temporary files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mustafacc <mustafastation@gmail.com>
Co-authored-by: Sean Lam <seanlam97@gmail.com>
  • Loading branch information
4 people authored Nov 4, 2024
1 parent 7f6ec06 commit c940969
Show file tree
Hide file tree
Showing 59 changed files with 3,955 additions and 1,421 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/check-path-length.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# .github/workflows/check-path-length.yml
name: Check Path Length (200 limit)

on:
push:
pull_request:

jobs:
check-path-length:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Check file path lengths
run: |
# Set the maximum allowed length
MAX_LENGTH=200
# Find all files in the repository and check their path lengths
too_long_paths=0
# Loop through each file path found by find
IFS=$'\n' # Set Internal Field Separator to newline to handle spaces in filenames
for file in $(find . -type f); do
length=${#file}
if (( length > MAX_LENGTH )); then
echo "Path too long: $file ($length characters)"
too_long_paths=$((too_long_paths + 1))
fi
done
if (( too_long_paths > 0 )); then
echo "Error: Found $too_long_paths file paths longer than $MAX_LENGTH characters."
exit 1
else
echo "All file paths are within the $MAX_LENGTH character limit."
fi
3 changes: 2 additions & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ env:

jobs:
build-and-push-image:

if: github.repository_owner == 'SiEPIC'

runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
# python -m build
cd klayout_dot_config/python
python3 -m build
cp -a dist ../..
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}


- name: Publish on KLayout Salt server
run: |
# Extract the tag from GITHUB_REF (e.g., 'refs/tags/v1.0.0' -> 'v1.0.0')
RELEASE_TAG=${GITHUB_REF#refs/tags/}
echo "Release tag: $RELEASE_TAG"
# Use the tag in your script
# ./your-script.sh "$RELEASE_TAG"
curl "https://sami.klayout.org/register_request?agree_terms=1&mail=lukasc%40ece.ubc.ca&provider=5&url_path=siepic%2FSiEPIC-Tools.git%2Ftags%2F$RELEASE_TAG%2Fklayout_dot_config&user=Lukas+Chrostowski"
32 changes: 17 additions & 15 deletions .github/workflows/run-layout-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,32 @@ jobs:

- name: install python 3.11 packages
run: |
python -m pip install --upgrade pip
pip install klayout numpy scipy pytest pytest-cov
pip install pytest pytest-cov IPython
pip install -e klayout_dot_config/python
- name: Test with pytest, python 3.11
run: pytest --cov=klayout_dot_config/python/SiEPIC klayout_dot_config/tech --cov-report=xml
run: pytest --cov=klayout_dot_config/python/SiEPIC --ignore=klayout_dot_config/python/SiEPIC/lumerical --ignore=klayout_dot_config/python/SiEPIC/tidy3d klayout_dot_config --cov-report=xml
# run: pytest --cov=klayout_dot_config/python/SiEPIC klayout_dot_config/tech --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: github.repository_owner == 'SiEPIC'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true

- name: setup python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: "pip"
cache-dependency-path: pyproject.toml
# - name: setup python 3.9
# uses: actions/setup-python@v4
# with:
# python-version: '3.9'
# cache: "pip"
# cache-dependency-path: pyproject.toml

- name: install python 3.9 packages
run: |
python -m pip install --upgrade pip
pip install klayout numpy scipy pytest pytest-cov
# - name: install python 3.9 packages
# run: |
# python -m pip install --upgrade pip
# pip install klayout numpy scipy pytest pytest-cov

- name: Test with pytest, python 3.9
run: pytest klayout_dot_config/tech
# - name: Test with pytest, python 3.9
# run: pytest klayout_dot_config/tech
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
klayoutrc
*.lyrdb

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
FROM quay.io/centos/centos:stream8

# CentOS 8 reached EOL Dec 31, 2021. Therefore, mirrors need to be change to the following
RUN cd /etc/yum.repos.d/
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

# Update the system and install necessary tools.
RUN dnf -y update && \
dnf -y install wget bzip2 unzip git mesa-dri-drivers python3 python3-pip
Expand Down
370 changes: 370 additions & 0 deletions Documentation/KLayout-SiEPIC-Tools Python Programming.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
- Lukas Chrostowski, Hossam Shoman, Mustafa Hammood, Han Yun, Jaspreet Jhoja, Enxiao Luan, Stephen Lin, Ajay Mistry, Donald Witt, Nicolas A. F. Jaeger, Sudip Shekhar, Hasitha Jayatilleka, Philippe Jean, Simon B.-de Villers, Jonathan Cauchon, Wei Shi, Cameron Horvath, Jocelyn N. Westwood-Bachman, Kevin Setzer, Mirwais Aktary, N. Shane Patrick, Richard Bojko, Amin Khavasi, Xu Wang, Thomas Ferreira de Lima, Alexander N. Tait, Paul R. Prucnal, David E. Hagan, Doris Stevanovic, Andy P. Knights, "<a href="https://doi.org/10.1109/JSTQE.2019.2917501">Silicon Photonic Circuit Design Using Rapid Prototyping Foundry Process Design Kits</a>" IEEE Journal of Selected Topics in Quantum Electronics, Volume: 25, Issue: 5, Sept.-Oct. 2019. (<a href="https://www.dropbox.com/s/i1z4ackr3q7fz1l/2019_JSTQE_foundry.pdf?dl=1">PDF</a>)

## Download and Installation instructions:
- in KLayout v0.27, use Tools | Package Manager, and find SiEPIC-Tools there (more details in the [Wiki Instructions](https://github.com/SiEPIC/SiEPIC-Tools/wiki/Installation))
- in KLayout (version 0.27 or greater, preferably 0.29), use Tools | Package Manager, and find SiEPIC-Tools there (more details in the [Wiki Instructions](https://github.com/SiEPIC/SiEPIC-Tools/wiki/Installation))
- install PDK, e.g., <a href="https://github.com/siepic/SiEPIC_EBeam_PDK/wiki/Installation-instructions">SiEPIC_EBeam_PDK download and installation instructions</a> on the wiki page.


Expand Down
2 changes: 1 addition & 1 deletion klayout_dot_config/grain.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<salt-grain>
<name>siepic_tools</name>
<version>0.5.5</version>
<version>0.5.16</version>
<api-version>0.27</api-version>
<title>SiEPIC Tools</title>
<doc>Tools for designing Silicon Photonic Integrated Circuits, including waveguides, component simulations, functional verification, DRC verification, Functional verification, netlist extraction, circuit simulations. Layout can be implemented graphically or by programming in Python using the SiEPIC functions and KLayout Python API. Framework and examples for creating layouts using scripts. Includes a generic PDK (GSiP). Other PDKs are installed separately, and depend on SiEPIC-Tools.</doc>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def show_component_info():
text += ('&lt;br&gt;')
text += " selected cell name: %s" % obj.inst().cell.name
text += ('&lt;br&gt;')
c = cell.find_components(cell_selected=[obj.inst().cell],verbose=True)
c = cell.find_components(cell_selected=tuple([obj.inst().cell]),verbose=True, raiseException = False)
if c and c[0].cell:
text += c[0].display().replace(';','&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;')
if c[0].cell.is_pcell_variant():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
import pya
from SiEPIC import verification

#verification.layout_check(verbose=True, GUI=True)

import cProfile
cProfile.run('verification.layout_check(verbose=False, GUI=True)','/tmp/restats')
import pstats
from pstats import SortKey
p = pstats.Stats('/tmp/restats')
p.sort_stats(SortKey.CUMULATIVE).print_stats(20)
p.sort_stats(SortKey.TIME).print_stats(20)
if 1:
verification.layout_check(verbose=True, GUI=True)
else:
import cProfile
cProfile.run('verification.layout_check(verbose=False, GUI=True)','/tmp/restats')
import pstats
from pstats import SortKey
p = pstats.Stats('/tmp/restats')
p.sort_stats(SortKey.CUMULATIVE).print_stats(20)
p.sort_stats(SortKey.TIME).print_stats(20)

</text>
</klayout-macro>
19 changes: 17 additions & 2 deletions klayout_dot_config/python/SiEPIC/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SiEPIC-Tools package for KLayout
'''

__version__ = '0.5.5'
__version__ = "0.5.16"

print("KLayout SiEPIC-Tools version %s" %__version__)

Expand All @@ -24,4 +24,19 @@
if _globals.Python_Env == "KLayout_GUI":
from . import extend, _globals, core, examples, github, scripts, utils, setup, install, verification
else:
from . import extend, _globals, verification
from . import _globals, core, utils, extend, verification, scripts



try:
# Start timer
import time
start_time = time.time()
from .scripts import version_check

version_check()

execution_time = time.time() - start_time
print(f"Version check, time: {execution_time} seconds")
except:
pass
10 changes: 7 additions & 3 deletions klayout_dot_config/python/SiEPIC/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@ def transform(self, trans):

def display(self):
p = self
print("- pin_name %s: component_idx %s, pin_type %s, rotation: %s, net: %s, (%s), path: %s" %
(p.pin_name, p.component.idx, p.type, p.rotation, p.net.idx, p.center, p.path))
if p.component:
print("- pin_name %s: component_idx %s, pin_type %s, rotation: %s, net: %s, (%s), path: %s" %
(p.pin_name, p.component.idx, p.type, p.rotation, p.net.idx, p.center, p.path))
else:
print("- pin_name %s: pin_type %s, rotation: %s, net: %s, (%s), path: %s" %
(p.pin_name, p.type, p.rotation, p.net.idx, p.center, p.path))
o = self
# print("- pin #%s: component_idx %s, pin_name %s, pin_type %s, net: %s, (%s), path: %s" %
# (o.idx, o.component_idx, o.pin_name, o.type, o.net.idx, o.center, o.path))
Expand Down Expand Up @@ -303,7 +307,7 @@ def set_SPICE_params(self, arg, verbose = False):
self.params = spice_str
return True

def get_SPICE_params(self): #Retturns a SPICE parameter string (without the 'Spice_param:' label)
def get_SPICE_params(self): #Returns a SPICE parameter string (without the 'Spice_param:' label)
return (self.params)

def find_pins(self):
Expand Down
Loading

0 comments on commit c940969

Please sign in to comment.