Grid class#
- class laygo2.object.grid.Grid(name, vgrid, hgrid)[source]#
Bases:
object
A base class having conversion operators and the mapping information (element) between two-dimensional physical coordinates and abstract coordinates.
Examplar grid conversions between abstract and physical coordinates are summarized in the following figure.
Notes
(Korean) 2차원 물리좌표와 추상좌표간 mapping 정보(element) 를 갖고 있으며 해당 element를 활용하는 좌표 연산자를 가지고 있는 기본 클래스.
Public Data Attributes:
the name of the grid.
return elements of subgrids ([_xy[0].elements, _xy[1].elements]).
PhyToAbsGridConverter(master=self)
AbsToPhyGridConverter(master=self)
Two-dimensional _AbsToPhyConverter of a coordinate system.
One-dimensional _AbsToPhyGridConverter
One-dimensional _AbsToPhyGridConverter of the y-coordinate system.
OneDimGrid of the x-coordinate system (=self.x).
OneDimGrid of the y-coordinate system (=self.y).
Two-dimensional _PhyToAbsConverter of a coordinate system.
One-dimensional _PhyToAbsConverter of the x-coordinate system.
One-dimensional _PhyToAbsConverter of
Two-dimensional element length in a coordinate system.
Region in which the coordinate system is defined.
Width of the region in which the coordinate system is defined.
Height of the region in which the coordinate system is defined.
Return the height vector [0, h].
Return width as a list.
Public Methods:
set_range
(value)__init__
(name, vgrid, hgrid)Constructor function of Grid class.
__getitem__
(pos)__eq__
(other)Return the physical grid coordinate that matches to other.
__lt__
(other)Return the index of the grid coordinate that is the largest but less than other.
__le__
(other)Return the index of the grid coordinate that is the largest but less than or equal to other.
__gt__
(other)Return the index of the grid coordinate that is the smallest but greater than other.
__ge__
(other)Return the index of the grid coordinate that is the smallest but greater than or equal to other.
bbox
(obj)Return the abstract grid coordinates corresponding to the 'internal' bounding box of obj.
bottom_left
(obj)Return the abstract grid coordinates corresponding to the bottom-left corner of obj.
bottom_right
(obj)Return the abstract grid coordinates corresponding to the bottom-right corner of obj.
top_left
(obj)Return the abstract grid coordinates corresponding to the top-left corner of obj.
top_right
(obj)Return the abstract grid coordinates corresponding to the top-right corner of obj.
crossing
(*args)Return the abstract grid coordinates corresponding to the crossing point of args.
overlap
(*args[, type])Return the abstract grid coordinates corresponding to the overlap of args.
union
(*args)Return the abstract grid coordinates corresponding to union of args.
center
(obj)Return the abstract grid coordinates corresponding to the center point of obj.
left
(obj)Return the abstract grid coordinates corresponding to the left point of obj.
right
(obj)Return the abstract grid coordinates corresponding to the right point of obj.
top
(obj)Return the abstract grid coordinates corresponding to the top point of obj.
bottom
(obj)Return the abstract grid coordinates corresponding to the bottom point of obj.
copy
()Make a copy of the current Grid object
vflip
([copy])Flip the grid in vertical direction.
hflip
([copy])Flip the grid in horizontal direction.
vstack
(obj[, copy])Stack grid(s) on top of the current grid in vertical direction.
hstack
(obj[, copy])Stack grid(s) on top of the current grid in horizontal direction.
__iter__
()__next__
()__str__
()Return the string representation of the object.
Output the information of the respective grid.
- __init__(name, vgrid, hgrid)[source]#
Constructor function of Grid class.
- Parameters
name (str) –
vgrid (laygo2.object.grid.OndDimGrid) – OneDimGrid object of the x-coordinate system
hgrid (laygo2.object.grid.OndDimGrid) – OneDimGrid object of the y-coordinate system
- Return type
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> print(g2) <laygo2.object.grid.Grid object> name: test, class: Grid, scope: [[0, 0], [100, 100]], elements: [array([ 0, 10, 20, 40, 50]), array([10, 20, 40, 50, 60])
Notes
(Korean) Grid 클래스의 생성자함수. 파라미터
name(str): 이름
vgrid(laygo2.OneDimGrid): x좌표계 OneDimGrid 객체
hgrid(laygo2.OneDimGrid): y좌표계 OneDimGrid 객체
- 반환값
laygo2.Grid
- bbox(obj)[source]#
Return the abstract grid coordinates corresponding to the ‘internal’ bounding box of obj.
See also
_PhyToAbsGridConverter.bbox
- bottom_left(obj)[source]#
Return the abstract grid coordinates corresponding to the bottom-left corner of obj.
See also
_PhyToAbsGridConverter.bottom_left
- bottom_right(obj)[source]#
Return the abstract grid coordinates corresponding to the bottom-right corner of obj.
See also
_PhyToAbsGridConverter.bottom_right
- center(obj)[source]#
Return the abstract grid coordinates corresponding to the center point of obj.
- Parameters
obj (laygo2.object.physical.PhysicalObject) – The object of which center coordinate is computed.
See also
laygo2.object.grid._PhyToAbsGridConverter.center
- copy()[source]#
Make a copy of the current Grid object
- Returns
laygo2.object.grid.Grid
- Return type
the copied Grid object.
See also
- crossing(*args)[source]#
Return the abstract grid coordinates corresponding to the crossing point of args.
See also
laygo2.object.grid._PhyToAbsGridConverter.crossing
- hflip(copy=True)[source]#
Flip the grid in horizontal direction.
- Parameters
copy (optional, boolean) – If True, make a copy and flip the copied grid (default). If False, flip the current grid object.
- Returns
laygo2.object.grid.Grid
- Return type
the flipped Grid object.
See also
- overlap(*args, type='bbox')[source]#
Return the abstract grid coordinates corresponding to the overlap of args.
See also
laygo2.object.grid._PhyToAbsGridConverter.overlap
- summarize()[source]#
Output the information of the respective grid.
- Parameters
None –
- Return type
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.summarize() <laygo2.object.grid.Grid object> name: test, class: Grid, scope: [[0, 0], [100, 100]], elements: [array([ 0, 10, 20, 40, 50]), array([10, 20, 40, 50, 60])
Notes
(Korean) 해당 Grid의 정보 출력.
- top_left(obj)[source]#
Return the abstract grid coordinates corresponding to the top-left corner of obj.
See also
_PhyToAbsGridConverter.top_left
- top_right(obj)[source]#
Return the abstract grid coordinates corresponding to the top-right corner of obj.
See also
_PhyToAbsGridConverter.top_right
- union(*args)[source]#
Return the abstract grid coordinates corresponding to union of args.
See also
laygo2.object.grid._PhyToAbsGridConverter.union
- vflip(copy=True)[source]#
Flip the grid in vertical direction.
- Parameters
copy (optional, boolean) – If True, make a copy and flip the copied grid (default). If False, flip the current grid object.
- Returns
laygo2.object.grid.Grid
- Return type
the flipped Grid object.
See also
- _xy = None#
the list contains the 1d-grid objects for x and y axes.
- Type
List[OneDimGrid]
- abs2phy = None#
AbsToPhyGridConverter(master=self)
- property h#
OneDimGrid of the y-coordinate system (=self.y).
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.h g1_y
Notes
(Korean) y좌표계 OneDimGrid.
- Type
- property height#
Height of the region in which the coordinate system is defined.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.height 100
Notes
(Korean) 좌표계가 정의된 영역의 높이.
- Type
numpy.int32
- property height_vec#
Return the height vector [0, h].
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.height_vec [0, 100]
Notes
(Korean) height를 list로 반환.
- Type
- property hgrid#
- property m#
One-dimensional _PhyToAbsConverter of the x-coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.n[40] 2 >>> g2.n(40) 2 >>> g2.n < 40 760 >>> g2.n <= 40 810 >>> g2.n > 40 820 >>> g2.n >= 40 810
Notes
(Korean) x좌표계 1차원 _PhyToAbsConverter.
- Type
_PhyToAbsGridConverter
- property mn#
Two-dimensional _PhyToAbsConverter of a coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.mn[40,40] [3, 2] >>> g2.mn([40, 40]) [3, 2] >>> g2.mn < [40,40] [750, 760] >>> g2.mn <= [40,40] [800, 810] >>> g2.mn > [40,40] [810, 820] >>> g2.mn >= [40,40] [800, 810]
Notes
(Korean) 좌표계 2차원 _PhyToAbsConverter.
- Type
laygo2._PhyToAbsGridConverter
- property n#
- One-dimensional _PhyToAbsConverter of
the y-coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.n[40] 2 >>> g2.n(40) 2 >>> g2.n < 40 760 >>> g2.n <= 40 810 >>> g2.n > 40 820 >>> g2.n >= 40 810
Notes
(Korean) y좌표계 1차원 _PhyToAbsConverter.
- Type
_PhyToAbsGridConverter
- phy2abs = None#
PhyToAbsGridConverter(master=self)
- property range#
- Region in which the coordinate system is defined.
bbox of the respective Grid
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.range [ [0, 0], [100, 100 ]]
Notes
(Korean) 좌표계가 정의된 영역.
- Type
- property shape#
- Two-dimensional element length in a coordinate system.
length of x-axis elements, length of y-axis elements
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.shape [5, 5]
Notes
(Korean) 좌표게 2차원 element의 길이.
- Type
- property v#
OneDimGrid of the x-coordinate system (=self.x).
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.v g1_x
Notes
(Korean) x좌표계 OneDimGrid.
- Type
- property vgrid#
- property width#
- Width of the region in which the coordinate system is defined.
x scope
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.width 100
Notes
(Korean) 좌표계가 정의된 영역의 폭.
- Type
numpy.int32
- property width_vec#
- Return width as a list.
length of the respective axis and zero
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.width_vec [100, 0]
Notes
(Korean) width를 list로 반환.
- Type
- property x#
- One-dimensional _AbsToPhyGridConverter
of the x-coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.x[10] 200 >>> g2.x < 10 [0] >>> g2.x <= 10 [1] >>> g2.x > 10 [2] >>> g2.x >= 10 [1]
Notes
(Korean) x좌표계 1차원 _AbsToPhyGridConverter.
- Type
_AbsToPhyGridConverter
- property xy#
Two-dimensional _AbsToPhyConverter of a coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.xy[10,10] [200 210] >>> g2.xy([10, 10]) [200 210] >>> g2.xy < [10,10] [0,-1] >>> g2.xy <= [10,10] [1,0] >>> g2.xy > [10,10] [2,1] >>> g2.xy >= [10,10] [1,0]
Notes
(Korean) 2차원 _AbsToPhyConverter.
- Type
_AbsToPhyGridConverter
- property y#
One-dimensional _AbsToPhyGridConverter of the y-coordinate system.
Example
>>> from laygo2.object.grid import OneDimGrid, Grid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 100], elements=[0, 10, 20, 40, 50 ]) >>> g1_y = OneDimGrid(name='ygrid', scope=[0, 100], elements=[10, 20, 40, 50, 60 ]) >>> g2 = Grid(name="test", vgrid = g1_x, hgrid = g1_y ) >>> g2.y[10] 210 >>> g2.y < 10 [-1] >>> g2.y <= 10 [0] >>> g2.y > 10 [1] >>> g2.y >= 10 [0]
Notes
(Korean) y좌표계 1차원 _AbsToPhyGridConverter.
- Type
_AbsToPhyGridConverter