__init__.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. """
  2. ==========================================
  3. Miscellaneous routines (:mod:`scipy.misc`)
  4. ==========================================
  5. .. currentmodule:: scipy.misc
  6. .. deprecated:: 1.10.0
  7. This module is deprecated and will be completely
  8. removed in SciPy v2.0.0.
  9. Various utilities that don't have another home.
  10. .. autosummary::
  11. :toctree: generated/
  12. ascent - Get example image for processing
  13. central_diff_weights - Weights for an n-point central mth derivative
  14. derivative - Find the nth derivative of a function at a point
  15. face - Get example image for processing
  16. electrocardiogram - Load an example of a 1-D signal
  17. """
  18. from ._common import *
  19. from . import _common
  20. import warnings
  21. # Deprecated namespaces, to be removed in v2.0.0
  22. from . import common, doccer
  23. __all__ = _common.__all__
  24. dataset_methods = ['ascent', 'face', 'electrocardiogram']
  25. def __dir__():
  26. return __all__
  27. def __getattr__(name):
  28. if name not in __all__:
  29. raise AttributeError(
  30. "scipy.misc is deprecated and has no attribute "
  31. f"{name}.")
  32. if name in dataset_methods:
  33. msg = ("The module `scipy.misc` is deprecated and will be "
  34. "completely removed in SciPy v2.0.0. "
  35. f"All dataset methods including {name}, must be imported "
  36. "directly from the new `scipy.datasets` module.")
  37. else:
  38. msg = (f"The method `{name}` from the `scipy.misc` namespace is"
  39. " deprecated, and will be removed in SciPy v1.12.0.")
  40. warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
  41. return getattr(name)
  42. del _common
  43. from scipy._lib._testutils import PytestTester
  44. test = PytestTester(__name__)
  45. del PytestTester