Rect class#

class laygo2.object.physical.Rect(xy, layer, color=None, hextension=0, vextension=0, name=None, netname=None, params=None)[source]#

Bases: PhysicalObject

Rectangle object class.

Example

>>> from laygo2.object.physical import Rect
>>> rect0 = Rect(xy=[[0, 0], [100, 100]], layer=['M1', 'drawing'])
>>> print(rect0)
<laygo2.object.physical.Rect object at 0x000002049A77F3A0>
name: None,
class: Rect,
xy: [[0, 0], [100, 100]],
params: None, , layer: ['M1', 'drawing']

Public Data Attributes:

layer

The physical layer information of the object, represented as a list with two elements: [name, purpose].

netname

The net name associated with the object.

hextension

The horizontal extension of the rectangle object above its bounding box.

vextension

The vertical extension of the rectangle object above its bounding box.

color

The color (multi-patterning identifier) parameter of the object.

height

The height of the object.

width

The width of the object.

height_vec

The height direction vector [0, self.height] of the object.

width_vec

The width direction vector [self.width, 0] of the object.

size

The size of the object ([self.width, self.height]).

Inherited from PhysicalObject

name

Object name.

xy

Physical coordinate values of the object in the form of [bottom_left, top_right].

master

Master ojbect for current object (for arrays and pins).

params

Dictionary storing the parameters associated with the object

pointers

The dictionary containing the key-value pairs of the major physical coordinates of the object, such as 'left', 'right', 'top', 'bottom', 'bottom_left', 'center', etc.

left

The left-center coordinate of the object.

right

The right-center coordinate of the object.

top

The top-center coordinate of the object.

bottom

The bottom-center coordinate of the object.

center

The center-center coordinate of the object.

bottom_left

The bottom-left coordinate of the object.

bottom_right

The bottom-right coordinate of the object.

top_left

The top-left coordinate of the object.

top_right

The top-right coordinate of the object.

bbox

The physical bounding box of the object.

Public Methods:

__init__(xy, layer[, color, hextension, ...])

The constructor function.

align(rect2)

Match the length of the self and rect2 objects, if either object has a width or height of 0.

summarize()

Get object information summary.

Inherited from PhysicalObject

__init__(xy[, name, params])

The constructor function.

__str__()

Return the summary of the object information.

summarize()

Return the summary of the object information.


__init__(xy, layer, color=None, hextension=0, vextension=0, name=None, netname=None, params=None)[source]#

The constructor function.

Parameters:
  • xy (numpy.ndarray) – Physical coordinate values of the object in the form of [bottom_left, top_right].

  • layer (list) – The physical layer information of the object, represented as a list with two elements: [name, purpose].

  • hextension (int) – The horizontal extension value of the object.

  • vextension (int) – The vertical extension value of the object.

  • name (str) – Object name.

  • netname (str) – The net name associated with the object.

  • params (dict) – Dictionary storing the parameters associated with the object.

  • color (str, optional.) – The color (multi-patterning identifier) parameter of the object.

Return type:

Rect

See also

PhysicalObject

Example

>>> import laygo2
>>> rect0 = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]],
        layer=['M1', 'drawing'], netname='net0', color=1)
>>> print(rect0)
<laygo2.object.physical.Rect object at 0x000002049A77F3A0>
name: None,
class: Rect,
xy: [[0, 0], [100, 100]],
params: None, , layer: ['M1', 'drawing'], netname: net0
_images/object_physical_rect_init.png
_get_xy()#

numpy.ndarray(dtype=numpy.int): Retrive x,y coordinate values of the object.

_set_xy(value)#

numpy.ndarray(dtype=numpy.int): Update x,y coordinates of the object.

_update_pointers()#

The internal function that updates the object’s pointers after a change in its physical coordinates.

align(rect2)[source]#

Match the length of the self and rect2 objects, if either object has a width or height of 0.

Parameters:

rect2 (Rect) – The rect object to be aligned with self.

summarize()[source]#

Get object information summary.

_xy = array([0, 0])#

The x and y coordinate values stored within.

Type:

numpy.ndarray(dtype=numpy.int)

property bbox#

The physical bounding box of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.bbox
array([[  0,   0],
       [200, 200]])
_images/object_physical_PhysicalObject_bbox.png
Type:

numpy.ndarray

bottom = None#

The bottom-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.top
array([100,   0])
_images/object_physical_PhysicalObject_bottom.png
Type:

numpy.ndarray

bottom_left = None#

The bottom-left coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.bottom_left
array([  0,   0])
_images/object_physical_PhysicalObject_bottom_left.png
Type:

numpy.ndarray

bottom_right = None#

The bottom-right coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.bottom_right
array([200,   0])
_images/object_physical_PhysicalObject_bottom_right.png
Type:

numpy.ndarray

center = None#

The center-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.center
array([100, 100])
_images/object_physical_PhysicalObject_center.png
Type:

numpy.ndarray

color = None#

The color (multi-patterning identifier) parameter of the object.

Example

>>> import laygo2
>>> rect0 = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]],
        layer=['M1', 'drawing'], netname='net0', color=1)
>>> rect0.color
1
Type:

int or None or “not_MPT”

property height#

The height of the object.

Example

>>> import laygo2
>>> rect0 = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]],
        layer=['M1', 'drawing'])
>>> rect0.height
100
_images/object_physical_rect_height.png
Type:

int

property height_vec#

The height direction vector [0, self.height] of the object.

Type:

numpy.ndarray(dtype=int)

hextension = 0#

The horizontal extension of the rectangle object above its bounding box.

Example

>>> import laygo2
>>> rect0 = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]],
        layer=['M1', 'drawing'], netname='net0', hextension=20, vextension=20)
>>> rect0.hextension
20
_images/object_physical_rect_hextension.png
Type:

int

layer = None#

The physical layer information of the object, represented as a list with two elements: [name, purpose].

Example

>>> import laygo2
>>> rect0 = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]],
        layer=['M1', 'drawing'], netname='net0', hextension=20, vextension=20)
>>> rect0.layer
['M1', 'drawing']
Type:

numpy.ndarray

left = None#

The left-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.left
array([  0, 100])
_images/object_physical_PhysicalObject_left.png
Type:

numpy.ndarray

master = None#

Master ojbect for current object (for arrays and pins).

Example

>>> import laygo2
>>> obj1 = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]],
        name="test1", params=None)
>>> obj2 = laygo2.object.physical.Pin(xy = [[0, 0], [100, 100]],
        layer = ["M1", "drawing"], master=obj1)
>>> obj2.master
<laygo2.object.physical.PhysicalObject object at 0x00000204AAF3C7C0>
Type:

numpy.ndarray

name = None#

Object name.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]],
        name="test", params={'maxI': 0.005})
>>> obj.name
“test”
_images/object_physical_PhysicalObject_name.png
Type:

str

netname = None#

The net name associated with the object.

Example

>>> import laygo2
>>> rect0 = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]],
        layer=['M1', 'drawing'], netname='net0', hextension=20, vextension=20)
>>> rect0.netname
“net0”
Type:

str

params = None#

Dictionary storing the parameters associated with the object

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]],
        name="test", params={'maxI': 0.005})
>>> obj.params
{‘maxI’: 0.005 }
Type:

dict

pointers = None#

The dictionary containing the key-value pairs of the major physical coordinates of the object, such as ‘left’, ‘right’, ‘top’, ‘bottom’, ‘bottom_left’, ‘center’, etc.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.pointers
{'left': array([0, 100]), 'right': array([200, 100]),
 'bottom': array([100, 0]), 'top': array([100, 200]),
 'bottom_left': array([0, 0]), 'bottom_right': array([200, 0]),
 'top_left': array([0, 200]), 'top_right': array([200, 200]),
 ‘center’: array( [100, 100] )
}
_images/object_physical_PhysicalObject_pointers.png
Type:

dict

right = None#

The right-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.right
array([200, 100])
_images/object_physical_PhysicalObject_right.png
Type:

numpy.ndarray

property size#

The size of the object ([self.width, self.height]).

Example

>>> import laygo2
>>> rect0 = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]],
        layer=['M1', 'drawing'])
>>> rect0.size
array([100, 100])
_images/object_physical_rect_size.png
Type:

numpy.ndarray

top = None#

The top-center coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.top
array([100, 200])
_images/object_physical_PhysicalObject_top.png
Type:

numpy.ndarray

top_left = None#

The top-left coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.top_left
array([  0, 200])
_images/object_physical_PhysicalObject_top_left.png
Type:

numpy.ndarray

top_right = None#

The top-right coordinate of the object.

Example

>>> import laygo2
>>> obj = laygo2.object.physical.PhysicalObject(xy = [[0, 0], [200, 200]])
>>> obj.top_right
array([200, 200])
_images/object_physical_PhysicalObject_top_right.png
Type:

numpy.ndarray

vextension = 0#

The vertical extension of the rectangle object above its bounding box.

Example

>>> import laygo2
>>> rect0 = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]],
        layer=['M1', 'drawing'], netname='net0', hextension=20, vextension=20)
>>> rect0.vextension
20
_images/object_physical_rect_vextension.png
Type:

int

property width#

The width of the object.

Example

>>> import laygo2
>>> rect0 = laygo2.object.physical.Rect(xy=[[0, 0], [100, 100]],
        layer=['M1', 'drawing'])
>>> rect0.width
100
_images/object_physical_rect_width.png
Type:

int

property width_vec#

The width direction vector [self.width, 0] of the object.

Type:

numpy.ndarray(dtype=int)

property xy#

Retrive x,y coordinate values of the object.

Type:

numpy.ndarray(dtype=numpy.int)