Skip to content

Commit

Permalink
Merge pull request #656 from hakonanes/remove-unused-functions
Browse files Browse the repository at this point in the history
Remove unused functions
  • Loading branch information
hakonanes committed Nov 3, 2023
2 parents bde4cd0 + a4a195c commit 6f69722
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 215 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ Removed
0.8. (`#612 <https://github.com/pyxem/kikuchipy/pull/612>`_)
- The deprecated PyPI selector ``viz`` is removed.
(`#643 <https://github.com/pyxem/kikuchipy/pull/643>`_)
- The data module functions ``silicon_ebsd_moving_screen_x()``, where "x" is "in",
"out5mm" or "out10mm". They were deprecated in version 0.8.
(`#656 <https://github.com/pyxem/kikuchipy/pull/656>`_)

Fixed
-----
Expand Down
3 changes: 0 additions & 3 deletions kikuchipy/_util/tests/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,6 @@ def test_dir_data(self):
"nickel_ebsd_small",
"si_ebsd_moving_screen",
"si_wafer",
"silicon_ebsd_moving_screen_in",
"silicon_ebsd_moving_screen_out10mm",
"silicon_ebsd_moving_screen_out5mm",
]

def test_dir_detectors(self):
Expand Down
6 changes: 0 additions & 6 deletions kikuchipy/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
"nickel_ebsd_small",
"si_wafer",
"si_ebsd_moving_screen",
"silicon_ebsd_moving_screen_in",
"silicon_ebsd_moving_screen_out10mm",
"silicon_ebsd_moving_screen_out5mm",
]


Expand All @@ -60,9 +57,6 @@ def __getattr__(name):
"nickel_ebsd_small": "_data",
"si_wafer": "_data",
"si_ebsd_moving_screen": "_data",
"silicon_ebsd_moving_screen_in": "_data",
"silicon_ebsd_moving_screen_out10mm": "_data",
"silicon_ebsd_moving_screen_out5mm": "_data",
}
if name in __all__:
import importlib
Expand Down
165 changes: 0 additions & 165 deletions kikuchipy/data/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from kikuchipy import load
from kikuchipy.release import version
from kikuchipy.data._registry import registry_hashes, registry_urls
from kikuchipy._util import deprecated


marshall = pooch.create(
Expand Down Expand Up @@ -322,170 +321,6 @@ def si_ebsd_moving_screen(
return load(file_path, **kwargs)


@deprecated("0.8", "si_ebsd_moving_screen", removal="0.9")
def silicon_ebsd_moving_screen_in(
allow_download: bool = False, show_progressbar: Optional[bool] = None, **kwargs
) -> EBSD:
"""One EBSD pattern of (480, 480) pixels from a single crystal
silicon sample, acquired on a NORDIF UF-420 detector
:cite:`aanes2022electron3`.
This pattern and two other patterns from the same sample position
but with 5 mm and 10 mm greater sample-screen-distances were
acquired to test the moving-screen projection center estimation
technique :cite:`hjelen1991electron`.
Parameters
----------
allow_download
Whether to allow downloading the dataset from the internet to
the local cache with the pooch Python package. Default is
``False``.
show_progressbar
Whether to show a progressbar when downloading. If not given,
the value of
:obj:`hyperspy.api.preferences.General.show_progressbar` is
used.
**kwargs
Keyword arguments passed to :func:`~kikuchipy.load`.
Returns
-------
ebsd_signal
EBSD signal.
Notes
-----
The dataset is hosted in the GitHub repository
https://github.com/pyxem/kikuchipy-data.
The dataset carries a CC BY 4.0 license.
Examples
--------
>>> import kikuchipy as kp
>>> s = kp.data.si_ebsd_moving_screen(0, allow_download=True)
>>> s
<EBSD, title: si_in Scan 1, dimensions: (|480, 480)>
>>> s.plot()
"""
SiEBSDMovingScreenIn = Dataset("silicon_ebsd_moving_screen/si_in.h5")
file_path = SiEBSDMovingScreenIn.fetch_file_path(allow_download, show_progressbar)
return load(file_path, **kwargs)


@deprecated("0.8", "si_ebsd_moving_screen", removal="0.9")
def silicon_ebsd_moving_screen_out5mm(
allow_download: bool = False, show_progressbar: Optional[bool] = None, **kwargs
) -> EBSD:
"""One EBSD pattern of (480, 480) pixels from a single crystal
silicon sample, acquired on a NORDIF UF-420 detector
:cite:`aanes2022electron3`.
This pattern and two other patterns from the same sample position
but with sample-screen-distances 5 mm shorter
(:func:`silicon_ebsd_moving_screen_in`) and 5 mm greater
(:func:`silicon_ebsd_moving_screen_out10mm`) were acquired to test
the moving-screen projection center estimation technique
:cite:`hjelen1991electron`.
Parameters
----------
allow_download
Whether to allow downloading the dataset from the internet to
the local cache with the pooch Python package. Default is
``False``.
show_progressbar
Whether to show a progressbar when downloading. If not given,
the value of
:obj:`hyperspy.api.preferences.General.show_progressbar` is
used.
**kwargs
Keyword arguments passed to :func:`~kikuchipy.load`.
Returns
-------
ebsd_signal
EBSD signal.
Notes
-----
The dataset is hosted in the GitHub repository
https://github.com/pyxem/kikuchipy-data.
The dataset carries a CC BY 4.0 license.
Examples
--------
>>> import kikuchipy as kp
>>> s = kp.data.si_ebsd_moving_screen(5, allow_download=True)
>>> s
<EBSD, title: si_out5mm Scan 1, dimensions: (|480, 480)>
>>> s.plot()
"""
SiEBSDMovingScreenOut5mm = Dataset("silicon_ebsd_moving_screen/si_out5mm.h5")
file_path = SiEBSDMovingScreenOut5mm.fetch_file_path(
allow_download, show_progressbar
)
return load(file_path, **kwargs)


@deprecated("0.8", "si_ebsd_moving_screen", removal="0.9")
def silicon_ebsd_moving_screen_out10mm(
allow_download: bool = False, show_progressbar: Optional[bool] = None, **kwargs
) -> EBSD:
"""One EBSD pattern of (480, 480) pixels from a single crystal
silicon sample, acquired on a NORDIF UF-420 detector
:cite:`aanes2022electron3`.
This pattern and two other patterns from the same sample position
but with sample-screen-distances 10 mm shorter
(:func:`silicon_ebsd_moving_screen_in`) and 5 mm shorter
(:func:`silicon_ebsd_moving_screen_out5mm`) were acquired to test
the moving-screen projection center estimation technique
:cite:`hjelen1991electron`.
Parameters
----------
allow_download
Whether to allow downloading the dataset from the internet to
the local cache with the pooch Python package. Default is
``False``.
show_progressbar
Whether to show a progressbar when downloading. If not given,
the value of
:obj:`hyperspy.api.preferences.General.show_progressbar` is
used.
**kwargs
Keyword arguments passed to :func:`~kikuchipy.load`.
Returns
-------
ebsd_signal
EBSD signal.
Notes
-----
The dataset is hosted in the GitHub repository
https://github.com/pyxem/kikuchipy-data.
The dataset carries a CC BY 4.0 license.
Examples
--------
>>> import kikuchipy as kp
>>> s = kp.data.si_ebsd_moving_screen(10, allow_download=True)
>>> s
<EBSD, title: si_out10mm Scan 1, dimensions: (|480, 480)>
>>> s.plot()
"""
SiEBSDMovingScreenOut10mm = Dataset("silicon_ebsd_moving_screen/si_out10mm.h5")
file_path = SiEBSDMovingScreenOut10mm.fetch_file_path(
allow_download, show_progressbar
)
return load(file_path, **kwargs)


def si_wafer(
allow_download: bool = False, show_progressbar: Optional[bool] = None, **kwargs
) -> EBSD:
Expand Down
43 changes: 2 additions & 41 deletions kikuchipy/data/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,54 +117,15 @@ def test_load_ni_ebsd_large_allow_download(self):
assert s.data.shape == (55, 75, 60, 60)
assert np.issubdtype(s.data.dtype, np.uint8)

# TODO: Remove test after 0.8 is released
def test_load_si_ebsd_moving_screen_in(self):
"""Download external Si pattern."""
with pytest.warns(
np.VisibleDeprecationWarning,
match=r"Function `silicon_ebsd_moving_screen_in\(\)` is deprecated and ",
):
s = kp.data.silicon_ebsd_moving_screen_in(allow_download=True)

assert s.data.shape == (480, 480)
assert s.data.dtype == np.uint8
assert isinstance(s.static_background, np.ndarray)

# TODO: Remove test after 0.8 is released
def test_load_si_ebsd_moving_screen_out5mm(self):
"""Download external Si pattern."""
with pytest.warns(
np.VisibleDeprecationWarning,
match=r"Function `silicon_ebsd_moving_screen_out5mm\(\)` is deprecated ",
):
s = kp.data.silicon_ebsd_moving_screen_out5mm(allow_download=True)

assert s.data.shape == (480, 480)
assert s.data.dtype == np.uint8
assert isinstance(s.static_background, np.ndarray)

# TODO: Remove test after 0.8 is released
def test_load_si_ebsd_moving_screen_out10mm(self):
"""Download external Si pattern."""
with pytest.warns(
np.VisibleDeprecationWarning,
match=r"Function `silicon_ebsd_moving_screen_out10mm\(\)` is deprecated ",
):
s = kp.data.silicon_ebsd_moving_screen_out10mm(allow_download=True)

assert s.data.shape == (480, 480)
assert s.data.dtype == np.uint8
assert isinstance(s.static_background, np.ndarray)

def test_load_si_ebsd_moving_screen(self):
"""Download external Si pattern."""
s = kp.data.si_ebsd_moving_screen(allow_download=True)
assert s.data.shape == (480, 480)
assert s.data.dtype == np.uint8
assert isinstance(s.static_background, np.ndarray)

_ = kp.data.si_ebsd_moving_screen(5)
_ = kp.data.si_ebsd_moving_screen(10)
_ = kp.data.si_ebsd_moving_screen(5, allow_download=True)
_ = kp.data.si_ebsd_moving_screen(10, allow_download=True)

def test_si_wafer(self):
"""Test set up of Si wafer dataset (without downloading)."""
Expand Down

0 comments on commit 6f69722

Please sign in to comment.