@@ -401,6 +401,7 @@ def get_intersecting_reflections(
401401 )
402402 return intersected_vectors , hkl , shape_factor
403403
404+
404405# TODO consider refactoring into a seperate file
405406def get_intersection_with_ewalds_sphere (
406407 recip : DiffractingVector ,
@@ -436,19 +437,17 @@ def get_intersection_with_ewalds_sphere(
436437 """
437438 if precession_angle == 0 :
438439 return _get_intersection_with_ewalds_sphere_without_precession (
439- recip .data ,
440- optical_axis .data .squeeze (),
441- wavelength ,
442- max_excitation_error
440+ recip .data , optical_axis .data .squeeze (), wavelength , max_excitation_error
443441 )
444442 return _get_intersection_with_ewalds_sphere_with_precession (
445443 recip .data ,
446444 optical_axis .data .squeeze (),
447445 wavelength ,
448446 max_excitation_error ,
449- precession_angle
447+ precession_angle ,
450448 )
451449
450+
452451@njit (
453452 "float64[:](float64[:, :], float64[:], float64)" ,
454453 fastmath = True ,
@@ -478,6 +477,7 @@ def _calculate_excitation_error(
478477
479478 return d
480479
480+
481481@njit (
482482 "Tuple((bool[:], float64[:]))(float64[:, :], float64[:], float64, float64)" ,
483483 fastmath = True ,
@@ -488,11 +488,13 @@ def _get_intersection_with_ewalds_sphere_without_precession(
488488 wavelength : float ,
489489 max_excitation_error : float ,
490490) -> Tuple [np .ndarray , np .ndarray ]:
491- excitation_error = _calculate_excitation_error (recip , optical_axis_vector , wavelength )
491+ excitation_error = _calculate_excitation_error (
492+ recip , optical_axis_vector , wavelength
493+ )
492494 intersection = np .abs (excitation_error ) < max_excitation_error
493495 return intersection , excitation_error
494496
495-
497+
496498@njit (
497499 "Tuple((bool[:], float64[:]))(float64[:, :], float64[:], float64, float64, float64)" ,
498500 fastmath = True ,
@@ -548,7 +550,7 @@ def get_d(_c):
548550 # (using https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Vector_formulation):
549551
550552 # Numba does not support norm with axes, implement manually
551- rho = np .sum ((np .dot (o , u )[:, np .newaxis ] * u - o )** 2 , axis = 1 )** 0.5
553+ rho = np .sum ((np .dot (o , u )[:, np .newaxis ] * u - o ) ** 2 , axis = 1 ) ** 0.5
552554 a = np .deg2rad (precession_angle )
553555 first_half = r * np .cos (a ) - r + (r ** 2 - rho ** 2 ) ** 0.5
554556 upper = first_half - (r ** 2 - (r * np .sin (a ) + rho ) ** 2 ) ** 0.5
@@ -557,4 +559,3 @@ def get_d(_c):
557559 d > (lower - max_excitation_error )
558560 )
559561 return intersection , excitation_error
560-
0 commit comments