Skip to content

Commit

Permalink
misorientation specify typing
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindlewis23 committed Jul 1, 2024
1 parent 0d1a11f commit 30e9876
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion hexrd/nf_config/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions hexrd/sampleOrientations/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 30e9876

Please sign in to comment.