Skip to content

Commit

Permalink
Update center-of-mass documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sivborg authored and CSSFrancis committed Nov 15, 2024
1 parent 95d54df commit 973e03b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions pyxem/signals/diffraction2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ def shift_diffraction(
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_c = s.get_direct_beam_position(method="center_of_mass", threshold=3.)
>>> s_c = -s_c # To shift in right direction
>>> s_shift = s.shift_diffraction(
... s_c.inav[0].data, s_c.inav[1].data,
... show_progressbar=False)
Expand Down Expand Up @@ -649,8 +649,9 @@ def get_direct_beam_position(
with standard deviation ``sigma``.
"center_of_mass": The center is found using a calculation of the center of mass.
Optionally a ``mask`` can be applied to focus on just the center of some
dataset. A threshold value can also be given to suppress contrast from
weaker diffraction features.
dataset. To suppress contrast from diffuse scattering, a threshold value
``threshold`` can also be given. The mean intensity of the diffraction image
will be multiplied by this and any values below the product will be set to 0.
lazy_output : optional
If True, s_shifts will be a lazy signal. If False, a non-lazy signal.
By default, if the signal is (non-)lazy, the result will also be (non-)lazy.
Expand All @@ -668,7 +669,7 @@ def get_direct_beam_position(
Additional arguments accepted by :func:`pyxem.utils.diffraction.find_beam_center_blur`,
:func:`pyxem.utils.diffraction.find_beam_center_interpolate`,
:func:`pyxem.utils.diffraction.find_beam_offset_cross_correlation`,
and :func:`pyxem.signals.diffraction2d.Diffraction2D.center_of_mass`,
and :func:`pyxem.signals.diffraction.center_of_mass_from_image`,
Returns
-------
Expand All @@ -690,7 +691,7 @@ def get_direct_beam_position(
Get a lazy signal, then calculate afterwards
>>> s_bs = s.center_of_mass(lazy_output=True, method="center_of_mass")
>>> s_bs = s.get_direct_beam_position(lazy_output=True, method="center_of_mass")
>>> s_bs.compute(show_progressbar=False)
"""
Expand Down Expand Up @@ -851,7 +852,7 @@ def center_direct_beam(
:func:`pyxem.utils.diffraction.find_beam_center_interpolate`,
:func:`pyxem.utils.diffraction.find_beam_offset_cross_correlation`,
:func:`pyxem.signals.diffraction2d.Diffraction2D.get_direct_beam_position`,
and :func:`pyxem.signals.diffraction2d.Diffraction2D.center_of_mass`,
and :func:`pyxem.signals.diffraction.center_of_mass_from_image`,
Example
-------
Expand Down Expand Up @@ -910,8 +911,8 @@ def center_direct_beam(
def threshold_and_mask(self, threshold=None, mask=None, show_progressbar=True):
"""Get a thresholded and masked of the signal.
Useful for figuring out optimal settings for the
:meth:`pyxem.signals.Diffraction2D.center_of_mass` method.
Useful for figuring out optimal settings when using 'center_of_mass' in
:meth:`pyxem.signals.Diffraction2D.get_direct_beam_position`.
Parameters
----------
Expand All @@ -937,7 +938,7 @@ def threshold_and_mask(self, threshold=None, mask=None, show_progressbar=True):
See Also
--------
center_of_mass
get_direct_beam_position
"""
if self._lazy:
Expand Down

0 comments on commit 973e03b

Please sign in to comment.