__init__.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. """
  2. ==========================================
  3. Miscellaneous routines (:mod:`scipy.misc`)
  4. ==========================================
  5. .. currentmodule:: scipy.misc
  6. Various utilities that don't have another home.
  7. Note that Pillow (https://python-pillow.org/) is not a dependency
  8. of SciPy, but the image manipulation functions indicated in the list
  9. below are not available without it.
  10. .. autosummary::
  11. :toctree: generated/
  12. ascent - Get example image for processing
  13. central_diff_weights - Weights for an n-point central m-th derivative
  14. derivative - Find the n-th derivative of a function at a point
  15. face - Get example image for processing
  16. electrocardiogram - Load an example of a one-dimensional signal.
  17. Deprecated functions:
  18. .. autosummary::
  19. :toctree: generated/
  20. bytescale - Byte scales an array (image) [requires Pillow]
  21. fromimage - Return a copy of a PIL image as a numpy array [requires Pillow]
  22. imfilter - Simple filtering of an image [requires Pillow]
  23. imread - Read an image file from a filename [requires Pillow]
  24. imresize - Resize an image [requires Pillow]
  25. imrotate - Rotate an image counter-clockwise [requires Pillow]
  26. imsave - Save an array to an image file [requires Pillow]
  27. imshow - Simple showing of an image through an external viewer [requires Pillow]
  28. toimage - Takes a numpy array and returns a PIL image [requires Pillow]
  29. Deprecated aliases:
  30. .. autosummary::
  31. :toctree: generated/
  32. comb - Combinations of N things taken k at a time, "N choose k" (imported from `scipy.special`)
  33. factorial - The factorial function, ``n! = special.gamma(n+1)``
  34. (imported from `scipy.special`)
  35. factorial2 - Double factorial, ``(n!)!`` (imported from `scipy.special`)
  36. factorialk - ``(...((n!)!)!...)!`` where there are k '!' (imported from `scipy.special`)
  37. logsumexp - Compute the log of the sum of exponentials of input elements
  38. (imported from `scipy.special`)
  39. pade - Pade approximation to function as the ratio of two polynomials.
  40. (imported from `scipy.interpolate`)
  41. info - Get help information for a function, class, or module. (imported from `numpy`)
  42. source - Print function source code. (imported from `numpy`)
  43. who - Print the Numpy arrays in the given dictionary. (imported from `numpy`)
  44. """
  45. from __future__ import division, print_function, absolute_import
  46. __all__ = ['who', 'source', 'info', 'doccer', 'pade',
  47. 'comb', 'factorial', 'factorial2', 'factorialk', 'logsumexp']
  48. from . import doccer
  49. from .common import *
  50. from numpy import who as _who, source as _source, info as _info
  51. import numpy as np
  52. from scipy.interpolate._pade import pade as _pade
  53. from scipy.special import (comb as _comb, logsumexp as _lsm,
  54. factorial as _fact, factorial2 as _fact2, factorialk as _factk)
  55. import sys
  56. _msg = ("Importing `%(name)s` from scipy.misc is deprecated in scipy 1.0.0. Use "
  57. "`scipy.special.%(name)s` instead.")
  58. comb = np.deprecate(_comb, message=_msg % {"name": _comb.__name__})
  59. logsumexp = np.deprecate(_lsm, message=_msg % {"name": _lsm.__name__})
  60. factorial = np.deprecate(_fact, message=_msg % {"name": _fact.__name__})
  61. factorial2 = np.deprecate(_fact2, message=_msg % {"name": _fact2.__name__})
  62. factorialk = np.deprecate(_factk, message=_msg % {"name": _factk.__name__})
  63. _msg = ("Importing `pade` from scipy.misc is deprecated in scipy 1.0.0. Use "
  64. "`scipy.interpolate.pade` instead.")
  65. pade = np.deprecate(_pade, message=_msg)
  66. _msg = ("Importing `%(name)s` from scipy.misc is deprecated in scipy 1.0.0. Use "
  67. "`numpy.%(name)s` instead.")
  68. who = np.deprecate(_who, message=_msg % {"name": "who"})
  69. source = np.deprecate(_source, message=_msg % {"name": "source"})
  70. @np.deprecate(message=_msg % {"name": "info.(..., toplevel='scipy')"})
  71. def info(object=None,maxwidth=76,output=sys.stdout,toplevel='scipy'):
  72. return _info(object, maxwidth, output, toplevel)
  73. info.__doc__ = _info.__doc__
  74. del sys
  75. try:
  76. from .pilutil import *
  77. from . import pilutil
  78. __all__ += pilutil.__all__
  79. del pilutil
  80. except ImportError:
  81. pass
  82. from . import common
  83. __all__ += common.__all__
  84. del common
  85. from scipy._lib._testutils import PytestTester
  86. test = PytestTester(__name__)
  87. del PytestTester