@@ -401,6 +401,7 @@ def get_intersecting_reflections(
401
401
)
402
402
return intersected_vectors , hkl , shape_factor
403
403
404
+
404
405
# TODO consider refactoring into a seperate file
405
406
def get_intersection_with_ewalds_sphere (
406
407
recip : DiffractingVector ,
@@ -436,19 +437,17 @@ def get_intersection_with_ewalds_sphere(
436
437
"""
437
438
if precession_angle == 0 :
438
439
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
443
441
)
444
442
return _get_intersection_with_ewalds_sphere_with_precession (
445
443
recip .data ,
446
444
optical_axis .data .squeeze (),
447
445
wavelength ,
448
446
max_excitation_error ,
449
- precession_angle
447
+ precession_angle ,
450
448
)
451
449
450
+
452
451
@njit (
453
452
"float64[:](float64[:, :], float64[:], float64)" ,
454
453
fastmath = True ,
@@ -478,6 +477,7 @@ def _calculate_excitation_error(
478
477
479
478
return d
480
479
480
+
481
481
@njit (
482
482
"Tuple((bool[:], float64[:]))(float64[:, :], float64[:], float64, float64)" ,
483
483
fastmath = True ,
@@ -488,11 +488,13 @@ def _get_intersection_with_ewalds_sphere_without_precession(
488
488
wavelength : float ,
489
489
max_excitation_error : float ,
490
490
) -> 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
+ )
492
494
intersection = np .abs (excitation_error ) < max_excitation_error
493
495
return intersection , excitation_error
494
496
495
-
497
+
496
498
@njit (
497
499
"Tuple((bool[:], float64[:]))(float64[:, :], float64[:], float64, float64, float64)" ,
498
500
fastmath = True ,
@@ -548,7 +550,7 @@ def get_d(_c):
548
550
# (using https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Vector_formulation):
549
551
550
552
# 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
552
554
a = np .deg2rad (precession_angle )
553
555
first_half = r * np .cos (a ) - r + (r ** 2 - rho ** 2 ) ** 0.5
554
556
upper = first_half - (r ** 2 - (r * np .sin (a ) + rho ) ** 2 ) ** 0.5
@@ -557,4 +559,3 @@ def get_d(_c):
557
559
d > (lower - max_excitation_error )
558
560
)
559
561
return intersection , excitation_error
560
-
0 commit comments