def junctions(cell, datafield): print('--- flattening ' + cell.name) cell.flatten(single_datatype=3) jjs = datafield.pcd.atoms['jjs'] for element in cell.elements: if isinstance(element, gdspy.PolygonSet): if element.layers[0] == jjs[cell.name]['gds']: jj_poly = utils.angusj(element.polygons, element.polygons, 'union') poly = gdspy.Polygon(jj_poly, element.layers[0], verbose=False) add_label(cell, poly, cell.name, datafield) elif isinstance(element, gdspy.Polygon): if element.layers == jjs[cell.name]['gds']: jj_poly = utils.angusj(element.polygons, element.polygons, 'union') poly = gdspy.Polygon(jj_poly, element.layers[0], verbose=False) add_label(cell, poly, cell.name, datafield) jjs = datafield.pcd.atoms['jjs'] get_shunt_connections(cell, jjs, datafield) get_ground_connection(cell, jjs, datafield)
def union(self): points = utils.angusj(subj=self.raw_points, method='union') if not isinstance(points[0][0], list): raise TypeError("poly must be a 3D list") return points
def update_mask(self, datafield, element=None): if element is not None: self.points = utils.angusj(self.points, element.points, 'difference') for pp in self.points: datafield.add(pp, self.key) self.clip = True
def get_shunt_connections(cell, jj_atom, datafield): gds = jj_atom['shunt']['gds'] polygons = cell.get_polygons(True) via_key = (int(gds), 3) shunt_key = (int(jj_atom['shunt']['metals'][1]), 3) for points in utils.angusj(polygons[via_key], polygons[shunt_key], 'intersection'): poly = gdspy.Polygon(points, gds, verbose=False) add_label(cell, poly, 'shunt', datafield)
def union(self): if not isinstance(self.raw_points[0][0], np.ndarray): raise TypeError("poly must be a 3D list") cc_poly = list() for poly in self.raw_points: if pyclipper.Orientation(poly) is False: reverse_poly = pyclipper.ReversePath(poly) cc_poly.append(reverse_poly) else: cc_poly.append(poly) union = utils.angusj(subj=cc_poly, method='union') points = pyclipper.CleanPolygons(union) if not isinstance(points[0][0], list): raise TypeError("poly must be a 3D list") return points
def get_ground_connection(cell, jj_atom, datafield): gds = jj_atom['ground']['gds'] polygons = cell.get_polygons(True) via = (int(gds), 3) ii = polygons[via] for layer in jj_atom['ground']['metals']: pp = (int(layer), 3) ii = utils.angusj(ii, polygons[pp], 'intersection') # for points in utils.angusj(polygons[via_key], polygons[pp], 'intersection'): # poly = gdspy.Polygon(points, gds, verbose=False) # add_label(cell, poly, 'ground', datafield) for points in ii: poly = gdspy.Polygon(points, gds, verbose=False) add_label(cell, poly, 'ground', datafield)
def add(self, element): self.points = utils.angusj(self.points, element.points, 'difference')