Commit 37306ffc authored by Unknown's avatar Unknown
Browse files

Model/Optimize bugfix

Pop objective function argument dictionary entries when setting up Optimize
Copy objective function argument dictionary to Optimize to prevent errors when fitting in multiple stages.
parent 1724572d
......@@ -44,7 +44,6 @@ class Fit_Methods(object):
if guess.size < 4:
raise ValueError('Error: The Single Harmonic Oscillator requires 4 parameter guesses!')
# data_vec, guess = args
data_mean = np.mean(data_vec)
Amp, w_0, Q, phi = guess[:4]
......
......@@ -358,7 +358,7 @@ class Model(object):
while self.data is not None:
opt = Optimize(data=self.data, guess=self.guess, parallel=self._parallel)
temp = opt.computeFit(processors=processors, solver_type=solver_type, solver_options=solver_options,
obj_func=obj_func)
obj_func=obj_func.copy())
# TODO: need a different .reformatResults to process fitting results
results.append(self._reformat_results(temp, obj_func_name))
self._get_guess_chunk()
......
......@@ -117,9 +117,9 @@ class Optimize(object):
if obj_func['class'] is None:
self.obj_func = obj_func['obj_func']
else:
self.obj_func_name = obj_func.get('obj_func')
self.obj_func_name = obj_func.pop('obj_func')
self.obj_func = fm.__getattribute__(self.obj_func_name)
self.obj_func_class = obj_func.get('class')
self.obj_func_class = obj_func.pop('class')
self.obj_func_args = obj_func.values()
def computeFit(self, processors=1, solver_type='least_squares', solver_options={},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment