topo :: base :: sheetcoords :: SheetCoordinateSystem :: Class SheetCoordinateSystem
[hide private]
[frames] | no frames]

Class SheetCoordinateSystem

source code


Provides methods to allow conversion between sheet and matrix coordinates.
Instance Methods [hide private]
 
__equalize_densities(self, nominal_bounds, nominal_density)
Calculate the true density along x, and adjust the top and bottom bounds so that the density along y will be equal.
source code
 
__get_shape(self) source code
 
__get_xdensity(self) source code
 
__get_ydensity(self) source code
 
__init__(self, bounds, xdensity, ydensity=None)
Store the bounds (as l,b,r,t in an array), xdensity, and ydensity.
source code
 
__set_xdensity(self, density) source code
 
__set_ydensity(self, density) source code
 
closest_cell_center(self, x, y)
Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.
source code
 
matrix2sheet(self, float_row, float_col)
Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.
source code
 
matrixidx2sheet(self, row, col)
Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col).
source code
 
sheet2matrix(self, x, y)
Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.
source code
 
sheet2matrixidx(self, x, y)
Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density.
source code
 
sheetcoordinates_of_matrixidx(self)
Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  shape
  xdensity
The spacing between elements in an underlying matrix representation, in the x direction.
  ydensity
The spacing between elements in an underlying matrix representation, in the y direction.

Inherited from object: __class__

Method Details [hide private]

__equalize_densities(self, nominal_bounds, nominal_density)

source code 

Calculate the true density along x, and adjust the top and bottom bounds so that the density along y will be equal.

Returns (adjusted_bounds,true_density)

__init__(self, bounds, xdensity, ydensity=None)
(Constructor)

source code 

Store the bounds (as l,b,r,t in an array), xdensity, and ydensity.

If ydensity is not specified, it is assumed that the specified xdensity is nominal and that the true xdensity should be calculated. The top and bottom bounds are adjusted so that the ydensity is equal to the xdensity.

If both xdensity and ydensity are specified, these and the bounds are taken to be exact and are not adjusted.

Overrides: object.__init__

matrix2sheet(self, float_row, float_col)

source code 

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(self, row, col)

source code 

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

sheet2matrix(self, x, y)

source code 

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it's the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(self, x, y)

source code 

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.


Property Details [hide private]

shape

Get Method:
__get_shape(self)

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.
Get Method:
__get_xdensity(self)

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.
Get Method:
__get_ydensity(self)