5555 base , "addContribution" , "add_contribution" , removal_version
5656)
5757
58+ pushfithook_dep_msg = build_deprecation_message (
59+ base , "pushFitHook" , "push_fit_hook" , removal_version
60+ )
61+
62+ popfithook_dep_msg = build_deprecation_message (
63+ base , "popFitHook" , "pop_fit_hook" , removal_version
64+ )
65+
66+ getfithooks_dep_msg = build_deprecation_message (
67+ base , "getFitHooks" , "get_fit_hooks" , removal_version
68+ )
69+
70+ clearfithooks_dep_msg = build_deprecation_message (
71+ base , "clearFitHooks" , "clear_fit_hooks" , removal_version
72+ )
73+
74+ setweight_dep_msg = build_deprecation_message (
75+ base , "setWeight" , "set_weight" , removal_version
76+ )
77+
5878
5979class FitRecipe (_fitrecipe_interface , RecipeOrganizer ):
6080 """FitRecipe class.
@@ -191,7 +211,7 @@ def __init__(self, name="fit"):
191211 }
192212 return
193213
194- def pushFitHook (self , fithook , index = None ):
214+ def push_fit_hook (self , fithook , index = None ):
195215 """Add a FitHook to be called within the residual method.
196216
197217 The hook is an object for reporting updates, or more fundamentally,
@@ -214,7 +234,17 @@ def pushFitHook(self, fithook, index=None):
214234 self ._update_configuration ()
215235 return
216236
217- def popFitHook (self , fithook = None , index = - 1 ):
237+ @deprecated (pushfithook_dep_msg )
238+ def pushFitHook (self , fithook , index = None ):
239+ """This function has been deprecated and will be removed in version
240+ 4.0.0.
241+
242+ Please use diffpy.srfit.fitbase.FitRecipe.push_fit_hook instead.
243+ """
244+ self .push_fit_hook (fithook , index )
245+ return
246+
247+ def pop_fit_hook (self , fithook = None , index = - 1 ):
218248 """Remove a FitHook by index or reference.
219249
220250 Attributes
@@ -236,15 +266,42 @@ def popFitHook(self, fithook=None, index=-1):
236266 self .fithook .remove (index )
237267 return
238268
239- def getFitHooks (self ):
269+ @deprecated (popfithook_dep_msg )
270+ def popFitHook (self , fithook = None , index = - 1 ):
271+ """This function has been deprecated and will be removed in version
272+ 4.0.0.
273+
274+ Please use diffpy.srfit.fitbase.FitRecipe.pop_fit_hook instead.
275+ """
276+ self .pop_fit_hook (fithook , index )
277+ return
278+
279+ def get_fit_hooks (self ):
240280 """Get the sequence of FitHook instances."""
241281 return self .fithooks [:]
242282
243- def clearFitHooks (self ):
283+ @deprecated (getfithooks_dep_msg )
284+ def getFitHooks (self ):
285+ """This function has been deprecated and will be removed in version
286+ 4.0.0.
287+
288+ Please use diffpy.srfit.fitbase.FitRecipe.get_fit_hooks instead."""
289+ return self .get_fit_hooks ()
290+
291+ def clear_fit_hooks (self ):
244292 """Clear the FitHook sequence."""
245293 del self .fithooks [:]
246294 return
247295
296+ @deprecated (clearfithooks_dep_msg )
297+ def clearFitHooks (self ):
298+ """This function has been deprecated and will be removed in version
299+ 4.0.0.
300+
301+ Please use diffpy.srfit.fitbase.FitRecipe.clear_fit_hooks instead."""
302+ self .clear_fit_hooks ()
303+ return
304+
248305 def add_contribution (self , con , weight = 1.0 ):
249306 """Add a FitContribution to the FitRecipe.
250307
@@ -273,12 +330,21 @@ def addContribution(self, con, weight=1.0):
273330 self .add_contribution (con , weight )
274331 return
275332
276- def setWeight (self , con , weight ):
333+ def set_weight (self , con , weight ):
277334 """Set the weight of a FitContribution."""
278335 idx = list (self ._contributions .values ()).index (con )
279336 self ._weights [idx ] = weight
280337 return
281338
339+ @deprecated (setweight_dep_msg )
340+ def setWeight (self , con , weight ):
341+ """This function has been deprecated and will be removed in version
342+ 4.0.0.
343+
344+ Please use diffpy.srfit.fitbase.FitRecipe.set_weight instead."""
345+ self .set_weight (con , weight )
346+ return
347+
282348 def addParameterSet (self , parset ):
283349 """Add a ParameterSet to the hierarchy.
284350
0 commit comments