Skip to content

Commit

Permalink
Rebase: Follow up for Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
CSSFrancis committed May 29, 2024
1 parent 5ee1755 commit 8c680f4
Showing 1 changed file with 7 additions and 31 deletions.
38 changes: 7 additions & 31 deletions pyxem/signals/indexation_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,20 @@ def extract_vectors_from_orientation_map(result, all_vectors):
vectors = DiffractingVector(vectors.phase, xyz=vectors.data.copy())
# Flip y, as discussed in https://github.com/pyxem/pyxem/issues/925
vectors.y = -vectors.y
# Mirror if necessary
vectors.y = mirror * vectors.y

rotation = Rotation.from_euler(
(rotation, 0, 0), degrees=True, direction="crystal2lab"
(mirror * rotation, 0, 0), degrees=True, direction="crystal2lab"
)
vectors = ~rotation * vectors.to_miller()
vectors = DiffractingVector(
vectors.phase, xyz=vectors.data.copy(), intensity=intensity
)

# Mirror if necessary.
# Mirroring, in this case, means casting (r, theta) to (r, -theta).
# This is equivalent to (x, y) -> (x, -y)
vectors.y = mirror * vectors.y

return vectors


Expand Down Expand Up @@ -362,34 +366,6 @@ def to_single_phase_vectors(
# Use vector data as signal in case of different vectors per navigation position
vectors_signal = hs.signals.Signal1D(self.simulation.coordinates)

def extract_vectors_from_orientation_map(result, all_vectors):
index, _, rotation, mirror = result[n_best_index, :].T
index = index.astype(int)
if all_vectors.ndim == 0:
vectors = all_vectors
else:
vectors = all_vectors[index]
# Copy manually, as deepcopy adds a lot of overhead with the phase
intensity = vectors.intensity
vectors = DiffractingVector(vectors.phase, xyz=vectors.data.copy())
# Flip y, as discussed in https://github.com/pyxem/pyxem/issues/925
vectors.y = -vectors.y

rotation = Rotation.from_euler(
(mirror * rotation, 0, 0), degrees=True, direction="crystal2lab"
)
vectors = ~rotation * vectors.to_miller()
vectors = DiffractingVector(
vectors.phase, xyz=vectors.data.copy(), intensity=intensity
)

# Mirror if necessary.
# Mirroring, in this case, means casting (r, theta) to (r, -theta).
# This is equivalent to (x, y) -> (x, -y)
vectors.y = mirror * vectors.y

return vectors

return self.map(
extract_vectors_from_orientation_map,
all_vectors=vectors_signal,
Expand Down

0 comments on commit 8c680f4

Please sign in to comment.