schrodinger.analysis.visanalysis.volumedata module¶
-
class
schrodinger.analysis.visanalysis.volumedata.
VolumeData
(N=None, resolution=None, origin=None)¶ Bases:
object
The VolumeData class is responsible for handling the underlying storage as well as marrying together the concepts of array-coordinates and world-coordinates. The class itself is a fairly simple aggregation of the Numpy array class (to handle the basic storage and provide a huge library of functionality) and the _VDCoordinateFrame class (to marry up the concept of array-coordinates and world-coordinates).
-
__init__
(N=None, resolution=None, origin=None)¶ This function creates a new VolumeData object. The object represents a three-dimensional volume with the specified resolution, origin and dimensions.
The underlying
_VDCoordinateFrame
is exposed via the CoordinateFrame property.Parameters: - N (
iterable
) – The number of array-coordinates along the X, Y and Z axes respectively. - resolution (
iterable
) – The resolution of the X, Y and Z axes respectively. Specified in world-coordinate units - origin (
iterable
) – The origin of the X, Y and Z axes respectively. Specified in world-coordinates
- N (
-
CoordinateFrame
¶
-
IsCompatible
(vd)¶ This function can be used to test whether vd is compatible with this VolumeData. Compatible VolumeData objects have compatible coordinate-frames.
Parameters: vd ( VolumeData
) – The volume-data to be tested for compatibility with this VolumeDataReturns: True if vd is compatible with this VolumeData Return type: bool
-
ToArrayCoordinate
(world)¶ Converts the specified world-coordinate to the corresponding array-coordinate.
Parameters: world ( iterable
) – The world-coordinate to be converted X, Y, ZReturns: The array-coordinate corresponding to world. This need not be a valid array-coordinate Return type: iterable
-
ToArrayCoordinateL
(worldCoordinates)¶ Converts the specified set of world-coordinates to the corresponding array-coordinates.
Parameters: worldCoordinates ( iterable
) – The set of world-coordinates to be convertedReturns: The array-coordinates corresponding to worldCoordinates Return type: iterable
-
ToWorldCoordinate
(array)¶ Converts the specified array-coordinate to the corresponding world-coordinate.
Parameters: array ( iterable
) – The array-coordinate to be converted X, Y, ZReturns: The world-coordinate corresponding to array Return type: iterable
-
ToWorldCoordinateL
(arrayCoordinates)¶ Converts the specified set of array-coordinates to the corresponding world-coordinates.
Parameters: arrayCoordinates ( iterable
) – The set of array-coordinates to be convertedReturns: The world-coordinates corresponding to arrayCoordinates Return type: iterable
-
InBounds
(world)¶ Tests whether the world-coordinate corresponds to a position that is within the bounds of the array-coordinates.
Parameters: world ( iterable
) – The world-coordinate to be tested X, Y, ZReturns: True if the world-coordinate is in bounds. Return type: bool
-
ArrayCoordinates
()¶ This function returns an iterator which allows the array-coordinates corresponding to this VolumeData to be traversed. The order of the traversal is not specified. The de-referenced iterator provides an object of the form iterable< int, 3 >, the X, Y and Z array-coordinates.
Returns: Array-coordinate iterator. Return type: iterator
-
getAllArrayCoordinates
()¶ This function returns an object of the class iterable< iterable< int, 3 > >. This contains all of the valid array-coordinates. The ordering of entries in this object is guaranteed to be the same as that returned by self.getAllWorldCoordinates().
Returns: The array-coordinates Return type: iterable
-
WorldCoordinates
()¶ This function returns an iterator which allows the world-coordinates corresponding to this VolumeData to be traversed. The order of traversal is not specified. The de-referenced iterator provides an object of the form iterable< float, 3 >, the X, Y and Z world-coordinates.
Returns: World-coordinate iterator Return type: iterator
-
getAllWorldCoordinates
()¶ This function returns an object of the class iterable< iterable< float, 3 > >. This contains all of the world-coordinates. The ordering of entries in this object is guaranteed to be the same as that returned by self.getAllArrayCoordinates().
Returns: The world-coordinates Return type: iterable
-
Coordinates
()¶ This function returns an iterator which allows the array-coordinates and world-coordinates corresponding to this VolumeData to be traversed. The order of traversal is not specified. The de-referenced iterator returns an object of the form tuple< iterable< int, 3 >, iterable< float, 3 > >, the X, Y, Z coordinates of the array and world respectively.
Returns: Array and world-coordinate iterator Return type: iterator
-
getData
()¶ This function allows access to the underlying data. The object returned by this function may be used anywhere a Numpy array object would be used. This is the fastest method accessing values from this VolumeData object, however, the access is restricted to valid array-coordinates only.
Returns: The underlying volume-data Return type: numpy.array
-
setData
(data)¶ This function allows the underlying data to be set. The function makes a copy of data.
Parameters: data ( numpy.array
) – The data to be assigned to this VolumeData’s underlying data. The size of this three-dimensional array should be the same as this VolumeData
-
__iadd__
(rhs)¶ __iadd__, __isub__, __imul__, __idiv__: These functions perform the standard mathematic operations on this VolumeData.
Parameters: rhs ( VolumeData
ornumerical
) – If rhs is numerical the appropriate operation will be performed on every element of the data. If rhs is a VolumeData instance each element of this VolumeData will be modified with the corresponding element of rhs. This implies that the two VolumeData objects must be compatible.
-
__isub__
(rhs)¶ see __iadd__ docstring
-
__imul__
(rhs)¶ see __iadd__ docstring
-
__idiv__
(rhs)¶ see __iadd__ docstring
-
getAtArrayCoordinate
(array, interpolationOrder=0, oobMethod='constant', oobConstant=0.0)¶ This function is used to retrieve values from this VolumeData object using array-coordinates. The function is capable of retrieving values at invalid array-coordinates using a mixture of interpolation and OOB-handling.
Parameters: - array (
iterable
) – The array-coordinates to retrieve. Need not be valid array-coordinates - interpolationOrder (
int
) – The degree of interpolation to use when retrieving the values. 0-5 - oobMethod (
string
) – What to do with requests that lie outside of the bounds of this VolumeData object. The options are “constant”, which returns the value of oobConstant. “nearest” which returns the value of the nearest valid point or “wrap”, which effectively tiles the data into an infinite repeating lattice. - oobConstant (
float
) – Of the class float. The value to return if the request is OOB and the oobMethod is “constant”
Returns: The value stored at the requested array-coordinate
Return type: float
- array (
-
getAtArrayCoordinateL
(arrayCoordinates, interpolationOrder=0, oobMethod='constant', oobConstant=0.0)¶ This function can be used to retrieve a large number of values at specified array-coordinates. It is similar to the getAtArrayCoordinate function, however, in this case the array-coordinates are specified as a list rather than a single coordinate.
Parameters: - arrayCoordinates (
iterable
) – The array-coordinates whose values are to be retrieved - interpolationOrder (
int
) – The degree of interpolation to use when retrieving the values. 0-5 - oobMethod (
string
) – What to do with requests that lie outside of the bounds of this VolumeData object. The options are “constant”, which returns the value of oobConstant. “nearest” which returns the value of the nearest valid point or “wrap”, which effectively tiles the data into an infinite repeating lattice. - oobConstant (
float
) – Of the class float. The value to return if the request is OOB and the oobMethod is “constant”
Returns: The value stored at the requested array-coordinates. The values are returned in an order that is equivalent to arrayCoordinates
Return type: iterable
- arrayCoordinates (
-
getAtWorldCoordinate
(world, interpolationOrder=0, oobMethod='constant', oobConstant=0.0)¶ This function is used to retrieve values from this VolumeData object using world-coordinates. The function is capable of retrieving values at any world-coordinate using a mixture of interpolation and OOB-handling
Parameters: - world (
iterable
) – The world-coordinates to retrieve - interpolationOrder (
int
) – The degree of interpolation to use when retrieving the values. 0-5 - oobMethod (
string
) – What to do with requests that lie outside of the bounds of this VolumeData object. The options are “constant”, which returns the value of oobConstant. “nearest” which returns the value of the nearest valid point or “wrap”, which effectively tiles the data into an infinite repeating lattice. - oobConstant (
float
) – Of the class float. The value to return if the request is OOB and the oobMethod is “constant”
Returns: The value stored at the requested world-coordinate
Return type: float
- world (
-
getAtWorldCoordinateL
(worldCoordinates, interpolationOrder=0, oobMethod='constant', oobConstant=0.0)¶ This function can be used to retrieve a large number of values at specified world-coordinates. It is similar to the getAtWorldCoordinate function, however, in this case the world-coordinates are specified as a list rather than a single coordinate.
Parameters: - worldCoordinates (
iterable
) – The world-coordinates whose values are to be retrieved - interpolationOrder (
int
) – The degree of interpolation to use when retrieving the values. 0-5 - oobMethod (
string
) – What to do with requests that lie outside of the bounds of this VolumeData object. The options are “constant”, which returns the value of oobConstant. “nearest” which returns the value of the nearest valid point or “wrap”, which effectively tiles the data into an infinite repeating lattice. - oobConstant (
float
) – Of the class float. The value to return if the request is OOB and the oobMethod is “constant”
Returns: The value stored at the requested world-coordinates. The values are returned in an order that is equivalent to worldCoordinates
Return type: iterable
- worldCoordinates (
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.analysis.visanalysis.volumedata', '__doc__': '\n The VolumeData class is responsible for handling the underlying storage as\n well as marrying together the concepts of array-coordinates and\n world-coordinates. The class itself is a fairly simple aggregation of the\n Numpy array class (to handle the basic storage and provide a huge library\n of functionality) and the _VDCoordinateFrame class (to marry up the concept\n of array-coordinates and world-coordinates).\n ', '__init__': <function VolumeData.__init__>, '_get_CoordinateFrame': <function VolumeData._get_CoordinateFrame>, 'CoordinateFrame': <property object>, 'IsCompatible': <function VolumeData.IsCompatible>, 'ToArrayCoordinate': <function VolumeData.ToArrayCoordinate>, 'ToArrayCoordinateL': <function VolumeData.ToArrayCoordinateL>, 'ToWorldCoordinate': <function VolumeData.ToWorldCoordinate>, 'ToWorldCoordinateL': <function VolumeData.ToWorldCoordinateL>, 'InBounds': <function VolumeData.InBounds>, 'ArrayCoordinates': <function VolumeData.ArrayCoordinates>, 'getAllArrayCoordinates': <function VolumeData.getAllArrayCoordinates>, 'WorldCoordinates': <function VolumeData.WorldCoordinates>, 'getAllWorldCoordinates': <function VolumeData.getAllWorldCoordinates>, 'Coordinates': <function VolumeData.Coordinates>, 'getData': <function VolumeData.getData>, 'setData': <function VolumeData.setData>, '__iadd__': <function VolumeData.__iadd__>, '__isub__': <function VolumeData.__isub__>, '__imul__': <function VolumeData.__imul__>, '__idiv__': <function VolumeData.__idiv__>, 'getAtArrayCoordinate': <function VolumeData.getAtArrayCoordinate>, 'getAtArrayCoordinateL': <function VolumeData.getAtArrayCoordinateL>, 'getAtWorldCoordinate': <function VolumeData.getAtWorldCoordinate>, 'getAtWorldCoordinateL': <function VolumeData.getAtWorldCoordinateL>, '__dict__': <attribute '__dict__' of 'VolumeData' objects>, '__weakref__': <attribute '__weakref__' of 'VolumeData' objects>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.analysis.visanalysis.volumedata'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-