diff --git a/HISTORY.txt b/HISTORY.txt index c75951f2a..a3acdce10 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -23,6 +23,14 @@ v1.9.0 (XXXX-XX-XX) - Don't fail when writing a (fixed) configuration file, instead just warn. +- Removed the deprecated galpy.util.bovy_coords, galpy.util.bovy_plot, and + galpy.util.bovy_conversion modules. These were replaced by galpy.util.coords, + galpy.util.plot, and galpy.util.conversion in v1.7. + +- Removed the deprecated phiforce method from potentials and the accompanying + evaluatephiforces and evaluateplanarphiforces potential functions. These were replaced + by phitorque, evaluatephitorques, and evaluateplanarphitorques in v1.8.0. + - Switched to using Python 3.11 as the default Python version in the test suite. v1.8.3 (2023-03-27) diff --git a/galpy/potential/Potential.py b/galpy/potential/Potential.py index c666f48c1..81cd7b063 100644 --- a/galpy/potential/Potential.py +++ b/galpy/potential/Potential.py @@ -16,7 +16,6 @@ import os import os.path import pickle -import warnings from functools import wraps import numpy @@ -762,13 +761,6 @@ def normalize(self, norm): """ self._amp *= norm / numpy.fabs(self.Rforce(1.0, 0.0, use_physical=False)) - def phiforce(self, R, z, phi=0.0, t=0.0): - warnings.warn( - "phiforce has been renamed phitorque, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component", - FutureWarning, - ) - return self.phitorque(R, z, phi=phi, t=t) - @potential_physical_input @physical_conversion("energy", pop=True) def phitorque(self, R, z, phi=0.0, t=0.0): @@ -2405,15 +2397,6 @@ def _evaluateRforces(Pot, R, z, phi=None, t=0.0, v=None): ) -@potential_positional_arg -def evaluatephiforces(Pot, R, z, phi=None, t=0.0, v=None): - warnings.warn( - "evaluatephiforces has been renamed evaluatephitorques, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component", - FutureWarning, - ) - return evaluatephitorques(Pot, R, z, phi=phi, t=t, v=v) - - @potential_positional_arg @potential_physical_input @physical_conversion("energy", pop=True) diff --git a/galpy/potential/__init__.py b/galpy/potential/__init__.py index d43b7ed04..3fae65fae 100644 --- a/galpy/potential/__init__.py +++ b/galpy/potential/__init__.py @@ -71,7 +71,6 @@ mass = Potential.mass evaluateRforces = Potential.evaluateRforces evaluatephitorques = Potential.evaluatephitorques -evaluatephiforces = Potential.evaluatephiforces evaluatezforces = Potential.evaluatezforces evaluaterforces = Potential.evaluaterforces evaluateR2derivs = Potential.evaluateR2derivs @@ -108,7 +107,6 @@ evaluateplanarRforces = planarPotential.evaluateplanarRforces evaluateplanarR2derivs = planarPotential.evaluateplanarR2derivs evaluateplanarphitorques = planarPotential.evaluateplanarphitorques -evaluateplanarphiforces = planarPotential.evaluateplanarphiforces evaluatelinearPotentials = linearPotential.evaluatelinearPotentials evaluatelinearForces = linearPotential.evaluatelinearForces PotentialError = Potential.PotentialError diff --git a/galpy/potential/planarPotential.py b/galpy/potential/planarPotential.py index bc294e6d6..e2f3b9060 100644 --- a/galpy/potential/planarPotential.py +++ b/galpy/potential/planarPotential.py @@ -1,6 +1,5 @@ import os import pickle -import warnings import numpy from scipy import integrate @@ -126,13 +125,6 @@ def _Rforce_nodecorator(self, R, phi=0.0, t=0.0): "'_Rforce' function not implemented for this potential" ) - def phiforce(self, R, phi=0.0, t=0.0): - warnings.warn( - "phiforce has been renamed phitorque, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component", - FutureWarning, - ) - return self.phitorque(R, phi=phi, t=t) - @potential_physical_input @physical_conversion("energy", pop=True) def phitorque(self, R, phi=0.0, t=0.0): @@ -1049,15 +1041,6 @@ def _evaluateplanarRforces(Pot, R, phi=None, t=0.0, v=None): ) -@potential_positional_arg -def evaluateplanarphiforces(Pot, R, phi=None, t=0.0, v=None): - warnings.warn( - "evaluateplanarphiforces has been renamed evaluateplanarphitorques, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component", - FutureWarning, - ) - return evaluateplanarphitorques(Pot, R, phi=phi, t=t, v=None) - - @potential_positional_arg @potential_physical_input @physical_conversion("energy", pop=True) diff --git a/galpy/util/bovy_conversion.py b/galpy/util/bovy_conversion.py deleted file mode 100644 index 44caec668..000000000 --- a/galpy/util/bovy_conversion.py +++ /dev/null @@ -1,20 +0,0 @@ -# renamed to conversion.py -import warnings - -from .conversion import * -from .conversion import ( - _APY_LOADED, - _APY_UNITS, - _G, - _TWOPI, - _CIN10p5KMS, - _EVIN10m19J, - _kmsInPcMyr, - _MyrIn1013Sec, - _PCIN10p18CM, -) - -warnings.warn( - "galpy.util.bovy_conversion is being deprecated in favor of galpy.util.conversion; all functions in there are the same; please switch to the new import, because the old import will be removed in v1.9", - FutureWarning, -) diff --git a/galpy/util/bovy_coords.py b/galpy/util/bovy_coords.py deleted file mode 100644 index 6c52f8a1b..000000000 --- a/galpy/util/bovy_coords.py +++ /dev/null @@ -1,10 +0,0 @@ -# renamed to coords.py -import warnings - -from .coords import * -from .coords import _APY_COORDS, _APY_LOADED, _DEGTORAD, _K, _parse_epoch_frame_apy - -warnings.warn( - "galpy.util.bovy_coords is being deprecated in favor of galpy.util.coords; all functions in there are the same; please switch to the new import, because the old import will be removed in v1.9", - FutureWarning, -) diff --git a/galpy/util/bovy_plot.py b/galpy/util/bovy_plot.py deleted file mode 100644 index b4c8d347c..000000000 --- a/galpy/util/bovy_plot.py +++ /dev/null @@ -1,18 +0,0 @@ -# renamed to plot.py -import warnings - -from .plot import * -from .plot import _DEFAULTNCNTR, _MPL_VERSION, _add_axislabels, _add_ticks - -warnings.warn( - "galpy.util.bovy_plot is being deprecated in favor of galpy.util.plot; functions inside of this module have also changed name, but all functions still exist; please switch to the new import and new function names, because the old import and function names will be removed in v1.9", - FutureWarning, -) -# Old names -bovy_end_print = end_print -bovy_hist = hist -bovy_plot = plot -bovy_plot3d = plot3d -bovy_dens2d = dens2d -bovy_print = start_print -bovy_text = text diff --git a/tests/test_potential.py b/tests/test_potential.py index 0d4e7364a..286444d81 100644 --- a/tests/test_potential.py +++ b/tests/test_potential.py @@ -7313,11 +7313,11 @@ def test_phiforce_deprecation(): # Check that we've removed phiforce in the correct version from packaging.version import parse as parse_version - deprecation_version = parse_version("1.9") + deprecation_version = parse_version("1.8.3") from galpy import __version__ as galpy_version galpy_version = parse_version(galpy_version) - should_be_removed = galpy_version >= deprecation_version + should_be_removed = galpy_version > deprecation_version # Now test lp = potential.LogarithmicHaloPotential() # Method @@ -7335,15 +7335,17 @@ def test_phiforce_deprecation(): raise AssertionError( "phiforce not removed when it was supposed to be removed" ) - raisedWarning = False - for wa in w: - raisedWarning = ( - str(wa.message) - == "phiforce has been renamed phitorque, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component" - ) - if raisedWarning: - break - assert raisedWarning, "phiforce deprecation did not raise the expected warning" + raisedWarning = False + for wa in w: + raisedWarning = ( + str(wa.message) + == "phiforce has been renamed phitorque, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component" + ) + if raisedWarning: + break + assert ( + raisedWarning + ), "phiforce deprecation did not raise the expected warning" # Function with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always", FutureWarning) @@ -7359,15 +7361,17 @@ def test_phiforce_deprecation(): raise AssertionError( "phiforce not removed when it was supposed to be removed" ) - raisedWarning = False - for wa in w: - raisedWarning = ( - str(wa.message) - == "evaluatephiforces has been renamed evaluatephitorques, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component" - ) - if raisedWarning: - break - assert raisedWarning, "phiforce deprecation did not raise the expected warning" + raisedWarning = False + for wa in w: + raisedWarning = ( + str(wa.message) + == "evaluatephiforces has been renamed evaluatephitorques, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component" + ) + if raisedWarning: + break + assert ( + raisedWarning + ), "phiforce deprecation did not raise the expected warning" def test_phiforce_deprecation_2d(): @@ -7377,11 +7381,11 @@ def test_phiforce_deprecation_2d(): # Check that we've removed phiforce in the correct version from packaging.version import parse as parse_version - deprecation_version = parse_version("1.9") + deprecation_version = parse_version("1.8.3") from galpy import __version__ as galpy_version galpy_version = parse_version(galpy_version) - should_be_removed = galpy_version >= deprecation_version + should_be_removed = galpy_version > deprecation_version # Now test lp = potential.LogarithmicHaloPotential().toPlanar() # Method @@ -7399,15 +7403,17 @@ def test_phiforce_deprecation_2d(): raise AssertionError( "phiforce not removed when it was supposed to be removed" ) - raisedWarning = False - for wa in w: - raisedWarning = ( - str(wa.message) - == "phiforce has been renamed phitorque, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component" - ) - if raisedWarning: - break - assert raisedWarning, "phiforce deprecation did not raise the expected warning" + raisedWarning = False + for wa in w: + raisedWarning = ( + str(wa.message) + == "phiforce has been renamed phitorque, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component" + ) + if raisedWarning: + break + assert ( + raisedWarning + ), "phiforce deprecation did not raise the expected warning" # Function with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always", FutureWarning) @@ -7423,15 +7429,17 @@ def test_phiforce_deprecation_2d(): raise AssertionError( "phiforce not removed when it was supposed to be removed" ) - raisedWarning = False - for wa in w: - raisedWarning = ( - str(wa.message) - == "evaluateplanarphiforces has been renamed evaluateplanarphitorques, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component" - ) - if raisedWarning: - break - assert raisedWarning, "phiforce deprecation did not raise the expected warning" + raisedWarning = False + for wa in w: + raisedWarning = ( + str(wa.message) + == "evaluateplanarphiforces has been renamed evaluateplanarphitorques, because it has always really been a torque (per unit mass); please switch to the new method name, because the old name will be removed in v1.9 and may be re-used for the actual phi force component" + ) + if raisedWarning: + break + assert ( + raisedWarning + ), "phiforce deprecation did not raise the expected warning" # Test that Pot is required to be a positional argument for Potential functions @@ -7468,9 +7476,6 @@ def test_potential_Pot_is_positional(): func(Pot=MWPotential2014, R=1.0) assert "required positional argument: 'Pot'" in excinfo.value.args[0] # Special cases - with pytest.raises(TypeError) as excinfo: - potential.evaluatephiforces(Pot=MWPotential2014, R=1.0, z=0.0) - assert "required positional argument: 'Pot'" in excinfo.value.args[0] with pytest.raises(TypeError) as excinfo: potential.lindbladR(Pot=MWPotential2014, OmegaP=1.0) assert "required positional argument: 'Pot'" in excinfo.value.args[0]