From 7eda7ea873c73f1a5188db74741cae44dc16132b Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 16 Sep 2018 20:18:04 -0700 Subject: [PATCH 1/4] Clarify docs -- read returns a dict --- masque/file/gdsii.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/masque/file/gdsii.py b/masque/file/gdsii.py index 61f20ab..a62e437 100644 --- a/masque/file/gdsii.py +++ b/masque/file/gdsii.py @@ -255,9 +255,9 @@ def read_dtype2dose(filename: str) -> (List[Pattern], Dict[str, Any]): def read(filename: str, use_dtype_as_dose: bool = False, clean_vertices: bool = True, - ) -> (List[Pattern], Dict[str, Any]): + ) -> (Dict[str, Pattern], Dict[str, Any]): """ - Read a gdsii file and translate it into a list of Pattern objects. GDSII structures are + Read a gdsii file and translate it into a dict of Pattern objects. GDSII structures are translated into Pattern objects; boundaries are translated into polygons, and srefs and arefs are translated into SubPattern objects. @@ -268,7 +268,7 @@ def read(filename: str, :param clean_vertices: If true, remove any redundant vertices when loading polygons. The cleaning process removes any polygons with zero area or <3 vertices. Default True. - :return: Tuple: (List of Patterns generated GDSII structures, Dict of GDSII library info) + :return: Tuple: (Dict of pattern_name:Patterns generated from GDSII structures, Dict of GDSII library info) """ with open(filename, mode='rb') as stream: From 4323d81abda478c4fa589a5aa30d9fae7699e80e Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 16 Sep 2018 20:18:21 -0700 Subject: [PATCH 2/4] Change default written library name --- masque/file/gdsii.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/masque/file/gdsii.py b/masque/file/gdsii.py index a62e437..c2a15e3 100644 --- a/masque/file/gdsii.py +++ b/masque/file/gdsii.py @@ -53,7 +53,7 @@ def write(patterns: Pattern or List[Pattern], """ # Create library lib = gdsii.library.Library(version=600, - name='masque-write_dose2dtype'.encode('ASCII'), + name='masque-gdsii-write'.encode('ASCII'), logical_unit=logical_units_per_unit, physical_unit=meters_per_unit) From 48b8087d0c043f0f41f6c3a985587fe115d98212 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 16 Sep 2018 20:19:28 -0700 Subject: [PATCH 3/4] Make read output consistent with write args --- masque/file/gdsii.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/masque/file/gdsii.py b/masque/file/gdsii.py index c2a15e3..7fe3738 100644 --- a/masque/file/gdsii.py +++ b/masque/file/gdsii.py @@ -261,6 +261,12 @@ def read(filename: str, translated into Pattern objects; boundaries are translated into polygons, and srefs and arefs are translated into SubPattern objects. + Additional library info is returned in a dict, containing: + 'name': name of the library + 'meters_per_unit': number of meters per database unit (all values are in database units) + 'logical_units_per_unit': number of "logical" units displayed by layout tools (typically microns) + per database unit + :param filename: Filename specifying a GDSII file to read from. :param use_dtype_as_dose: If false, set each polygon's layer to (gds_layer, gds_datatype). If true, set the layer to gds_layer and the dose to gds_datatype. @@ -275,8 +281,8 @@ def read(filename: str, lib = gdsii.library.Library.load(stream) library_info = {'name': lib.name.decode('ASCII'), - 'physical_unit': lib.physical_unit, - 'logical_unit': lib.logical_unit, + 'meters_per_unit': lib.physical_unit, + 'logical_units_per_unit': lib.logical_unit, } def ref_element_to_subpat(element, offset: vector2) -> SubPattern: From 8b9d0fa2c97711e176c8ebf528fbd75f2b157875 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sun, 16 Sep 2018 20:20:56 -0700 Subject: [PATCH 4/4] use python3 for setup --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6772b91..b12a255 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from setuptools import setup, find_packages import masque