shift_diffraction#
- Diffraction2D.shift_diffraction(shift_x, shift_y, interpolation_order=1, inplace=False, show_progressbar=True)[source]#
Shift the diffraction patterns in a pixelated STEM signal.
The points outside the boundaries are set to zero.
- Parameters:
shift_x, shift_y (int or NumPy array) – If given as int, all the diffraction patterns will have the same shifts. Each diffraction pattern can also have different shifts, by passing a NumPy array with the same dimensions as the navigation axes.
interpolation_order (int) – When shifting, a spline interpolation is used. This parameter sets the order of this spline. Must be between 0 and 5. Note that in some low-signal and high noise datasets, using a non-zero order might lead to artifacts. See the docstring in scipy.ndimage.shift for more information. Default 1.
inplace (bool) – If True (default), the data is replaced by the result. Useful when working with very large datasets, as this avoids doubling the amount of memory needed. If False, a new signal with the results is returned.
show_progressbar (bool) – Default True.
- Returns:
shifted_signal
- Return type:
Diffraction2D signal
Examples
>>> s = pxm.data.dummy_data.get_disk_shift_simple_test_signal() >>> s_c = s.center_of_mass(threshold=3., show_progressbar=False) >>> s_c -= 25 # To shift the center disk to the middle (25, 25) >>> s_shift = s.shift_diffraction( ... s_c.inav[0].data, s_c.inav[1].data, ... show_progressbar=False) >>> s_shift.plot()
Using a different interpolation order
>>> s_shift = s.shift_diffraction( ... s_c.inav[0].data, s_c.inav[1].data, interpolation_order=3, ... show_progressbar=False)