OneDimGrid class#
- class laygo2.object.grid.OneDimGrid(name, scope, elements=array([0]))[source]#
Bases:
CircularMapping
Class implementing one-dimensional abstract coordinates.
Public Data Attributes:
name
Coordinate system name.
range
Region in which the coordinate system is defined Coordinates in the defined region are repeatedly expanded.
phy2abs
Object that converts physical coordinates into abstract coordinates.
abs2phy
Object that converts abstract coordinates into physical coordinates.
width
The size of the region in which the coordinate system is defined.
Inherited from
CircularMapping
elements
getter of elements.
shape
The shape of circular mapping.
Public Methods:
__init__
(name, scope[, elements])Constructor function of OneDimGrid class.
__getitem__
(pos)Return the physical coordinate corresponding to the abstract coordinate pos.
__eq__
(other)Return the abstract grid coordinate that matches to other.
__lt__
(other)Return the abstract 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 abstract 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.
__str__
()Return the string representation of the object.
summarize
()Return the summary of the object information.
export_to_dict
()Return dict object containing grid information.
flip
()Flip the elements of the object.
copy
()Copy the object.
concatenate
(obj)Inherited from
CircularMapping
get_elements
()numpy.ndarray: getter of elements.
set_elements
(value)numpy.ndarray: setter of elements.
__init__
([elements, dtype])Constructor function of CircularMapping class.
__getitem__
(pos)Element access function of circular mapping.
__iter__
()Iteration function of circular mapping.
__next__
()Next element access function of circular mapping.
__str__
()Return str(self).
summarize
()Return the summary of the object information.
append
(elem)Append elements to the mapping.
flip
()Flip the elements of the object.
copy
()Copy the object.
concatenate
(obj)
- __init__(name, scope, elements=array([0]))[source]#
Constructor function of OneDimGrid class.
- Parameters:
name (str)
scope (numpy.ndarray) – scope of one-dimensional coordinate system
elements (numpy.ndarray) – members of one-dimensional coordinate system
- Return type:
laygo2.OneDimGrid
Example
>>> from laygo2.object.grid import OneDimGrid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 180], elements=[0, 35, 85, 130, 50]) >>> print(g1_x) OneDimGrid object name: xgrid, class: OneDimGrid, scope: [0, 180], elements: [0, 35, 85, 130 50]
- append(elem)#
Append elements to the mapping.
- export_to_dict()[source]#
Return dict object containing grid information.
- Parameters:
None
- Return type:
Example
>>> from laygo2.object.grid import OneDimGrid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 180], elements=[0, 35, 85, 130, 50]) >>> g1_x.export_to_dict() {'scope': [0, 180], 'elements': [0, 35, 85, 130, 50]}
- get_elements()#
numpy.ndarray: getter of elements.
- set_elements(value)#
numpy.ndarray: setter of elements.
- _elements = None#
Array consisting of the elements of circular mapping.
Example
>>> from laygo2.object.grid import CircularMapping >>> elements = [0, 35, 85, 130, 180] >>> cm = CircularMapping(elements) >>> cm.elements [0, 35, 85, 130, 180]
- Type:
- abs2phy = None#
Object that converts abstract coordinates into physical coordinates.
Example
>>> from laygo2.object.grid import OneDimGrid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 180], elements=[0, 35, 85, 130, 50]) >>> g1_x.abs2phy <_AbsToPhyGridConverter object>
- Type:
self.abs2phy (laygo2._AbsToPhyGridConverter)
- property elements#
getter of elements.
- Type:
- name = None#
Coordinate system name.
Example
>>> from laygo2.object.grid import OneDimGrid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 180], elements=[0, 35, 85, 130, 50]) >>> g1_x.name "xgrid"
- Type:
- phy2abs = None#
Object that converts physical coordinates into abstract coordinates.
Example
>>> from laygo2.object.grid import OneDimGrid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 180], elements=[0, 35, 85, 130, 50]) >>> g1_x.phy2abs <_PhyToAbsGridConverter object>
- Type:
self.phy2abs (laygo2._PhyToAbsGridConverter)
- range = None#
Region in which the coordinate system is defined Coordinates in the defined region are repeatedly expanded.
Example
>>> from laygo2.object.grid import OneDimGrid >>> g1_x = OneDimGrid(name='xgrid', scope=[0, 180], elements=[0, 35, 85, 130, 50]) >>> g1_x.range [0, 180]
- Type:
- property shape#
The shape of circular mapping.
Example
>>> from laygo2.object.grid import CircularMapping >>> elements = [0, 35, 85, 130, 180] >>> cm = CircularMapping(elements) >>> cm.shape array([5])
- Type: