Type Checkers
This module defines functions for type, value, and/or attribute checking.
- prody.utilities.checkers.checkAnisous(anisous, csets=False, natoms=None, dtype=(<class 'float'>, <class 'numpy.float32'>), name='anisous')[source]
Returns True if shape, dimensionality, and data type of anisous array are as expected.
- Parameters:
anisous – anisous array
csets – whether multiple coordinate sets (i.e.
.ndim in (2, 3)) are allowed, default is Falsenatoms – number of atoms, if None number of atoms is not checked
dtype – allowed data type(s), default is
(float, numpy.float32), if None data type is not checkedname – name of the coordinate argument
- Raises:
TypeErrorwhen anisous is not an instance ofnumpy.ndarray- Raises:
ValueErrorwhen wrong shape, dimensionality, or data type is encountered
- prody.utilities.checkers.checkCoords(coords, csets=False, natoms=None, dtype=(<class 'float'>, <class 'numpy.float32'>), name='coords')[source]
Returns True if shape, dimensionality, and data type of coords array are as expected.
- Parameters:
coords – coordinate array
csets – whether multiple coordinate sets (i.e.
.ndim in (2, 3)) are allowed, default is Falsenatoms – number of atoms, if None number of atoms is not checked
dtype – allowed data type(s), default is
(float, numpy.float32), if None data type is not checkedname – name of the coordinate argument
- Raises:
TypeErrorwhen coords is not an instance ofnumpy.ndarray- Raises:
ValueErrorwhen wrong shape, dimensionality, or data type is encountered
- prody.utilities.checkers.checkTypes(args, **types)[source]
Returns True if types of all args match those given in types.
- Raises:
TypeErrorwhen type of an argument is not one of allowed types
def incr(n, i): '''Return sum of *n* and *i*.''' checkTypes(locals(), n=(float, int), i=(float, int)) return n + i