Skip to content

Commit

Permalink
Documentation: Clean up more mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
CSSFrancis committed Apr 8, 2024
1 parent 01b73ee commit b2a49c0
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 61 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Expand Up @@ -17,6 +17,7 @@ Fixed
- Replace ``matplotlib.cm.get_cmap`` (removed in matplotlib 3.9) with ``matplotlib.colormaps``. (#1023)
- Documentation fixes and improvement. (#1028)
- Fixed bug with flattening diffraction Vectors when there are different scales (#1024)
- Fixed intersphinx links and improved api documentation (#1056)

Added
-----
Expand Down
4 changes: 2 additions & 2 deletions pyxem/signals/diffraction1d.py
Expand Up @@ -29,9 +29,9 @@ class Diffraction1D(CommonDiffraction, Signal1D):
Parameters
----------
*args
See :class:`~hyperspy._signals.signal1d.Signal1D`.
See :class:`hyperspy.api.signals.Signal1D`.
**kwargs
See :class:`~hyperspy._signals.signal1d.Signal1D`
See :class:`hyperspy.api.signals.Signal1D`
"""

_signal_type = "diffraction"
Expand Down
41 changes: 26 additions & 15 deletions pyxem/signals/diffraction2d.py
Expand Up @@ -1006,7 +1006,8 @@ def template_match_disk(self, disk_r=4, inplace=False, **kwargs):
lazy_output : bool, default True
If True, will return a LazyDiffraction2D object. If False,
will compute the result and return a Diffraction2D object.
show_progressbar : bool, default True
kwargs :
Passed to :func:`pyxem.utils.diffraction.normalize_template_match`
Returns
-------
Expand All @@ -1021,8 +1022,9 @@ def template_match_disk(self, disk_r=4, inplace=False, **kwargs):
See Also
--------
template_match_ring
template_match
:meth:`pyxem.signals.DiffractionSignal2D.template_match_ring`
:meth:`pyxem.signals.DiffractionSignal2D.template_match`
:func:`pyxem.utils.diffraction.normalize_template_match`
"""
disk = morphology.disk(disk_r, self.data.dtype)
Expand All @@ -1043,10 +1045,11 @@ def template_match_ring(self, r_inner=5, r_outer=7, inplace=False, **kwargs):
----------
r_inner, r_outer : scalar, optional
Inner and outer radius of the rings.
lazy_output : bool, default True
If True, will return a LazyDiffraction2D object. If False,
will compute the result and return a Diffraction2D object.
show_progressbar : bool, default True
inplace : bool, optional
If True, the data is replaced by the filtered data. If False, a
new signal is returned. Default False.
kwargs :
Passed to :func:`pyxem.utils.diffraction.normalize_template_match`
Returns
-------
Expand All @@ -1060,9 +1063,9 @@ def template_match_ring(self, r_inner=5, r_outer=7, inplace=False, **kwargs):
See Also
--------
template_match_disk
template_match
:meth:`pyxem.signals.DiffractionSignal2D.template_match_disk`
:meth:`pyxem.signals.DiffractionSignal2D.template_match`
:func:`pyxem.utils.diffraction.normalize_template_match`
"""
if r_outer <= r_inner:
raise ValueError(
Expand Down Expand Up @@ -1130,7 +1133,14 @@ def template_match(self, template, inplace=False, **kwargs):
Parameters
----------
template : 2-D NumPy array
template : numpy.ndarray
The 2D template to match with the signal.
inplace : bool, optional
If True, the data is replaced by the filtered data. If False, a
new signal is returned. Default False.
**kwargs :
Any additional keyword arguments to be passed to
:func:`pyxem.utils.diffraction.normalize_template_match`
Returns
-------
Expand All @@ -1147,8 +1157,9 @@ def template_match(self, template, inplace=False, **kwargs):
See Also
--------
template_match_disk
template_match_ring
:meth:`pyxem.signals.DiffractionSignal2D.template_match_disk`
:meth:`pyxem.signals.DiffractionSignal2D.template_match_ring`
:func:`pyxem.utils.diffraction.normalize_template_match`
"""

Expand Down Expand Up @@ -1387,7 +1398,7 @@ def add_peak_array_as_markers(self, peak_array, permanent=True, **kwargs):
Default False, if True the markers will be added to the
signal permanently.
**kwargs :
Passed to :py:class:`hyperspy.api.plot.markers.Points`
Passed to :class:`hyperspy.api.plot.markers.Points`
Examples
--------
Expand Down Expand Up @@ -1462,7 +1473,7 @@ def angular_mask(self, angle0, angle1, centre_x_array=None, centre_y_array=None)
Returns
-------
mask_array : NumPy array
mask_array : numpy.ndarray
The True values will be the region between angle0 and angle1.
The array will have the same dimensions as the signal.
Expand Down
4 changes: 2 additions & 2 deletions pyxem/signals/diffraction_variance1d.py
Expand Up @@ -26,9 +26,9 @@ class DiffractionVariance1D(Diffraction1D):
Parameters
----------
*args
See :class:`~hyperspy._signals.signal1d.Signal1D`.
See :class:`hyperspy.api.signals.Signal1D`.
**kwargs
See :class:`~hyperspy._signals.signal1d.Signal1D`
See :class:`hyperspy.api.signals.Signal1D`
"""

_signal_type = "diffraction_variance"
Expand Down
4 changes: 2 additions & 2 deletions pyxem/signals/diffraction_variance2d.py
Expand Up @@ -28,9 +28,9 @@ class DiffractionVariance2D(Diffraction2D):
Parameters
----------
*args
See :class:`~hyperspy._signals.signal2d.Signal2D`.
See :class:`hyperspy.api.signals.Signal2D`.
**kwargs
See :class:`~hyperspy._signals.signal2d.Signal2D`
See :class:`hyperspy.api.signals.Signal2D`
"""

_signal_type = "diffraction_variance"
Expand Down
10 changes: 5 additions & 5 deletions pyxem/signals/diffraction_vectors.py
Expand Up @@ -77,10 +77,10 @@ class is likely to change as the API for diffraction vectors is developed.
Attributes
----------
cartesian : np.array()
cartesian : numpy.array
Array of 3-vectors describing Cartesian coordinates associated with
each diffraction vector.
hkls : np.array()
hkls : numpy.array
Array of Miller indices associated with each diffraction vector
following indexation.
"""
Expand Down Expand Up @@ -183,7 +183,7 @@ def from_peaks(
Parameters
----------
peaks : Signal
peaks : hyperspy.api.signals.BaseSignal
Signal containing lists (np.array) of pixel coordinates specifying
the reflection positions
center : np.array or None
Expand All @@ -193,7 +193,7 @@ def from_peaks(
Returns
-------
vectors : :obj:`pyxem.signals.diffraction_vectors.DiffractionVectors`
vectors : :class:`pyxem.signals.diffraction_vectors.DiffractionVectors`
List of diffraction vectors
"""
if center is None and peaks.metadata.has_item("Peaks.signal_axes"):
Expand Down Expand Up @@ -294,7 +294,7 @@ def subpixel_refine(
Parameters
----------
signal : Signal
signal : hyperspy.api.signals.BaseSignal
The signal which will be used to refine the diffraction vectors.
method : str
The method used to refine the diffraction vectors. Currently
Expand Down
5 changes: 3 additions & 2 deletions pyxem/signals/diffraction_vectors2d.py
Expand Up @@ -243,9 +243,10 @@ def to_roi(self, radius=0.1, columns=None, include_labels=False, **kwargs):
columns: list
The columns to use for the ROIs. If None, columns 0 and 1 are used to create the ROIs.
include_labels: bool
If True, the labels for each ROI are returned as well using hyperspy's Texts class.
If True, the labels for each ROI are returned as well using hyperspy's
:class:`hyperspy.api.plot.markers.Texts` class.
kwargs: dict
Keyword arguments to pass to the hyperspy Texts class.
Keyword arguments to pass to the :class:`hyperspy.api.plot.markers.Texts` class.
"""
if self.has_navigation_axis:
raise NotImplementedError(
Expand Down
4 changes: 2 additions & 2 deletions pyxem/signals/electron_diffraction1d.py
Expand Up @@ -27,9 +27,9 @@ class ElectronDiffraction1D(Diffraction1D):
Parameters
----------
*args
See :class:`~hyperspy._signals.signal1d.Signal1D`.
See :class:`hyperspy.api.signals.Signal1D`.
**kwargs
See :class:`~hyperspy._signals.signal1d.Signal1D`
See :class:`hyperspy.api.signals.Signal1D`
"""

_signal_type = "electron_diffraction"
Expand Down
4 changes: 2 additions & 2 deletions pyxem/signals/electron_diffraction2d.py
Expand Up @@ -31,9 +31,9 @@ class ElectronDiffraction2D(Diffraction2D):
Parameters
----------
*args
See :class:`~hyperspy._signals.signal2d.Signal2D`.
See :class:`hyperspy.api.signals.Signal2D`.
**kwargs
See :class:`~hyperspy._signals.signal2d.Signal2D`
See :class:`hyperspy.api.signals.Signal2D`
"""

_signal_type = "electron_diffraction"
Expand Down
18 changes: 9 additions & 9 deletions pyxem/signals/indexation_results.py
Expand Up @@ -36,14 +36,14 @@ def crystal_from_vector_matching(z_matches):
Parameters
----------
z_matches : numpy.array
z_matches : numpy.ndarray
Template matching results in an array of shape (m,5) sorted by
total_error (ascending) within each phase, with entries
[phase, R, match_rate, ehkls, total_error]
Returns
-------
results_array : numpy.array
results_array : numpy.ndarray
Crystallographic mapping results in an array of shape (3) with entries
[phase, np.array((z, x, z)), dict(metrics)]
Expand Down Expand Up @@ -79,12 +79,12 @@ def _get_best_match(z):
Parameters
----------
z : np.array
z : numpy.ndarray
array with shape (5,n_matches), the 5 elements are phase, alpha, beta, gamma, score
Returns
-------
z_best : np.array
z_best : numpy.ndarray
array with shape (5,)
"""
Expand All @@ -96,7 +96,7 @@ def _get_phase_reliability(z):
Parameters
----------
z : np.array
z : numpy.ndarray
array with shape (5,n_matches), the 5 elements are phase, alpha, beta, gamma, score
Returns
Expand Down Expand Up @@ -125,7 +125,7 @@ def _get_second_best_phase(z):
Parameters
----------
z : np.array
z : numpy.ndarray
array with shape (5,n_matches), the 5 elements are phase, alpha, beta, gamma, score
Returns
Expand Down Expand Up @@ -205,7 +205,7 @@ class VectorMatchingResults(BaseSignal):
Attributes
----------
vectors : DiffractionVectors
vectors : pyxem.signals.DiffractionVectors
Diffraction vectors indexed.
hkls : BaseSignal
Miller indices associated with each diffraction vector.
Expand Down Expand Up @@ -253,12 +253,12 @@ def get_indexed_diffraction_vectors(
Parameters
----------
vectors : DiffractionVectors
vectors : pyxem.signals.DiffractionVectors
A diffraction vectors object to be indexed.
Returns
-------
indexed_vectors : DiffractionVectors
indexed_vectors : pyxem.signals.DiffractionVectors
An indexed diffraction vectors object.
"""
Expand Down
6 changes: 3 additions & 3 deletions pyxem/signals/insitu_diffraction2d.py
Expand Up @@ -43,9 +43,9 @@ class InSituDiffraction2D(Diffraction2D):
Parameters
----------
*args:
See :class:`~hyperspy._signals.signal2d.Signal2D`.
See :class:`hyperspy.api.signals.Signal2D`.
**kwargs:
See :class:`~hyperspy._signals.signal2d.Signal2D`
See :class:`hyperspy.api.signals.Signal2D`
"""

_signal_type = "insitu_diffraction"
Expand Down Expand Up @@ -92,7 +92,7 @@ def get_drift_vectors(
Parameters
----------
s: :class:`~hyperspy.api.signals.Signal2D`
s: :class:`hyperspy.api.signals.Signal2D`
Time series of reconstructed images
reference: 'current', 'cascade', or 'stat'
reference argument passed to :meth:`~hyperspy.api.signals.Signal2D.estimate_shift2D`
Expand Down
8 changes: 4 additions & 4 deletions pyxem/signals/pair_distribution_function1d.py
Expand Up @@ -27,9 +27,9 @@ class PairDistributionFunction1D(Signal1D):
Parameters
----------
*args
See :class:`~hyperspy._signals.signal1d.Signal1D`.
See :class:`hyperspy.api.signals.Signal1D`.
**kwargs
See :class:`~hyperspy._signals.signal1d.Signal1D`
See :class:`hyperspy.api.signals.Signal1D`
"""

_signal_type = "pair_distribution_function"
Expand All @@ -49,9 +49,9 @@ def normalise_signal(self, s_min=0, inplace=False, *args, **kwargs):
If True (default), this signal is overwritten. Otherwise, returns a
new signal.
*args:
Arguments to be passed to map().
Arguments to be passed to :meth:`hyperspy.api.signals.BaseSignal.map`.
**kwargs:
Keyword arguments to be passed to map().
Keyword arguments to be passed to :meth:`hyperspy.api.signals.BaseSignal.map`.
"""
s_scale = self.axes_manager.signal_axes[0].scale
Expand Down
10 changes: 5 additions & 5 deletions pyxem/signals/polar_diffraction2d.py
Expand Up @@ -55,9 +55,9 @@ def get_angular_correlation(
normalize: bool
Normalize the radial correlation by the average value at some radius.
kwargs: dict
Any additional options for the hyperspy.BaseSignal.map() function
Any additional options for the :meth:`hyperspy.api.signals.BaseSignal.map` function
inplace: bool
From hyperspy.signal.map(). inplace=True means the signal is
From :meth:`hyperspy.api.signals.BaseSignal.map`. inplace=True means the signal is
overwritten.
Returns
Expand Down Expand Up @@ -100,10 +100,10 @@ def get_angular_power(self, mask=None, normalize=True, inplace=False, **kwargs):
normalize: bool
Normalize the radial correlation by the average value at some radius.
inplace: bool
From :meth:`~hyperspy.signal.BaseSignal.map` inplace=True means the signal is
From :meth:`hyperspy.api.signals.BaseSignal.map` inplace=True means the signal is
overwritten.
kwargs: dict
Any additional options for the :meth:`~hyperspy.signal.BaseSignal.map` function
Any additional options for the :meth:`hyperspy.api.signals.BaseSignal.map` function
Returns
-------
Expand Down Expand Up @@ -133,7 +133,7 @@ def get_full_pearson_correlation(
Parameters
----------
mask: Numpy array
mask: numpy.ndarray
A bool mask of values to ignore of shape equal to the signal shape.
True for elements masked, False for elements unmasked
krange: tuple of int or float
Expand Down
2 changes: 1 addition & 1 deletion pyxem/signals/polar_vectors.py
Expand Up @@ -63,7 +63,7 @@ def get_angles(
Which means that two vectors even with a small angle between them will be
considered.
**kwargs:
Keyword arguments to map().
Keyword arguments to :meth:`hyperspy.api.signals.BaseSignal.map`.
Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions pyxem/signals/power2d.py
Expand Up @@ -31,9 +31,9 @@ class Power2D(Signal2D):
Parameters
----------
*args
See :class:`~hyperspy._signals.signal2d.Signal2D`.
See :class:`hyperspy.api.signals.Signal2D`.
**kwargs
See :class:`~hyperspy._signals.signal2d.Signal2D`
See :class:`hyperspy.api.signals.Signal2D`
"""

_signal_type = "power"
Expand Down

0 comments on commit b2a49c0

Please sign in to comment.