Skip to content

Commit

Permalink
Deprecations: carry out removals scheduled for release 24.12 (#786)
Browse files Browse the repository at this point in the history
Removes the deprecated "look-for" functions and some deprecated argument names ("seed", "random_state" were deprecated in favor of "rng").

Authors:
  - Gregory Lee (https://github.com/grlee77)

Approvers:
  - https://github.com/jakirkham

URL: #786
  • Loading branch information
grlee77 authored Oct 2, 2024
1 parent ad2eeaf commit 1946a38
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 96 deletions.
1 change: 0 additions & 1 deletion python/cucim/src/cucim/skimage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,3 @@ def __dir__():
img_as_ubyte,
img_as_uint,
)
from .util.lookfor import lookfor
6 changes: 0 additions & 6 deletions python/cucim/src/cucim/skimage/data/_binary_blobs.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import cupy as cp

from .._shared.filters import gaussian
from .._shared.utils import DEPRECATED, deprecate_parameter


@deprecate_parameter(
"seed", new_name="rng", start_version="23.12.00", stop_version="24.12.00"
)
def binary_blobs(
length=512,
blob_size_fraction=0.1,
n_dim=2,
volume_fraction=0.5,
rng=None,
*,
seed=DEPRECATED,
):
"""
Generate synthetic binary image with several rounded blob-like objects.
Expand Down
6 changes: 0 additions & 6 deletions python/cucim/src/cucim/skimage/data/tests/test_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import cupy as cp
import pytest
from numpy.testing import assert_almost_equal

from cucim.skimage import data
Expand All @@ -16,8 +15,3 @@ def test_binary_blobs():
length=32, volume_fraction=0.25, n_dim=3
)
assert not cp.all(blobs == other_realization)


def test_binary_blobs_futurewarning():
with pytest.warns(FutureWarning):
data.binary_blobs(length=128, seed=5)
8 changes: 1 addition & 7 deletions python/cucim/src/cucim/skimage/morphology/_skeletonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import cucim.skimage._vendored.ndimage as ndi
from cucim.core.operations.morphology import distance_transform_edt
from cucim.skimage._shared.utils import DEPRECATED, deprecate_parameter

from .._shared.utils import check_nD
from ._medial_axis_lookup import (
Expand Down Expand Up @@ -168,12 +167,7 @@ def _get_tiebreaker(n, seed):
return tiebreaker


@deprecate_parameter(
"seed", new_name="rng", start_version="23.12", stop_version="24.12"
)
def medial_axis(
image, mask=None, return_distance=False, *, seed=DEPRECATED, rng=None
):
def medial_axis(image, mask=None, return_distance=False, *, rng=None):
"""Compute the medial axis transform of a binary image.
Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ def test_rng_cupy(self):
def test_rng_int(self):
self._test_vertical_line(dtype=bool, rng=15)

def test_vertical_line_seed(self):
"""seed was deprecated (now use rng)"""
with pytest.warns(FutureWarning):
self._test_vertical_line(dtype=bool, seed=15)

def test_01_01_rectangle(self):
"""Test skeletonize on a rectangle"""
image = cp.zeros((9, 15), bool)
Expand Down
16 changes: 0 additions & 16 deletions python/cucim/src/cucim/skimage/restoration/deconvolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import numpy as np

from .._shared.utils import (
DEPRECATED,
_supported_float_type,
deprecate_parameter,
)
from . import uft

Expand Down Expand Up @@ -151,18 +149,6 @@ def wiener(image, psf, balance, reg=None, is_real=True, clip=True):
return deconv


@deprecate_parameter(
"random_state",
new_name="rng",
start_version="23.08.00",
stop_version="24.12.00",
)
@deprecate_parameter(
"seed",
new_name="rng",
start_version="23.08.00",
stop_version="24.12.00",
)
def unsupervised_wiener(
image,
psf,
Expand All @@ -172,8 +158,6 @@ def unsupervised_wiener(
clip=True,
*,
rng=None,
random_state=DEPRECATED,
seed=DEPRECATED,
):
"""Unsupervised Wiener-Hunt deconvolution.
Expand Down
40 changes: 0 additions & 40 deletions python/cucim/src/cucim/skimage/util/lookfor.py

This file was deleted.

8 changes: 1 addition & 7 deletions python/cucim/src/cucim/skimage/util/noise.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import cupy as cp

from .._shared.utils import DEPRECATED, deprecate_parameter
from .dtype import img_as_float

__all__ = ["random_noise"]
Expand Down Expand Up @@ -54,12 +53,7 @@ def _bernoulli(p, shape, *, rng):
return rng.random(shape) <= p


@deprecate_parameter(
"seed", new_name="rng", start_version="23.12", stop_version="24.12"
)
def random_noise(
image, mode="gaussian", rng=None, clip=True, *, seed=DEPRECATED, **kwargs
):
def random_noise(image, mode="gaussian", rng=None, clip=True, **kwargs):
"""
Function to add random noise of various types to a floating-point image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ def test_set_seed():
assert_array_equal(test, random_noise(cam, rng=seed))


def test_random_noise_futurewarning():
seed = 42
cam = cp.asarray(camerad)
with pytest.warns(FutureWarning):
test = random_noise(cam, seed=seed)
assert_array_equal(test, random_noise(cam, rng=seed))


def test_salt():
amount = 0.15
cam = img_as_float(camerad)
Expand Down

0 comments on commit 1946a38

Please sign in to comment.