Skip to content

Commit

Permalink
Allow setting custom export path in mask export
Browse files Browse the repository at this point in the history
This MR adds the -p option to the kqc mask script, to specify a custom path where the mask will be exported.
  • Loading branch information
caspar-iqm committed Nov 13, 2024
1 parent ab52719 commit 61f06b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion klayout_package/python/kqcircuits/masks/mask_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import copy
import os
import logging
import sys
from sys import argv
from time import perf_counter
from inspect import isclass
Expand All @@ -29,6 +30,7 @@

from kqcircuits.chips.chip import Chip
from kqcircuits.masks.multi_face_mask_layout import MultiFaceMaskLayout
from kqcircuits.run import argument_parser
from kqcircuits.util.log_router import route_log
from kqcircuits.pya_resolver import pya, is_standalone_session
from kqcircuits.defaults import default_bar_format, TMP_PATH, default_face_id
Expand Down Expand Up @@ -79,12 +81,17 @@ def __init__(
with_grid=False,
export_drc="",
mask_export_layers=None,
export_path=TMP_PATH,
export_path=None,
add_mask_name_to_chips=False,
):

self._time = {"INIT": perf_counter(), "ADD_CHIPS": 0, "BUILD": 0, "EXPORT": 0, "END": 0}

if export_path is None:
arg_parser, _ = argument_parser()
arg_values, _ = arg_parser.parse_known_args(sys.argv[1:])
export_path = TMP_PATH if not arg_values.p else arg_values.p

if view is None:
self.view = KLayoutView()
self.layout = self.view.layout
Expand All @@ -100,6 +107,7 @@ def __init__(
self.add_mask_name_to_chips = add_mask_name_to_chips
self._extra_params = {}
self._mask_set_dir = Path(export_path) / f"{name}_v{version}"
print(f"Exporting to: {str(self._mask_set_dir)}")

self._mask_set_dir.mkdir(parents=True, exist_ok=True)

Expand Down
1 change: 1 addition & 0 deletions klayout_package/python/kqcircuits/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def argument_parser():
)
mask_parser.add_argument("-s", "--skip_extras", action="store_true", help="Skip netlist and documentation export")
mask_parser.add_argument("-c N", action="store_true", help="Limit the number of used CPUs to 'N'")
mask_parser.add_argument("-p", action="store", help="Path to export the mask to, defaults to TMP_PATH")

singularity_parser.add_argument("--build", action="store_true", help="build singularity image locally")
singularity_parser.add_argument(
Expand Down

0 comments on commit 61f06b4

Please sign in to comment.