clmm.utils.validation module
General utility functions that are used in multiple modules
- clmm.utils.validation.arguments_consistency(arguments, names=None, prefix='')[source]
Make sure all arguments have the same length (or are scalars)
- Parameters:
arguments (list, arrays, tuple) -- Group of arguments to be checked
names (list, tuple, None, optional) -- Names for each array. Default: None
prefix (str, optional) -- Customized prefix for error message. Default: ''
- Returns:
Group of arguments, converted to numpy arrays if they have length
- Return type:
list, arrays, tuple
- clmm.utils.validation.validate_argument(loc, argname, valid_type, none_ok=False, argmin=None, argmax=None, eqmin=False, eqmax=False, shape=None)[source]
Validate argument type and raise errors.
- Parameters:
loc (dict) -- Dictionary with all input arguments. Should be locals().
argname (str) -- Name of argument to be tested.
valid_type (str, type) --
Valid types for argument, options are object types, list/tuple of types, or:
'int_array' - interger, interger array
'float_array' - float, float array
none_ok (bool, optional) -- If True, accepts None as a valid type. Default: False
argmin (int, float, None, optional) -- Minimum value allowed. Default: None
argmax (int, float, None, optional) -- Maximum value allowed. Default: None
eqmin (bool, optional) -- If True, accepts min(arg)==argmin. Default: False
eqmax (bool, optional) -- If True, accepts max(arg)==argmax. Default: False
shape (tuple of ints, None, optional) -- Shape of object allowed. Default: None