diff --git a/.github/workflows/check-path-length.yml b/.github/workflows/check-path-length.yml new file mode 100644 index 00000000..fcf27498 --- /dev/null +++ b/.github/workflows/check-path-length.yml @@ -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 + \ No newline at end of file diff --git a/klayout_dot_config/python/SiEPIC/scripts.py b/klayout_dot_config/python/SiEPIC/scripts.py index 1535cf9c..7942fee3 100644 --- a/klayout_dot_config/python/SiEPIC/scripts.py +++ b/klayout_dot_config/python/SiEPIC/scripts.py @@ -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 @@ -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: diff --git a/klayout_dot_config/python/SiEPIC/utils/layout.py b/klayout_dot_config/python/SiEPIC/utils/layout.py index 61352a73..3bae0bd3 100644 --- a/klayout_dot_config/python/SiEPIC/utils/layout.py +++ b/klayout_dot_config/python/SiEPIC/utils/layout.py @@ -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. @@ -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