def add_round(self, layer: layer_or_lpp_type, resolution: float, rout: dim_type, center: coord_type = (0, 0), rin: dim_type = 0, theta0: dim_type = 0, theta1: dim_type = 360, nx: int = 1, ny: int = 1, spx: dim_type = 0, spy: dim_type = 0, unit_mode: bool = False): """ Creates a PhotonicRound object based on the provided arguments and adds it to the db """ new_round = PhotonicRound(layer=layer, resolution=resolution, rout=rout, center=center, rin=rin, theta0=theta0, theta1=theta1, nx=nx, ny=ny, spx=spx, spy=spy, unit_mode=unit_mode) self._layout.add_round(new_round) return new_round
def draw_layout(self): self.add_obj( PhotonicRound( layer=self.params['layerA'], resolution=self.grid.resolution, rout=1, center=(0, 0), rin=0, unit_mode=False, )) self.add_rect( layer=self.params['layerB'], coord1=(0.5, 0.25), coord2=(2, 3), unit_mode=False, )
def create_bend(self) -> None: """ Generates a bend based on the provided parameters and adds it to the db. For now, this simply creates a PhotonicRound. But in the future we may want to change this to do something more complex for better performance """ self.bend = PhotonicRound( resolution=self.grid.resolution, layer=self.layer, center=(0, self.radius), rin=self.radius - 0.5 * self.params['width'], rout=self.radius + 0.5 * self.params['width'], theta0=0, theta1=-90, unit_mode=False, ) self.add_obj(self.bend)
def draw_layout(self): """ Specifies the creation of the lumerical shapes """ circle = PhotonicRound( layer='SI', resolution=self.grid.resolution, center=(0, 0), rout=1, rin=0.1, theta0=45, theta1=190, unit_mode=False ) self.add_obj(circle) self.add_obj(circle.transform((0, 10), 'R90', copy=True)) self.add_obj(circle.transform((10, 10), 'R180', copy=True)) self.add_obj(circle.transform((20, 10), 'R270', copy=True)) self.add_obj(circle.transform((30, 10), 'MX', copy=True)) self.add_obj(circle.transform((40, 10), 'MY', copy=True)) self.add_obj(circle.transform((50, 10), 'MXR90', copy=True)) self.add_obj(circle.transform((60, 10), 'MYR90', copy=True))
def transform_content(self, res: float, loc: coord_type, orient: str, via_info: Dict, unit_mode: bool, ) -> "ContentList": """ Transforms the layout content (does not transform the sub-instances) of the current ContentList by the loc and orient passed. Parameters ---------- res : float The grid resolution. loc : Tuple[Union[float, int], Union[float, int]] The (x, y) tuple describing the translation vector for the transformation. orient : str The orientation string describing how the layout should be rotated. via_info : Dict A dictionary containing the via technology properties unit_mode : bool True if loc is provided in resolution unit coordinates. False if in layout unit coordinates. Returns ------- new_content_list : ContentList The new ContentList object with the transformed shapes. """ new_rect_list = [] new_via_list = [] # via list which can not be handled by DataPrep new_pin_list = [] new_path_list = [] new_blockage_list = [] new_boundary_list = [] new_polygon_list = [] new_round_list = [] new_sim_list = [] new_source_list = [] new_monitor_list = [] # add rectangles for rect in self.rect_list: new_rect_list.append( PhotonicRect.from_content( content=rect, resolution=res ).transform( loc=loc, orient=orient, unit_mode=unit_mode, copy=False ).content ) # add vias for via in self.via_list: # Keep new via list empty # Add its component rectangles to the polygon list. via_lay_info = via_info[via.id] nx, ny = via.arr_nx, via.arr_ny x0, y0 = via.loc if nx > 1 or ny > 1: spx, spy = via.arr_spx, via.arr_spy for xidx in range(nx): xc = x0 + xidx * spx for yidx in range(ny): yc = y0 + yidx * spy self.polygon_list.extend(self.via_to_polygon_list(via, via_lay_info, xc, yc)) else: self.polygon_list.extend(self.via_to_polygon_list(via, via_lay_info, x0, y0)) # add pins for pin in self.pin_list: new_pin_list.append( PhotonicPinInfo.from_content( content=pin, resolution=res ).transform( loc=loc, orient=orient, unit_mode=unit_mode, copy=False ) ) for path in self.path_list: new_path_list.append( PhotonicPath.from_content( content=path, resolution=res ).transform( loc=loc, orient=orient, unit_mode=unit_mode, copy=False ).content ) for blockage in self.blockage_list: new_blockage_list.append( PhotonicBlockage.from_content( content=blockage, resolution=res ).transform( loc=loc, orient=orient, unit_mode=unit_mode, copy=False ).content ) for boundary in self.boundary_list: new_boundary_list.append( PhotonicBoundary.from_content( content=boundary, resolution=res ).transform( loc=loc, orient=orient, unit_mode=unit_mode, copy=False ).content ) for polygon in self.polygon_list: new_polygon_list.append( PhotonicPolygon.from_content( content=polygon, resolution=res ).transform( loc=loc, orient=orient, unit_mode=unit_mode, copy=False ).content ) for round_obj in self.round_list: new_round_list.append( PhotonicRound.from_content( content=round_obj, resolution=res ).transform( loc=loc, orient=orient, unit_mode=unit_mode, copy=False ).content ) for sim in self.sim_list: new_sim_list.append(sim) for source in self.source_list: new_source_list.append(source) for monitor in self.monitor_list: new_monitor_list.append(monitor) return ContentList( cell_name='', inst_list=[], rect_list=new_rect_list, via_list=new_via_list, pin_list=new_pin_list, path_list=new_path_list, blockage_list=new_blockage_list, boundary_list=new_boundary_list, polygon_list=new_polygon_list, round_list=new_round_list, sim_list=new_sim_list, source_list=new_source_list, monitor_list=new_monitor_list, )