Skip to content

Commit

Permalink
deprecate AutoMBAR (PR #285)
Browse files Browse the repository at this point in the history
- fix #284
- Deprecate AutoMBAR (for removal in 2.0.0)
- test DeprecationWarning
- silence this warning otherwise
- update docs
- update CHANGES
  • Loading branch information
xiki-tempula committed Dec 10, 2022
1 parent 98487f8 commit a893769
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Fixes
there are no spaces around the equal sign (issue #272, PR #273).
- Pre-processing function slicing will not drop NaN rows (issue
#274, PR #275).

Deprecations
- deprecate AutoMBAR for removal in 2.0 because pymbar 4 already contains
equivalent functionality (issue #284, PR #285).

Internal Enhancements (do not affect API)
- Blackfy the codebase (PR #280).
Expand Down
8 changes: 8 additions & 0 deletions src/alchemlyb/estimators/mbar_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from warnings import warn

import pandas as pd
import pymbar
Expand Down Expand Up @@ -200,6 +201,9 @@ class AutoMBAR(MBAR):
.. versionadded:: 0.6.0
.. versionchanged:: 1.0.0
AutoMBAR accepts the `method` argument.
.. deprecated:: 1.0.1
Deprecate AutoMBAR in favour of MBAR for pymbar4. It will be removed
in alchemlyb 2.0.0.
"""

def __init__(
Expand All @@ -210,6 +214,10 @@ def __init__(
verbose=False,
method=None,
):
warn(
"From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR.",
DeprecationWarning,
)
super().__init__(
maximum_iterations=maximum_iterations,
relative_tolerance=relative_tolerance,
Expand Down
3 changes: 3 additions & 0 deletions src/alchemlyb/tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pytest]
filterwarnings =
ignore:From version 2.0.0, this will be replaced by the default alchemlyb.estimators.MBAR.:DeprecationWarning:
4 changes: 4 additions & 0 deletions src/alchemlyb/tests/test_fep_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def test_mbar(self, X_delta_f):
class TestAutoMBAR(TestMBAR):
cls = AutoMBAR

def test_autombar(self, X_delta_f):
with pytest.deprecated_call():
self.compare_delta_f(X_delta_f)


class TestMBAR_fail:
def test_failback_adaptive(self, gmx_ABFE_complex_n_uk):
Expand Down

0 comments on commit a893769

Please sign in to comment.