Force dose2dtype to accept only a list of patterns

Backwards incompatible, just like the rest of the gdsii rework
This commit is contained in:
Jan Petykiewicz 2019-05-17 00:29:17 -07:00
parent 1ef8518c60
commit 17451cd995

View File

@ -129,7 +129,7 @@ def writefile(patterns: List[Pattern] or Pattern,
return results return results
def dose2dtype(patterns: Pattern or List[Pattern], def dose2dtype(patterns: List[Pattern],
) -> Tuple[List[Pattern], List[float]]: ) -> Tuple[List[Pattern], List[float]]:
""" """
For each shape in each pattern, set shape.layer to the tuple For each shape in each pattern, set shape.layer to the tuple
@ -149,9 +149,6 @@ def dose2dtype(patterns: Pattern or List[Pattern],
dose_list: A list of doses, providing a mapping between datatype (int, list index) dose_list: A list of doses, providing a mapping between datatype (int, list index)
and dose (float, list entry). and dose (float, list entry).
""" """
if isinstance(patterns, Pattern):
patterns = [patterns]
# Get a dict of id(pattern) -> pattern # Get a dict of id(pattern) -> pattern
patterns_by_id = {id(pattern): pattern for pattern in patterns} patterns_by_id = {id(pattern): pattern for pattern in patterns}
for pattern in patterns: for pattern in patterns:
@ -206,7 +203,7 @@ def dose2dtype(patterns: Pattern or List[Pattern],
dose_mult = subpat.dose * pat_dose dose_mult = subpat.dose * pat_dose
subpat.pattern = new_pats[(id(subpat.pattern), dose_mult)] subpat.pattern = new_pats[(id(subpat.pattern), dose_mult)]
return patterns, list(dose_vals) return patterns, dose_vals_list
def readfile(filename: str or pathlib.Path, def readfile(filename: str or pathlib.Path,