Skip to content

Commit 8d2c0f3

Browse files
committed
Formatting
1 parent 7e307fb commit 8d2c0f3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

diffsims/crystallography/_diffracting_vector.py

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import numpy as np
2121
from diffpy.structure import Structure
2222
from orix.crystal_map import Phase
23-
from orix.vector.miller import _transform_space
2423
from orix.quaternion import Rotation
2524

2625

diffsims/generators/simulation_generator.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ def get_intersecting_reflections(
424424
)
425425
return intersected_vectors, hkl, shape_factor
426426

427+
427428
# TODO consider refactoring into a seperate file
428429
def get_intersection_with_ewalds_sphere(
429430
recip: DiffractingVector,
@@ -459,19 +460,17 @@ def get_intersection_with_ewalds_sphere(
459460
"""
460461
if precession_angle == 0:
461462
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
466464
)
467465
return _get_intersection_with_ewalds_sphere_with_precession(
468466
recip.data,
469467
optical_axis.data.squeeze(),
470468
wavelength,
471469
max_excitation_error,
472-
precession_angle
470+
precession_angle,
473471
)
474472

473+
475474
@njit(
476475
"float64[:](float64[:, :], float64[:], float64)",
477476
fastmath=True,
@@ -501,6 +500,7 @@ def _calculate_excitation_error(
501500

502501
return d
503502

503+
504504
@njit(
505505
"Tuple((bool[:], float64[:]))(float64[:, :], float64[:], float64, float64)",
506506
fastmath=True,
@@ -511,11 +511,13 @@ def _get_intersection_with_ewalds_sphere_without_precession(
511511
wavelength: float,
512512
max_excitation_error: float,
513513
) -> 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+
)
515517
intersection = np.abs(excitation_error) < max_excitation_error
516518
return intersection, excitation_error
517519

518-
520+
519521
@njit(
520522
"Tuple((bool[:], float64[:]))(float64[:, :], float64[:], float64, float64, float64)",
521523
fastmath=True,
@@ -571,7 +573,7 @@ def get_d(_c):
571573
# (using https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Vector_formulation):
572574

573575
# 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
575577
a = np.deg2rad(precession_angle)
576578
first_half = r * np.cos(a) - r + (r**2 - rho**2) ** 0.5
577579
upper = first_half - (r**2 - (r * np.sin(a) + rho) ** 2) ** 0.5
@@ -580,4 +582,3 @@ def get_d(_c):
580582
d > (lower - max_excitation_error)
581583
)
582584
return intersection, excitation_error
583-

0 commit comments

Comments
 (0)