def add_cellLabels(self, layers, center=False): if not (type(layers) == list): layers = [layers] cellLattice = sorted(self.upCellLattice, key=itemgetter(1, 0)) # Sort the array first celllabelsUp = Cell('CellLabelsUp') h = self.cellsize vOffsetFactor = 1. txtSize = 200 for i, pt in enumerate(cellLattice): cellid = string.uppercase[i] celllabel = Cell('LBL_F_' + cellid) for l in layers: txt = Label(cellid, txtSize, layer=l) bbox = txt.bounding_box offset = np.array(pt) txt.translate(-np.mean(bbox, 0)) # Center text around origin txt.translate(offset) # Translate it to bottom of wafer celllabel.add(txt) if center: celllabelsUp.add(celllabel) # Middle of cell else: celllabelsUp.add( celllabel, origin=(0, -h / 2. * vOffsetFactor + np.mean(bbox, 0)[1])) # Bottom of cell for tri in self.upTris: self.add(celllabelsUp, origin=tri.centroid) cellLattice = sorted(self.downCellLattice, key=itemgetter(1, 0), reverse=True) celllabelsDown = Cell('CellLabelsDown') h = self.cellsize for i, pt in enumerate(cellLattice): cellid = string.uppercase[i] celllabel = Cell('LBL_F_' + cellid) for l in layers: txt = Label(cellid, txtSize, layer=l) bbox = txt.bounding_box offset = np.array(pt) txt.translate(-np.mean(bbox, 0)) # Center text around origin if self.symmetric_chips: txt.rotate(180) txt.translate(offset) # Translate it to bottom of wafer celllabel.add(txt) if center: celllabelsDown.add(celllabel) # Middle of cell else: celllabelsDown.add( celllabel, origin=(0, -h / 2. * vOffsetFactor + np.mean(bbox, 0)[1])) # Bottom of cell for tri in self.downTris: self.add(celllabelsDown, origin=tri.centroid)
def add_blockLabels(self, layers, center=False): if not (type(layers) == list): layers = [layers] vOffsetFactor = 1. blocklabelsUp = Cell('BlockLabelsUp') h = self.upTris[0].bounds[3] - self.upTris[0].bounds[1] sl_lattice = self.trisize + self.block_gap / np.tan(np.deg2rad(30)) h_lattice = np.sqrt(3.) / 2. * sl_lattice base = h_lattice for tri in self.upTris: lbl_col = self.blockcols[np.round(tri.centroid.x, 8)] lbl_row = self.blockrows[base * round(float(tri.bounds[1]) / base)] blockid = str(lbl_col) + str(lbl_row) blocklabel = Cell('LBL_B_' + blockid) for l in layers: txt = Label(blockid, 1000, layer=l) bbox = txt.bounding_box offset = np.array(tri.centroid) txt.translate(-np.mean(bbox, 0)) # Center text around origin txt.translate(offset) # Translate it to bottom of wafer blocklabel.add(txt) blocklabelsUp.add(blocklabel) if center: self.add(blocklabelsUp) else: self.add(blocklabelsUp, origin=(0, h / 2. * vOffsetFactor)) blocklabelsDown = Cell('BlockLabelsDown') for tri in self.downTris: lbl_col = self.blockcols[np.round(tri.centroid.x, 8)] lbl_row = self.blockrows[base * round(float(tri.bounds[1]) / base)] blockid = str(lbl_col) + str(lbl_row) blocklabel = Cell('LBL_' + blockid) for l in layers: txt = Label(blockid, 1000, layer=l) bbox = txt.bounding_box offset = np.array(tri.centroid) txt.translate(-np.mean(bbox, 0)) # Center text around origin if self.symmetric_chips: txt.rotate(180) txt.translate(offset) # Translate it to bottom of wafer blocklabel.add(txt) blocklabelsDown.add(blocklabel) if center: self.add(blocklabelsDown) else: self.add(blocklabelsDown, origin=(0, -h / 2. * vOffsetFactor))