@@ -29,16 +29,16 @@ class PDFAdapter:
2929
3030 Methods
3131 -------
32- init_profile (profile_path, qmin=None, qmax=None, xmin=None, xmax=None, dx=None)
32+ initialize_profile (profile_path, qmin=None, qmax=None, xmin=None, xmax=None, dx=None)
3333 Load and initialize the PDF profile from the given file path with
3434 some optional parameters.
35- init_structures (structure_paths : list[str], run_parallel=True)
35+ initialize_structures (structure_paths : list[str], run_parallel=True)
3636 Load and initialize the structures from the given file paths, and
3737 generate corresponding PDFGenerator objects.
38- init_contribution (equation_string=None)
38+ initialize_contribution (equation_string=None)
3939 Initialize the FitContribution object combining the PDF generators and
4040 the profile.
41- init_recipe ()
41+ initialize_recipe ()
4242 Initialize the FitRecipe object for the fitting process.
4343 set_initial_variable_values(variable_name_to_value : dict)
4444 Update parameter values from the provided dictionary.
@@ -54,7 +54,7 @@ def __init__(self):
5454 self .intermediate_results = {}
5555 self .iter_count = 0
5656
57- def moniter_intermediate_results (
57+ def monitor_intermediate_results (
5858 self , key : str , step : int = 10 , queue : Queue = None
5959 ):
6060 """Store an intermediate result during the fitting process.
@@ -72,7 +72,7 @@ def moniter_intermediate_results(
7272 queue = Queue ()
7373 self .intermediate_results [(key , step )] = queue
7474
75- def init_profile (
75+ def initialize_profile (
7676 self ,
7777 profile_path : str ,
7878 qmin = None ,
@@ -119,15 +119,17 @@ def init_profile(
119119 profile .setCalculationRange (xmin = xmin , xmax = xmax , dx = dx )
120120 self .profile = profile
121121
122- def init_structures (self , structure_paths : list [str ], run_parallel = True ):
122+ def initialize_structures (
123+ self , structure_paths : list [str ], run_parallel = True
124+ ):
123125 """Load and initialize the structures from the given file paths,
124126 and generate corresponding PDFGenerator objects.
125127
126128 The target output, FitRecipe, requires a profile object, multiple
127129 PDFGenerator objects, and a FitContribution object combining them. This
128130 method creates the PDFGenerator objects from the structure files.
129131
130- Must be called after init_profile .
132+ Must be called after initialize_profile .
131133
132134 Parameters
133135 ----------
@@ -182,7 +184,7 @@ def init_structures(self, structure_paths: list[str], run_parallel=True):
182184 self .spacegroups = spacegroups
183185 self .pdfgenerators = pdfgenerators
184186
185- def init_contribution (self , equation_string = None ):
187+ def initialize_contribution (self , equation_string = None ):
186188 """Initialize the FitContribution object combining the PDF
187189 generators and the profile.
188190
@@ -191,7 +193,7 @@ def init_contribution(self, equation_string=None):
191193 method creates the FitContribution object combining the profile and PDF
192194 generators.
193195
194- Must be called after init_profile and init_structures .
196+ Must be called after initialize_profile and initialize_structures .
195197
196198 Parameters
197199 ----------
@@ -230,7 +232,7 @@ def init_contribution(self, equation_string=None):
230232 self .contribution = contribution
231233 return self .contribution
232234
233- def init_recipe (
235+ def initialize_recipe (
234236 self ,
235237 ):
236238 """Initialize the FitRecipe object for the fitting process.
@@ -240,7 +242,7 @@ def init_recipe(
240242 method creates the FitRecipe object combining the profile, PDF
241243 generators, and contribution.
242244
243- Must be called after init_contribution .
245+ Must be called after initialize_contribution .
244246
245247 Notes
246248 -----
@@ -311,17 +313,18 @@ def residual(self, p=[]):
311313 The residual array.
312314 """
313315 residual = self .recipe .residual (p )
314- fitresults = FitResults (self .recipe )
315- for (key , step ), values in self .intermediate_results .items ():
316- if (self .iter_count % step ) == 0 :
317- value = getattr (fitresults , key )
318- values .put (value )
316+ if self .intermediate_results is not None :
317+ fitresults = FitResults (self .recipe )
318+ for (key , step ), values in self .intermediate_results .items ():
319+ if (self .iter_count % step ) == 0 :
320+ value = getattr (fitresults , key )
321+ values .put (value )
319322 self .iter_count += 1
320323 return residual
321324
322325 def refine_variables (self , variable_names : list [str ]):
323326 """Refine the parameters specified in the list and in that
324- order. Must be called after init_recipe .
327+ order. Must be called after initialize_recipe .
325328
326329 Parameters
327330 ----------
@@ -357,7 +360,7 @@ def save_results(
357360 self , mode : Literal ["str" , "dict" ] = "str" , filename = None
358361 ):
359362 """Save the fitting results. Must be called after
360- refine_parameters .
363+ refine_variables .
361364
362365 Parameters
363366 ----------
0 commit comments