def __init__(self, left, right=None, mins=None, maxs=None,<EOL>size=None, centered=False, dim=None, dtype='<STR_LIT:int>'):
self.dtype = dtype<EOL>dims = set([getdim(i) for i in [left, right, size]] + [dim])<EOL>dims = dims.difference(set([None]))<EOL>if len(dims) == <NUM_LIT:0>:<EOL><INDENT>dim = <NUM_LIT:3><EOL><DEDENT>elif len(dims) == <NUM_LIT:1>:<EOL><INDENT>dim = dims.pop()<EOL><DEDENT>elif len(dims) > <NUM_LIT:1>:<EOL><INDENT>raise AttributeError("<STR_LIT>")<EOL><DEDENT>nkw = {'<STR_LIT>': dim, '<STR_LIT>': self.dtype}<EOL>if right is None:<EOL><INDENT>if size is None:<EOL><INDENT>right = left<EOL>left = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>if not centered:<EOL><INDENT>right = aN(left, **nkw) + aN(size, **nkw)<EOL><DEDENT>else:<EOL><INDENT>l = aN(left, **nkw)<EOL>s = aN(size, **nkw)<EOL>if isint(self.dtype):<EOL><INDENT>left = l - s//<NUM_LIT:2><EOL>right = left + s<EOL><DEDENT>else:<EOL><INDENT>left, right = l - s/<NUM_LIT>, l + s/<NUM_LIT><EOL><DEDENT><DEDENT>assert np.all((right - left) == size)<EOL><DEDENT><DEDENT>left = aN(left, **nkw)<EOL>right = aN(right, **nkw)<EOL>if dim is not None:<EOL><INDENT>self.dim = dim<EOL>assert(left.shape[<NUM_LIT:0>] == dim)<EOL>assert(right.shape[<NUM_LIT:0>] == dim)<EOL><DEDENT>else:<EOL><INDENT>self.dim = left.shape[<NUM_LIT:0>]<EOL><DEDENT>if mins is not None:<EOL><INDENT>left = amax(left, aN(mins, **nkw))<EOL><DEDENT>if maxs is not None:<EOL><INDENT>right = amin(right, aN(maxs, **nkw))<EOL><DEDENT>self.l = np.array(left)<EOL>self.r = np.array(right)<EOL>self._build_caches()<EOL>
Creates a tile element which represents a hyperrectangle in D
dimensions. These hyperrectangles may be operated upon to find
intersections, bounding tiles, calculate interior coordinates
and other common operations.


Parameters
----------
left : number or array-like
    Left side of the tile

right : (optional) number or array-like
    If provided along with left, gives the right side of the tile

mins : (optional) number or array-like
    Can be provided to clip the sides of the Tile to certain minimum

maxs : (optional) number or array-like
    Can be provided to clip the sides of the Tile to certain maximum

size : (optional) number or array-like
    If provided along with left gives the size of the tile

centered : boolean
    * If true:   ``[left] - [size]/2 -> [left] + [size]/2``
    * If false:  ``[left] -> [left] + [size]``

dim : integer
    Number of dimensions for the Tile

dtype : string, np.dtype
    Resulting type of number for the Tile coordinates

Notes
-----

These parameters can be combined into many different combinations
(where [] indicates an array created from either a single number or any
iterable):

    * left : ``[0,0,0] -> [left]``
    * left, right : ``[left] -> [right]``
    * left, size (not centered) : ``[left] -> [left] + [size]``
    * left, size (yes centered) : ``[left] - [size]/2 -> [left] + [size]/2``

Each of these can be limited by using (mins, maxs) which are applied
after calculating left, right for each element:

    * ``left = max(left, [mins])``
    * ``right = min(right, [maxs])``

Since tiles are used for array slicing, they only allow integer values,
which can truncated without warning from float.

Notes on dimension. The dimensionality is determined first by the shape
of left, right, size if provided not as an integer. If it not provided there
then it is assumed to be 3D. This can be overridden by setting dim in the
arguments. For example:

    * Tile(3)         : ``[0,0,0] -> [3,3,3]``
    * Tile(3, dim=2)  : ``[0,0] -> [3,3]``
    * Tile([3])       : ``[0] -> [3]``

Examples
--------
>>> Tile(10)
Tile [0, 0, 0] -> [10, 10, 10] ([10, 10, 10])

>>> Tile([1,2])
Tile [0, 0] -> [1, 2] ([1, 2])

>>> Tile(0, size=4, centered=True)
Tile [-2, -2, -2] -> [2, 2, 2] ([4, 4, 4])

>>> Tile([-1, 0, 1], right=10, mins=0)
Tile [0, 0, 1] -> [10, 10, 10] ([10, 10, 9])

>>> Tile(10, dtype='float')
Tile [0.0, 0.0, 0.0] -> [10.0, 10.0, 10.0] ([10.0, 10.0, 10.0])