measurements.py 1015 B

1234567891011121314151617181920212223242526272829303132
  1. # This file is not meant for public use and will be removed in SciPy v2.0.0.
  2. # Use the `scipy.ndimage` namespace for importing the functions
  3. # included below.
  4. import warnings
  5. from . import _measurements
  6. __all__ = [ # noqa: F822
  7. 'label', 'find_objects', 'labeled_comprehension',
  8. 'sum', 'mean', 'variance', 'standard_deviation',
  9. 'minimum', 'maximum', 'median', 'minimum_position',
  10. 'maximum_position', 'extrema', 'center_of_mass',
  11. 'histogram', 'watershed_ift', 'sum_labels'
  12. ]
  13. def __dir__():
  14. return __all__
  15. def __getattr__(name):
  16. if name not in __all__:
  17. raise AttributeError(
  18. "scipy.ndimage.measurements is deprecated and has no attribute "
  19. f"{name}. Try looking in scipy.ndimage instead.")
  20. warnings.warn(f"Please use `{name}` from the `scipy.ndimage` namespace, "
  21. "the `scipy.ndimage.measurements` namespace is deprecated.",
  22. category=DeprecationWarning, stacklevel=2)
  23. return getattr(_measurements, name)