Skip to content

Commit 71b8b4f

Browse files
committed
getBounds2 deprecation
1 parent ba3bc20 commit 71b8b4f

1 file changed

Lines changed: 28 additions & 8 deletions

File tree

src/diffpy/srfit/fitbase/fitrecipe.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
base, "getBounds", "get_bounds_pairs", removal_version
116116
)
117117

118+
getBounds2_dep_msg = build_deprecation_message(
119+
base, "getBounds2", "get_bounds_array", removal_version
120+
)
121+
118122

119123
class FitRecipe(_fitrecipe_interface, RecipeOrganizer):
120124
"""FitRecipe class.
@@ -178,7 +182,7 @@ class FitRecipe(_fitrecipe_interface, RecipeOrganizer):
178182
bounds
179183
Bounds on parameters (read only). See get_bounds_pairs.
180184
bounds2
181-
Bounds on parameters (read only). See getBounds2.
185+
Bounds on parameters (read only). See get_bounds_array.
182186
"""
183187

184188
fixednames = property(
@@ -200,7 +204,7 @@ class FitRecipe(_fitrecipe_interface, RecipeOrganizer):
200204
doc="values of the fixed refinable variables",
201205
)
202206
bounds = property(lambda self: self.get_bounds_pairs())
203-
bounds2 = property(lambda self: self.getBounds2())
207+
bounds2 = property(lambda self: self.get_bounds_array())
204208

205209
def __init__(self, name="fit"):
206210
"""Initialization."""
@@ -1106,15 +1110,31 @@ def getBounds(self):
11061110
"""
11071111
return self.get_bounds_pairs()
11081112

1109-
def getBounds2(self):
1110-
"""Get the bounds on variables in two lists.
1113+
def get_bounds_array(self):
1114+
"""Get the bounds on variables in two numpy arrays.
11111115
1112-
Returns lower- and upper-bound lists of variable bounds.
1116+
Returns
1117+
-------
1118+
lower_bounds : numpy.ndarray
1119+
A numpy array of lower bounds on the variables, in the same order
1120+
as ``get_names`` and ``get_values``.
1121+
upper_bounds : numpy.ndarray
1122+
A numpy array of upper bounds on the variables, in the same order
1123+
as ``get_names`` and ``get_values``.
11131124
"""
11141125
bounds = self.get_bounds_pairs()
1115-
lb = array([b[0] for b in bounds])
1116-
ub = array([b[1] for b in bounds])
1117-
return lb, ub
1126+
lower_bounds = array([b[0] for b in bounds])
1127+
upper_bounds = array([b[1] for b in bounds])
1128+
return lower_bounds, upper_bounds
1129+
1130+
@deprecated(getBounds2_dep_msg)
1131+
def getBounds2(self):
1132+
"""This function has been deprecated and will be removed in version
1133+
4.0.0.
1134+
1135+
Please use diffpy.srfit.fitbase.FitRecipe.get_bounds_array instead.
1136+
"""
1137+
return self.get_bounds_array()
11181138

11191139
def set_plot_defaults(self, **kwargs):
11201140
"""Set default plotting options for all future plots.

0 commit comments

Comments
 (0)