Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated arguments from astropy.stats #12200

Merged
merged 1 commit into from Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions astropy/stats/funcs.py
Expand Up @@ -14,7 +14,6 @@
import numpy as np

import astropy.units as u
from astropy.utils.decorators import deprecated_renamed_argument
from . import _stats

__all__ = ['gaussian_fwhm_to_sigma', 'gaussian_sigma_to_fwhm',
Expand Down Expand Up @@ -88,7 +87,6 @@ def _expand_dims(data, axis):
return data.reshape(shape)


@deprecated_renamed_argument('conf', 'confidence_level', '4.0')
def binom_conf_interval(k, n, confidence_level=0.68269, interval='wilson'):
r"""Binomial proportion confidence interval given k successes,
n trials.
Expand Down Expand Up @@ -316,7 +314,6 @@ def binom_conf_interval(k, n, confidence_level=0.68269, interval='wilson'):
return conf_interval


@deprecated_renamed_argument('conf', 'confidence_level', '4.0')
def binned_binom_proportion(x, success, bins=10, range=None,
confidence_level=0.68269, interval='wilson'):
"""Binomial proportion and confidence interval in bins of a continuous
Expand Down Expand Up @@ -506,7 +503,6 @@ def _check_poisson_conf_inputs(sigma, background, confidence_level, name):
raise ValueError(f"confidence_level not supported for interval {name}")


@deprecated_renamed_argument('conflevel', 'confidence_level', '4.0')
def poisson_conf_interval(n, interval='root-n', sigma=1, background=0,
confidence_level=None):
r"""Poisson parameter confidence interval given observed counts
Expand Down
3 changes: 0 additions & 3 deletions astropy/stats/jackknife.py
Expand Up @@ -2,8 +2,6 @@

import numpy as np

from astropy.utils.decorators import deprecated_renamed_argument

__all__ = ['jackknife_resampling', 'jackknife_stats']
__doctest_requires__ = {'jackknife_stats': ['scipy']}

Expand Down Expand Up @@ -54,7 +52,6 @@ def jackknife_resampling(data):
return resamples


@deprecated_renamed_argument('conf_lvl', 'confidence_level', '4.0')
def jackknife_stats(data, statistic, confidence_level=0.95):
"""Performs jackknife estimation on the basis of jackknife resamples.

Expand Down
16 changes: 3 additions & 13 deletions astropy/stats/tests/test_funcs.py
Expand Up @@ -9,7 +9,6 @@

from astropy.stats import funcs
from astropy import units as u
from astropy.utils.exceptions import AstropyDeprecationWarning
from astropy.utils.misc import NumpyRNGContext


Expand Down Expand Up @@ -160,13 +159,6 @@ def test_binom_conf_interval():
[0.36941, 0.52650, 0.65085, 0.75513, 0.84298]])
assert_allclose(result, table, atol=1.e-3, rtol=0.)

# Test scalar version
with pytest.warns(AstropyDeprecationWarning):
result = np.array([funcs.binom_conf_interval(kval, n, conf=conf,
interval='flat')
for kval in k]).transpose()
assert_allclose(result, table, atol=1.e-3, rtol=0.)

# Test Wald interval
result = funcs.binom_conf_interval(0, 5, interval='wald')
assert_allclose(result, 0.) # conf interval is [0, 0] when k = 0
Expand Down Expand Up @@ -233,8 +225,7 @@ def test_binned_binom_proportion():

def test_binned_binom_proportion_exception():
with pytest.raises(ValueError):
with pytest.warns(AstropyDeprecationWarning):
funcs.binned_binom_proportion([0], [1, 2], conf=0.75)
funcs.binned_binom_proportion([0], [1, 2], confidence_level=0.75)


def test_signal_to_noise_oir_ccd():
Expand Down Expand Up @@ -677,9 +668,8 @@ def test_poisson_conf_kbn_value_errors():
@pytest.mark.skipif('HAS_SCIPY or HAS_MPMATH')
def test_poisson_limit_nodependencies():
with pytest.raises(ImportError):
with pytest.warns(AstropyDeprecationWarning):
funcs.poisson_conf_interval(20, interval='kraft-burrows-nousek',
background=10., conflevel=.95)
funcs.poisson_conf_interval(20, interval='kraft-burrows-nousek',
background=10., confidence_level=.95)


@pytest.mark.skipif('not HAS_SCIPY')
Expand Down
5 changes: 0 additions & 5 deletions astropy/stats/tests/test_jackknife.py
Expand Up @@ -5,7 +5,6 @@
from numpy.testing import assert_equal, assert_allclose

from astropy.stats.jackknife import jackknife_resampling, jackknife_stats
from astropy.utils.exceptions import AstropyDeprecationWarning
from astropy.utils.compat.optional_deps import HAS_SCIPY # noqa


Expand Down Expand Up @@ -51,9 +50,5 @@ def mle_var(x): return np.sum((x - np.mean(x))*(x - np.mean(x)))/len(x)


def test_jackknife_stats_exceptions():
with pytest.raises(ValueError):
with pytest.warns(AstropyDeprecationWarning):
jackknife_stats(np.array([]), np.mean, conf_lvl=0.9)

with pytest.raises(ValueError):
jackknife_stats(np.arange(2), np.mean, confidence_level=42)
6 changes: 6 additions & 0 deletions docs/changes/stats/12200.api.rst
@@ -0,0 +1,6 @@
Removed the following deprecated features from ``astropy.stats``:

* ``conf`` argument for ``funcs.binom_conf_interval()`` and
``funcs.binned_binom_proportion()``,
* ``conflevel`` argument for ``funcs.poisson_conf_interval()``, and
* ``conf_lvl`` argument for ``jackknife.jackknife_stats()``.