Skip to content

Commit

Permalink
Merge pull request #2855 from swryan/2759_interp
Browse files Browse the repository at this point in the history
Remove deprecated names for Akima1D and trilinear interpolants
  • Loading branch information
swryan committed Mar 16, 2023
2 parents 1923148 + b2d0fc3 commit cb27f67
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 40 deletions.
9 changes: 1 addition & 8 deletions openmdao/components/interp_util/interp.py
Expand Up @@ -41,14 +41,11 @@
'1D-lagrange3': Interp1DLagrange3,
'2D-lagrange3': Interp2DLagrange3,
'3D-lagrange3': Interp3DLagrange3,
'1D-akima': Interp1DAkima,
'trilinear': Interp3DSlinear, # Deprecated
'akima1D': Interp1DAkima, # Deprecated
'1D-akima': Interp1DAkima
}

TABLE_METHODS = ['slinear', 'lagrange2', 'lagrange3', 'cubic', 'akima',
'scipy_cubic', 'scipy_slinear', 'scipy_quintic',
'trilinear', 'akima1D', # These two are Deprecated
'3D-slinear', '2D-slinear', '1D-slinear',
'1D-akima',
'3D-lagrange2', '2D-lagrange2', '1D-lagrange2',
Expand Down Expand Up @@ -144,10 +141,6 @@ def __init__(self, method="slinear", points=None, values=None, x_interp=None, ex
all_m = ', '.join(['"' + m + '"' for m in INTERP_METHODS])
raise ValueError('Interpolation method "%s" is not defined. Valid methods are '
'%s.' % (method, all_m))
elif method == 'akima1D':
warn_deprecation("The 'akima1D' method has been renamed to '1D-akima'.")
elif method == 'trilinear':
warn_deprecation("The 'trilinear' method has been renamed to '3D-slinear'.")

self.extrapolate = extrapolate

Expand Down
27 changes: 0 additions & 27 deletions openmdao/components/interp_util/tests/test_interp_nd.py
Expand Up @@ -1283,33 +1283,6 @@ def test_3Dlagrange3(self):
assert_near_equal(f, f_base[j], 2e-10)
assert_near_equal(df_dx[0], df_dx_base[j, :], 2e-10)

def test_deprecated_methods(self):

p1 = np.linspace(0, 100, 5)
p2 = np.linspace(-10, 10, 3)
p3 = np.linspace(0, 1, 3)

# can use meshgrid to create a 3D array of test data
P1, P2, P3 = np.meshgrid(p1, p2, p3, indexing='ij')
f_p = np.sqrt(P1) + P2 * P3

x1 = np.linspace(-2, 101, 5)
x2 = np.linspace(-10.5, 11, 5)
x3 = np.linspace(-0.2, 1.1, 5)
X1, X2, X3 = np.meshgrid(x1, x2, x3, indexing='ij')
x = np.zeros((125, 3))
x[:, 0] = X1.ravel()
x[:, 1] = X2.ravel()
x[:, 2] = X3.ravel()

msg = "The 'trilinear' method has been renamed to '3D-slinear'."
with assert_warning(OMDeprecationWarning, msg):
InterpND(points=(p1, p2, p3), values=f_p, method='trilinear', extrapolate=True)

msg = "The 'akima1D' method has been renamed to '1D-akima'."
with assert_warning(OMDeprecationWarning, msg):
InterpND(points=p1, values=p1, method='akima1D')


if __name__ == '__main__':
unittest.main()
5 changes: 0 additions & 5 deletions openmdao/components/tests/test_meta_model_structured_comp.py
Expand Up @@ -1304,11 +1304,6 @@ def test_vectorized_3D_lagrange3(self):
# Derivatives have large magniudes, so tols are high.
assert_check_totals(totals, atol=1e3, rtol=1e-4)

def test_deprecated(self):
# Make sure deprecated methods are still in the table_methods list.
om.MetaModelStructuredComp(method='trilinear')
om.MetaModelStructuredComp(method='akima1D')


@use_tempdirs
@unittest.skipIf(not scipy_gte_019, "only run if scipy>=0.19.")
Expand Down

0 comments on commit cb27f67

Please sign in to comment.