Skip to content

Commit cbbddf5

Browse files
committed
boundWindow --> bound_window
1 parent 35ada98 commit cbbddf5

1 file changed

Lines changed: 27 additions & 13 deletions

File tree

src/diffpy/srfit/fitbase/parameter.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
parameter_base, "boundRange", "bound_range", removal_version
5151
)
5252

53+
boundWindow_dep_msg = build_deprecation_message(
54+
parameter_base, "boundWindow", "bound_window", removal_version
55+
)
56+
5357

5458
class Parameter(_parameter_interface, Argument, Validatable):
5559
"""Parameter class.
@@ -191,32 +195,42 @@ def boundRange(self, lower_bound=None, upper_bound=None):
191195
self.bound_range(lower_bound, upper_bound)
192196
return self
193197

194-
def boundWindow(self, lr=0, ur=None):
198+
def bound_window(self, lower_radius=0, upper_radius=None):
195199
"""Create bounds centered on the current value of the Parameter.
196200
197201
Parameters
198202
----------
199-
lr
203+
lower_radius : float, optional
200204
The radius of the lower bound (default 0). The lower bound is
201-
computed as value - lr.
202-
ur
205+
computed as value - lower_radius.
206+
upper_radius : float, optional
203207
The radius of the upper bound. The upper bound is computed as
204-
value + ur. If this is None (default), then the value of the
205-
lower radius is used.
208+
value + upper_radius. If this is None (default), then the value
209+
of the lower radius is used.
206210
207211
Returns
208212
-------
209213
self
210214
Returns self so that mutators can be chained.
211215
"""
212216
val = self.getValue()
213-
lower_bound = val - lr
214-
if ur is None:
215-
ur = lr
216-
upper_bound = val + ur
217+
lower_bound = val - lower_radius
218+
if upper_radius is None:
219+
upper_radius = lower_radius
220+
upper_bound = val + upper_radius
217221
self.bounds = [lower_bound, upper_bound]
218222
return self
219223

224+
@deprecated(boundWindow_dep_msg)
225+
def boundWindow(self, lr=0, ur=None):
226+
"""This function has been deprecated and will be removed in
227+
version 4.0.0.
228+
229+
Please use diffpy.srfit.fitbase.Parameter.bound_window instead.
230+
"""
231+
self.bound_window(lr, ur)
232+
return self
233+
220234
def _validate(self):
221235
"""Validate my state.
222236
@@ -314,9 +328,9 @@ def set_constant(self, const=True, value=None):
314328
def bound_range(self, lower_bound=None, upper_bound=None):
315329
return self.par.bound_range(lower_bound, upper_bound)
316330

317-
@wraps(Parameter.boundWindow)
318-
def boundWindow(self, lr=0, ur=None):
319-
return self.par.boundWindow(lr, ur)
331+
@wraps(Parameter.bound_window)
332+
def bound_window(self, lr=0, ur=None):
333+
return self.par.bound_window(lr, ur)
320334

321335
def _validate(self):
322336
"""Validate my state.

0 commit comments

Comments
 (0)