Skip to content

Commit

Permalink
Merge pull request #154 from tobac-project/revert-147-depreciate_segm…
Browse files Browse the repository at this point in the history
…entation

Revert "Added depreciation warnings to two segmentation functions"
  • Loading branch information
freemansw1 authored Jul 7, 2022
2 parents 3ee91cc + c236cb3 commit 43fd4b7
Showing 1 changed file with 2 additions and 58 deletions.
60 changes: 2 additions & 58 deletions tobac/segmentation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import logging
from multiprocessing.sharedctypes import Value
import warnings


def segmentation_3D(
Expand All @@ -13,17 +11,6 @@ def segmentation_3D(
method="watershed",
max_distance=None,
):
warnings.simplefilter(
"always", DeprecationWarning
) # turn off filter; this is an easy switch for users.
warnings.warn(
"Warning: using deprecated function `segmentation_3D`. Switch to `segmentation` instead."
" The arguments and output of `segmentation` is the same, so it is an easy switch."
" This function will be removed in v1.5.0.",
category=DeprecationWarning,
stacklevel=2,
)
warnings.simplefilter("default", DeprecationWarning) # reset filter
return segmentation(
features,
field,
Expand All @@ -46,18 +33,6 @@ def segmentation_2D(
method="watershed",
max_distance=None,
):
warnings.simplefilter(
"always", DeprecationWarning
) # turn off filter; this is an easy switch for users.
warnings.warn(
"Warning: using deprecated function `segmentation_2D`. Switch to `segmentation` instead."
" The arguments and output of `segmentation` is the same, so it is an easy switch."
" This function will be removed in v1.5.0.",
category=DeprecationWarning,
stacklevel=2,
)
warnings.simplefilter("default", DeprecationWarning) # reset filter

return segmentation(
features,
field,
Expand Down Expand Up @@ -311,41 +286,10 @@ def segmentation(


def watershedding_3D(track, field_in, **kwargs):
warnings.simplefilter(
"always", DeprecationWarning
) # turn off filter; this is an easy switch for users.
warnings.warn(
"Warning: using deprecated function `watershedding_3D`. Switch to `segmentation` instead."
" The arguments and output of `segmentation` is the same, so it is an easy switch."
" This function will be removed in v1.5.0.",
category=DeprecationWarning,
stacklevel=2,
)
warnings.simplefilter("default", DeprecationWarning) # reset filter

kwargs.pop("method", None)
if "dxy" not in kwargs:
raise ValueError("Need grid spacing `dxy`.")
dxy = kwargs.get("dxy")
kwargs.pop("dxy", None)
return segmentation(track, field_in, dxy=dxy, method="watershed", **kwargs)
return segmentation_3D(track, field_in, method="watershed", **kwargs)


def watershedding_2D(track, field_in, **kwargs):
warnings.simplefilter(
"always", DeprecationWarning
) # turn off filter; this is an easy switch for users.
warnings.warn(
"Warning: using deprecated function `watershedding_2D`. Switch to `segmentation` instead."
" The arguments and output of `segmentation` is the same, so it is an easy switch."
" This function will be removed in v1.5.0.",
category=DeprecationWarning,
stacklevel=2,
)

kwargs.pop("method", None)
if "dxy" not in kwargs:
raise ValueError("Need grid spacing `dxy`.")
dxy = kwargs.get("dxy")
kwargs.pop("dxy", None)
return segmentation(track, field_in, dxy=dxy, method="watershed", **kwargs)
return segmentation_2D(track, field_in, method="watershed", **kwargs)

0 comments on commit 43fd4b7

Please sign in to comment.