Skip to content

Commit

Permalink
spikes removal typos
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaehne committed Feb 3, 2025
1 parent 1b8170d commit b821cc8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions doc/user_guide/signal/generic_tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -935,24 +935,24 @@ In this case method will not return anything.
Spike removal
^^^^^^^^^^^^^

Comic ray or X-ray can cause intense pixels in the data. To correct for these experimental
artifact, two approaches are implemented in HyperSpy to remove spikes:
Cosmic rays or X-rays can cause intense pixels in the data. To correct for these experimental
artifacts, two approaches are implemented in HyperSpy to remove spikes:

- using a median filter - see :meth:`~.api.signals.BaseSignal.remove_spikes`
- using interpolation (Signal1D only) - see :meth:`~.api.signals.Signal1D.spikes_removal_tool`

Using a median filter
"""""""""""""""""""""

The :meth:`~.api.signals.BaseSignal.remove_spikes` find spikes using the following condition:
The :meth:`~.api.signals.BaseSignal.remove_spikes` finds spikes using the following condition:

.. math::
\mathrm{value} > \mathrm{median} + \sigma * \mathrm{threshold\_factor}
where :math:`\sigma` is the standard deviation.

Where the condition above is fullfill, the value are replace by their local median.
Where the condition above is fullfilled, the values are replaced by their local median.
The parameter ``threshold_factor`` can be specified by the user (default value is 5)
and the axes along which the median and the standard deviation are calculated can be specified
using the ``axes`` parameter.
Expand Down
3 changes: 2 additions & 1 deletion hyperspy/_signals/signal1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ def spikes_diagnosis(self, signal_mask=None, navigation_mask=None, **kwargs):
See Also
--------
spikes_removal_tool, hyperspy.api.signals.BaseSignal.remove_spikes
hyperspy.api.signals.Signal1D.spikes_removal_tool,
hyperspy.api.signals.BaseSignal.remove_spikes
"""
self._spikes_diagnosis(
Expand Down
20 changes: 10 additions & 10 deletions hyperspy/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7189,25 +7189,25 @@ def remove_spikes(self, threshold_factor=5, axes=None, inplace=True, **kwargs):
Parameters
----------
threshold_factor : int, float
Factor used in the thresholding calculation. Higher value will
give higher threshold value to find spikes and less spikes will
removed. It must a positive number. Default is 5.
Factor used in the thresholding calculation. A higher value will
give a higher threshold value to find spikes and less spikes will
removed. It must be a positive number. Default is 5.
axes : int, str, :class:`~hyperspy.axes.DataAxis` or tuple
Specify the axes used for calculating the local median. It is recommended
to use axes of similar nature where the local median is representative
of the current value (for example, spatial position of mapped values)
``axes`` can be a single or many axes in a tuple. In both cases the
to use axes of similar nature, where the local median is representative
of the current value (for example, spatial position of mapped values).
``axes`` can be a single or multiple axes in a tuple. In both cases, the
axes can be passed directly, or specified using the index in
:attr:`~.api.signals.BaseSignal.axes_manager` or the name of the axis.
If ``None``, for :class:`~.api.signals.Signal1D`, the navigation axes are
used. For signals with signal dimension >= 2, the signal axes are used.
For signals with a signal dimension of 0, all axes are used.
inplace : bool, default True
If ``True``, the data is replaced by the result. Otherwise
a new Signal with the results is returned.
If ``True``, the data is replaced by the result. Otherwise,
a new Signal with the result is returned.
**kwargs : dict
keyword arguments are passed to :func:`scipy.ndimage.median_filter`
of :func:`dask_image.ndfilters.median_filter` for lazy signal.
Keyword arguments are passed to :func:`scipy.ndimage.median_filter`
of :func:`dask_image.ndfilters.median_filter` for lazy signals.
Returns
-------
Expand Down

0 comments on commit b821cc8

Please sign in to comment.