quality_assurance
- assert_array_well_defined(array: Union[ndarray, Tensor], assume_non_negativity: bool = False, assume_positivity=False, array_name: Optional[str] = None)[source]
This method tests if all entries of the given array or tensor are well-defined (i.e. not np.inf, np.nan, or None). The method can be parametrised to be more strict.
- Parameters:
array – The input np.ndarray or torch.Tensor
assume_non_negativity – bool (default: False). If true, all values must be greater than or equal to 0.
assume_positivity – bool (default: False). If true, all values must be greater than 0.
array_name – a string that gives more information in case of an error.
- Raises:
AssertionError – if there are any unexpected values in the given array.
- assert_equal_shapes(numpy_arrays: list)[source]
This method takes a list of n-dimensional numpy arrays and raises an AssertionError if the sizes of all arrays do not match.
- Parameters:
numpy_arrays – a list of np.ndarray
- Raises:
AssertionError – if there is a mismatch between any of the volume dimensions.