Skip to content

Commit

Permalink
Account for non-square signals
Browse files Browse the repository at this point in the history
  • Loading branch information
viljarjf committed Apr 11, 2024
1 parent 70474ae commit f0afa3e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pyxem/utils/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

"""Utils for calibrating Diffraction Patterns."""


import numpy as np
import json

Expand Down Expand Up @@ -296,10 +295,18 @@ def pixel_extent(self):
left_scales = self.scale
right_scales = self.scale
else:
scales = np.array([ax[1:] - ax[:-1] for ax in self.axes])
scales = np.pad(scales, 1, mode="edge")
left_scales = scales[:, :-1]
right_scales = scales[:, 1:]
x_scales = self.axes[0][1:] - self.axes[0][:-1]
x_scales = np.pad(x_scales, 1, mode="edge")
y_scales = self.axes[1][1:] - self.axes[1][:-1]
y_scales = np.pad(y_scales, 1, mode="edge")
left_scales = [
x_scales[:-1],
y_scales[:-1],
]
right_scales = [
x_scales[1:],
y_scales[1:],
]

extents = []
for ax, left_scale, right_scale in zip(self.axes, left_scales, right_scales):
Expand Down

0 comments on commit f0afa3e

Please sign in to comment.