@@ -424,6 +424,7 @@ def get_intersecting_reflections(
424
424
)
425
425
return intersected_vectors , hkl , shape_factor
426
426
427
+
427
428
# TODO consider refactoring into a seperate file
428
429
def get_intersection_with_ewalds_sphere (
429
430
recip : DiffractingVector ,
@@ -459,19 +460,17 @@ def get_intersection_with_ewalds_sphere(
459
460
"""
460
461
if precession_angle == 0 :
461
462
return _get_intersection_with_ewalds_sphere_without_precession (
462
- recip .data ,
463
- optical_axis .data .squeeze (),
464
- wavelength ,
465
- max_excitation_error
463
+ recip .data , optical_axis .data .squeeze (), wavelength , max_excitation_error
466
464
)
467
465
return _get_intersection_with_ewalds_sphere_with_precession (
468
466
recip .data ,
469
467
optical_axis .data .squeeze (),
470
468
wavelength ,
471
469
max_excitation_error ,
472
- precession_angle
470
+ precession_angle ,
473
471
)
474
472
473
+
475
474
@njit (
476
475
"float64[:](float64[:, :], float64[:], float64)" ,
477
476
fastmath = True ,
@@ -501,6 +500,7 @@ def _calculate_excitation_error(
501
500
502
501
return d
503
502
503
+
504
504
@njit (
505
505
"Tuple((bool[:], float64[:]))(float64[:, :], float64[:], float64, float64)" ,
506
506
fastmath = True ,
@@ -511,11 +511,13 @@ def _get_intersection_with_ewalds_sphere_without_precession(
511
511
wavelength : float ,
512
512
max_excitation_error : float ,
513
513
) -> Tuple [np .ndarray , np .ndarray ]:
514
- excitation_error = _calculate_excitation_error (recip , optical_axis_vector , wavelength )
514
+ excitation_error = _calculate_excitation_error (
515
+ recip , optical_axis_vector , wavelength
516
+ )
515
517
intersection = np .abs (excitation_error ) < max_excitation_error
516
518
return intersection , excitation_error
517
519
518
-
520
+
519
521
@njit (
520
522
"Tuple((bool[:], float64[:]))(float64[:, :], float64[:], float64, float64, float64)" ,
521
523
fastmath = True ,
@@ -571,7 +573,7 @@ def get_d(_c):
571
573
# (using https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Vector_formulation):
572
574
573
575
# Numba does not support norm with axes, implement manually
574
- rho = np .sum ((np .dot (o , u )[:, np .newaxis ] * u - o )** 2 , axis = 1 )** 0.5
576
+ rho = np .sum ((np .dot (o , u )[:, np .newaxis ] * u - o ) ** 2 , axis = 1 ) ** 0.5
575
577
a = np .deg2rad (precession_angle )
576
578
first_half = r * np .cos (a ) - r + (r ** 2 - rho ** 2 ) ** 0.5
577
579
upper = first_half - (r ** 2 - (r * np .sin (a ) + rho ) ** 2 ) ** 0.5
@@ -580,4 +582,3 @@ def get_d(_c):
580
582
d > (lower - max_excitation_error )
581
583
)
582
584
return intersection , excitation_error
583
-
0 commit comments