mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-12 12:50:49 +08:00
Use a stacklevel of 2 by default for all warnings
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import six
|
||||
import math
|
||||
import warnings
|
||||
import numpy as np
|
||||
from scipy import spatial
|
||||
from scipy import ndimage as ndi
|
||||
|
||||
from .._shared.utils import (get_bound_method_class, safe_as_int,
|
||||
_mode_deprecations)
|
||||
_mode_deprecations, warn)
|
||||
from ..util import img_as_float
|
||||
|
||||
from ._warps_cy import _warp_fast
|
||||
@@ -184,8 +183,7 @@ class ProjectiveTransform(GeometricTransform):
|
||||
|
||||
@property
|
||||
def _matrix(self):
|
||||
warnings.warn('`_matrix` attribute is deprecated, '
|
||||
'use `params` instead.')
|
||||
warn('`_matrix` attribute is deprecated, use `params` instead.')
|
||||
return self.params
|
||||
|
||||
@property
|
||||
@@ -782,8 +780,7 @@ class PolynomialTransform(GeometricTransform):
|
||||
|
||||
@property
|
||||
def _params(self):
|
||||
warnings.warn('`_params` attribute is deprecated, '
|
||||
'use `params` instead.')
|
||||
warn('`_params` attribute is deprecated, use `params` instead.')
|
||||
return self.params
|
||||
|
||||
def estimate(self, src, dst, order=2):
|
||||
@@ -1320,13 +1317,13 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1,
|
||||
if order == 2:
|
||||
# When fixing this issue, make sure to fix the branches further
|
||||
# below in this function
|
||||
warnings.warn("Bi-quadratic interpolation behavior has changed due "
|
||||
"to a bug in the implementation of scikit-image. "
|
||||
"The new version now serves as a wrapper "
|
||||
"around SciPy's interpolation functions, which itself "
|
||||
"is not verified to be a correct implementation. Until "
|
||||
"skimage's implementation is fixed, we recommend "
|
||||
"to use bi-linear or bi-cubic interpolation instead.")
|
||||
warn("Bi-quadratic interpolation behavior has changed due "
|
||||
"to a bug in the implementation of scikit-image. "
|
||||
"The new version now serves as a wrapper "
|
||||
"around SciPy's interpolation functions, which itself "
|
||||
"is not verified to be a correct implementation. Until "
|
||||
"skimage's implementation is fixed, we recommend "
|
||||
"to use bi-linear or bi-cubic interpolation instead.")
|
||||
|
||||
if order in (0, 1, 3) and not map_args:
|
||||
# use fast Cython version for specific interpolation orders and input
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import numpy as np
|
||||
import collections
|
||||
import warnings
|
||||
|
||||
from .._shared.utils import warn
|
||||
|
||||
|
||||
def integral_image(img):
|
||||
"""Integral image / summed area table.
|
||||
@@ -81,10 +83,10 @@ def integrate(ii, start, end, *args):
|
||||
rows = start.shape[0]
|
||||
# handle deprecated input format
|
||||
else:
|
||||
warnings.warn("The syntax 'integrate(ii, r0, c0, r1, c1)' is "
|
||||
"deprecated, and will be phased out in release 0.14. "
|
||||
"The new syntax is "
|
||||
"'integrate(ii, (r0, c0), (r1, c1))'.")
|
||||
warn("The syntax 'integrate(ii, r0, c0, r1, c1)' is "
|
||||
"deprecated, and will be phased out in release 0.14. "
|
||||
"The new syntax is "
|
||||
"'integrate(ii, (r0, c0), (r1, c1))'.")
|
||||
if isinstance(start, collections.Iterable):
|
||||
rows = len(start)
|
||||
args = (start, end) + args
|
||||
|
||||
Reference in New Issue
Block a user