Skip to content

Commit 91a2ef4

Browse files
committed
boundsToRestraints deprecation
1 parent 2985fbd commit 91a2ef4

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/diffpy/srfit/fitbase/fitrecipe.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@
119119
base, "getBounds2", "get_bounds_array", removal_version
120120
)
121121

122+
boundsToRestraints_dep_msg = build_deprecation_message(
123+
base, "boundsToRestraints", "convert_bounds_to_restraints", removal_version
124+
)
125+
122126

123127
class FitRecipe(_fitrecipe_interface, RecipeOrganizer):
124128
"""FitRecipe class.
@@ -1420,7 +1424,7 @@ def plot_recipe(self, ax=None, return_fig=False, **kwargs):
14201424
else:
14211425
return figures, axes_list
14221426

1423-
def boundsToRestraints(self, sig=1, scaled=False):
1427+
def convert_bounds_to_restraints(self, sig=1, scaled=False):
14241428
"""Turn all bounded parameters into restraints.
14251429
14261430
The bounds become limits on the restraint.
@@ -1442,6 +1446,17 @@ def boundsToRestraints(self, sig=1, scaled=False):
14421446
)
14431447
return
14441448

1449+
@deprecated(boundsToRestraints_dep_msg)
1450+
def boundsToRestraints(self, sig=1, scaled=False):
1451+
"""This function has been deprecated and will be removed in version
1452+
4.0.0.
1453+
1454+
Please use diffpy.srfit.fitbase.FitRecipe.convert_bounds_to_restraints
1455+
instead.
1456+
"""
1457+
self.convert_bounds_to_restraints(sig, scaled)
1458+
return
1459+
14451460
def _apply_values(self, p):
14461461
"""Apply variable values to the variables."""
14471462
if len(p) == 0:

src/diffpy/srfit/fitbase/parameter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Parameter(_parameter_interface, Argument, Validatable):
5555
bounds
5656
A 2-list defining the bounds on the Parameter. This can be
5757
used by some optimizers when the Parameter is varied. See
58-
FitRecipe.get_bounds_pairs and FitRecipe.boundsToRestraints.
58+
FitRecipe.get_bounds_pairs and FitRecipe.convert_bounds_to_restraints.
5959
"""
6060

6161
def __init__(self, name, value=None, const=False):
@@ -239,7 +239,7 @@ def bounds(self):
239239
240240
This can be used by some optimizers when the Parameter is
241241
varied. See FitRecipe.get_bounds_pairs and
242-
FitRecipe.boundsToRestraints.
242+
FitRecipe.convert_bounds_to_restraints.
243243
"""
244244
return self.par.bounds
245245

0 commit comments

Comments
 (0)