diff --git a/hexrd/nf_config/experiment.py b/hexrd/nf_config/experiment.py index 0d9c1b0da..fc5a55a03 100644 --- a/hexrd/nf_config/experiment.py +++ b/hexrd/nf_config/experiment.py @@ -57,7 +57,11 @@ def chi2_thresh(self): @property def misorientation(self): key = self._cfg.get('experiment:misorientation:use_misorientation') - if key is True: + if key not in [True, False, None]: + raise ValueError( + 'use_misorientation must be of type bool' + ) + if key: return { 'misorientation_bnd': 'experiment:bnd', 'misorientation_spacing': 'experiment:spacing', diff --git a/hexrd/sampleOrientations/conversions.py b/hexrd/sampleOrientations/conversions.py index 01f51c1df..59815e401 100644 --- a/hexrd/sampleOrientations/conversions.py +++ b/hexrd/sampleOrientations/conversions.py @@ -11,12 +11,12 @@ sc = constants.sc @numba_njit_if_available(cache=True, nogil=True) -def getPyramid(xyz): +def getPyramid(xyz : np.ndarray): try: x, y, z = xyz - except Exception as exc: + except (TypeError, ValueError) as exc: raise ValueError("xyz must be a 3-element array") from exc - + if (np.abs(x) <= z) and (np.abs(y) <= z): return 1