Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coupler_array function, fixes #226

Merged
merged 6 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

9 changes: 6 additions & 3 deletions klayout_dot_config/python/SiEPIC/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3093,9 +3093,9 @@ def replace_cell(layout, cell_x_name, cell_y_name, cell_y_file=None, cell_y_libr

import os
if debug:
print(" - cell replacement for: %s, with cell %s (%s), " % (cell_x_name, cell_y_name, os.path.basename(cell_y_file)))
print(" - cell replacement for: %s, with cell %s (%s or %s), " % (cell_x_name, cell_y_name, cell_y_file, cell_y_library))
log = ''
log += "- cell replacement for: %s, with cell %s (%s)\n" % (cell_x_name, cell_y_name, os.path.basename(cell_y_file))
log += "- cell replacement for: %s, with cell %s (%s or %s)\n" % (cell_x_name, cell_y_name, cell_y_file, cell_y_library)

# Find the cells that need replacement (cell_x)
# find cell name exactly matching cell_x_name
Expand Down Expand Up @@ -3555,7 +3555,10 @@ def __init__(self):
count_fixed_cells += 1
if not found:
print(' - Warning: no fixed GDS/OAS files found for library: %s, in folder: %s' % (library_name, dir_path))

else:
if verbose:
for c in self.layout().top_cells():
print(" - cell: %s" % c.name )

# Create the PCell declarations
if folder_pcell:
Expand Down
53 changes: 52 additions & 1 deletion klayout_dot_config/python/SiEPIC/utils/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
floorplan(topcell, x, y)
new_layout(tech, topcell_name, overwrite = False)
strip2rib
FaML_two
coupler_array

TODO: enhance documentation
TODO: make some of the functions in util use these.
Expand Down Expand Up @@ -1367,4 +1369,53 @@ def FaML_two(cell,
cell.shapes(ly.layer(ly.TECHNOLOGY['Text'])).insert(text).text_size = 5/ly.dbu
return [inst_faml1, inst_faml2]


def coupler_array(cell,
x_offset=0,
y_offset=127e3/2-5e3,
pitch = 127e3,
count = 4,
label='opt_in_TE_1550_device_test',
label_location = 2,
label_size = 5,
cell_name = 'GC_TE_1550_8degOxide_BB',
cell_library = 'EBeam',
cell_params = {},
):
'''
Create a layout consisting of an array of optical couplers
return the instances
include automated test labels

cell: into which to place the components
x_offset, y_offset: location to place them, bottom coupler
pitch: the pitch for the coupler array

label: on Text layer
label_location: 1 is the top
label_size: font size

cell_name, _library, _params: can be a fixed cell, or a PCell

'''
from pya import Trans, CellInstArray, Text
ly = cell.layout()

# Load cell from library, either fixed or PCell
cell_coupler = ly.create_cell(cell_name, cell_library, cell_params)
if not cell_coupler:
cell_coupler = ly.create_cell(cell_name, cell_library)
if not cell_coupler:
raise Exception ('Cannot load coupler cell (%s) from library (%s) with parameters (%s).' % (cell_name, cell_library, cell_params))

inst_couplers = []
for i in range(count):
t = Trans(Trans.R0, x_offset, y_offset + (count-i-1)*pitch)
inst_couplers.append(
cell.insert(CellInstArray(cell_coupler.cell_index(), t))
)
if i==label_location-1:
# automated test label
text = Text (label, t)
cell.shapes(ly.layer(ly.TECHNOLOGY['Text'])).insert(text).text_size = label_size/ly.dbu

return inst_couplers
Loading