shift_diffraction#
- Diffraction2D.shift_diffraction(shift_x=None, shift_y=None, shifts=None, interpolation_order=None, order=1, inplace=False, lazy_output=None, show_progressbar=True, **kwargs)[source]#
Shift the diffraction patterns.
- Parameters:
shift_x, shift_y (int or NumPy array) – Deprecated. 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.
shifts (list of number of length 2 or BaseSignal) – If list of number, shift the diffraction patterns by the same value for all navigation positions. If BaseSignal, shift the diffraction patterns with different values for each navigation position. Both shifts and the signal need to have the same navigation shape, and shifts needs to have one signal dimension with size 2.
interpolation_order (int) – Deprecated. Same as order, but kept for backwards compatibility.
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.
**kwargs (dict) – Additional keyword arguments to be passed to
scipy.ndimage.shift().
- Returns:
shifted_signal
- Return type:
Diffraction2D signal
See also
Examples
>>> s = pxm.data.dummy_data.get_disk_shift_simple_test_signal() >>> s_c = s.get_direct_beam_position(method="center_of_mass", threshold=3.) >>> s_shift = s.shift_diffraction(shifts=s_c, show_progressbar=False) >>> s_shift.plot()
Using a different interpolation order
>>> s_shift = s.shift_diffraction( ... shifts=s_c, order=3, ... show_progressbar=False)