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 point_mass_gravity function #310

Merged
merged 2 commits into from
May 23, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion harmonica/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .equivalent_sources.cartesian import EQLHarmonic, EquivalentSources
from .equivalent_sources.gradient_boosted import EquivalentSourcesGB
from .equivalent_sources.spherical import EQLHarmonicSpherical, EquivalentSourcesSph
from .forward.point import point_gravity, point_mass_gravity
from .forward.point import point_gravity
from .forward.prism import prism_gravity
from .forward.prism_layer import DatasetAccessorPrismLayer, prism_layer
from .forward.tesseroid import tesseroid_gravity
Expand Down
32 changes: 0 additions & 32 deletions harmonica/forward/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""
Forward modelling for point masses
"""
import warnings

import numpy as np
from numba import jit, prange
Expand Down Expand Up @@ -227,37 +226,6 @@ def point_gravity(
return result.reshape(cast.shape)


def point_mass_gravity(
coordinates,
points,
masses,
field,
coordinate_system="cartesian",
parallel=True,
dtype="float64",
):
"""
DEPRECATED. Use :func:`harmonica.point_gravity` instead.

This function exists to support backward compatibility until next release.
"""
warnings.warn(
"The 'point_mass_gravity' function has been renamed to 'point_gravity' "
+ "and will be deprecated on the next release, "
+ "please use 'point_gravity' instead.",
FutureWarning,
)
return point_gravity(
coordinates=coordinates,
points=points,
masses=masses,
field=field,
coordinate_system=coordinate_system,
parallel=parallel,
dtype=dtype,
)


def dispatcher(coordinate_system, parallel):
"""
Return the appropriate forward model function
Expand Down
19 changes: 1 addition & 18 deletions harmonica/tests/test_point_gravity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
Test forward modelling for point masses.
"""
import os
import warnings
from pathlib import Path

import numpy as np
Expand All @@ -17,7 +16,7 @@
import verde as vd

from ..constants import GRAVITATIONAL_CONST
from ..forward.point import point_gravity, point_mass_gravity
from ..forward.point import point_gravity
from ..forward.utils import distance_cartesian
from .utils import run_only_with_numba

Expand Down Expand Up @@ -133,22 +132,6 @@ def test_potential_cartesian_known_values(point_mass, sample_coordinates_potenti
npt.assert_allclose(results, precomputed_potential)


@pytest.mark.use_numba
def test_point_mass_gravity_deprecated(point_mass, sample_coordinates_potential):
"""
Test the soon-to-be-deprecated point_mass_gravity function
"""
point, mass = point_mass[:]
coordinates = sample_coordinates_potential[:3]
precomputed_potential = sample_coordinates_potential[-1]
# Check if a FutureWarning is raised
with warnings.catch_warnings(record=True) as warn:
results = point_mass_gravity(coordinates, point, mass, "potential", "cartesian")
assert len(warn) == 1
assert issubclass(warn[-1].category, FutureWarning)
npt.assert_allclose(results, precomputed_potential)


@pytest.mark.use_numba
def test_potential_symmetry_cartesian():
"""
Expand Down