Skip to content

Commit

Permalink
list specification of union
Browse files Browse the repository at this point in the history
  • Loading branch information
atait committed Mar 9, 2022
1 parent 31398b2 commit 00aefaf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lymask/invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _main(layout, ymlfile, tech_obj=None):
assert_valid_dataprep_steps(step_list)
for func_info in step_list:
func_name, kwargs = func_info_to_func_and_kwargs(func_info)
message('lymask doing {}'.format(func_name))
message('lymask doing {}: {}'.format(func_name, kwargs))
func = all_dpfunc_dict[func_name]
for TOP_ind in layout.each_top_cell():
# call it
Expand All @@ -42,7 +42,7 @@ def _drc_main(layout, ymlfile, tech_obj=None):

for func_info in step_list:
func_name, kwargs = func_info_to_func_and_kwargs(func_info)
message('lymask doing {}'.format(func_name))
message('lymask doing {}: {}'.format(func_name, kwargs))
func = all_drcfunc_dict[func_name]
for TOP_ind in layout.each_top_cell():
func(layout.cell(TOP_ind), rdb, **kwargs)
Expand Down
19 changes: 14 additions & 5 deletions lymask/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import division, print_function, absolute_import
from functools import wraps
from lymask.utilities import active_technology, lys
from lygadgets import pya, message_loud
from lygadgets import pya, message, message_loud

try:
dbu = active_technology().dbu
Expand All @@ -15,11 +15,20 @@
def as_region(cell, layname):
''' Mostly a convenience brevity function.
If a layer isn't in the layer set, return an empty region instead of crashing
If a list, will return the union of the listed layers
'''
try:
return pya.Region(cell.shapes(lys[layname]))
except KeyError:
return pya.Region()
if isinstance(layname, (list, tuple)):
union = pya.Region()
for one_lay in layname:
union += as_region(cell, one_lay)
return union
else:
try:
pya_layer = lys[layname]
except KeyError:
message(f'{layname} not found in layerset.')
return pya.Region()
return pya.Region(cell.shapes(pya_layer))


_thread_count = None
Expand Down
2 changes: 1 addition & 1 deletion lymask/utilities.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import division, print_function, absolute_import
import os
from lygadgets import isGUI, pya, message, lyp_to_layerlist, patch_environment
from lygadgets import isGUI, pya, message, message_loud, lyp_to_layerlist, patch_environment
from lygadgets.technology import Technology, klayout_last_open_technology

#: This global variable to be deprecated
Expand Down

0 comments on commit 00aefaf

Please sign in to comment.