Skip to content

Commit

Permalink
Verify plot_over_signal works
Browse files Browse the repository at this point in the history
  • Loading branch information
viljarjf committed Jun 11, 2024
1 parent f2da734 commit 6ac9e2e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pyxem/signals/indexation_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def rotation_from_orientation_map(result, rots):
return ori


def extract_vectors_from_orientation_map(result, all_vectors, n_best_index=0):
def vectors_from_orientation_map(result, all_vectors, n_best_index=0):
index, _, rotation, mirror = result[n_best_index, :].T
index = index.astype(int)
if all_vectors.ndim == 0:
Expand All @@ -383,6 +383,9 @@ def extract_vectors_from_orientation_map(result, all_vectors, n_best_index=0):
rotation = Rotation.from_euler(
(mirror * rotation, 0, 0), degrees=True, direction="crystal2lab"
)
assert len(vectors.shape) == 1
assert vectors.size > 1
assert rotation.data.size == 4
vectors = ~rotation * vectors.to_miller()
vectors = DiffractingVector(
vectors.phase, xyz=vectors.data.copy(), intensity=intensity
Expand Down Expand Up @@ -551,7 +554,7 @@ def to_vectors(self, n_best_index: int = 0, **kwargs) -> hs.signals.Signal1D:
# Use vector data as signal in case of different vectors per navigation position
vectors_signal = hs.signals.Signal1D(self.simulation.coordinates)
v = self.map(
extract_vectors_from_orientation_map,
vectors_from_orientation_map,
all_vectors=vectors_signal,
inplace=False,
output_signal_size=(),
Expand Down Expand Up @@ -626,7 +629,7 @@ def to_ipf_markers(
cors = self.data[..., 1]
if not self.simulation.has_multiple_phases:
vecs = vecs.in_fundamental_sector(self.simulation.phases)
return self._to_single_phase_ipf_markers(
return vectors_to_single_phase_ipf_markers(
vecs,
self.simulation.phases,
cors,
Expand All @@ -642,7 +645,7 @@ def to_ipf_markers(
# As a workaround, set alpha to 0 for the wrong phase
phase_cors = cors * (phase_idxs == phase_idx)
markers += list(
self._to_single_phase_ipf_markers(
vectors_to_single_phase_ipf_markers(
phase_vecs,
phase,
phase_cors,
Expand Down Expand Up @@ -963,7 +966,6 @@ def to_phase_map(self):
colors = [p.color_rgb for p in self.simulation.phases]

float_rgb = np.take(colors, phase_idxs[..., 0], axis=0)
print(float_rgb.shape)
int_rgb = (float_rgb * 255).astype(np.uint8)

s = hs.signals.Signal1D(int_rgb)
Expand Down

0 comments on commit 6ac9e2e

Please sign in to comment.