forked from IPKM/nmreval
attempt to only show real/imag part of complex fit functions; closes #72
This commit is contained in:
parent
f60e125487
commit
2adf15104f
@ -63,9 +63,19 @@ class FitResultCreator:
|
|||||||
parameters = OrderedDict([(k, v) for k, v in zip(pnames, p)])
|
parameters = OrderedDict([(k, v) for k, v in zip(pnames, p)])
|
||||||
p_final = [p.value for p in parameters.values()]
|
p_final = [p.value for p in parameters.values()]
|
||||||
|
|
||||||
_y = model.func(p_final, _x, **fun_kwargs)
|
|
||||||
resid = model.func(p_final, x_orig, **fun_kwargs) - y_orig
|
resid = model.func(p_final, x_orig, **fun_kwargs) - y_orig
|
||||||
|
|
||||||
|
actual_complex_mode = 0
|
||||||
|
if 'complex_mode' in fun_kwargs:
|
||||||
|
actual_complex_mode = fun_kwargs['complex_mode']
|
||||||
|
fun_kwargs['complex_mode'] = 0
|
||||||
|
|
||||||
|
_y = model.func(p_final, _x, **fun_kwargs)
|
||||||
|
if actual_complex_mode == 1:
|
||||||
|
_y.imag = 0
|
||||||
|
elif actual_complex_mode == 2:
|
||||||
|
_y.real = 0
|
||||||
|
|
||||||
stats = FitResultCreator.calc_statistics(_y, resid, nobs, nvar)
|
stats = FitResultCreator.calc_statistics(_y, resid, nobs, nvar)
|
||||||
varied = [p.var for p in parameters.values()]
|
varied = [p.var for p in parameters.values()]
|
||||||
|
|
||||||
@ -356,7 +366,7 @@ class FitResult(Points):
|
|||||||
|
|
||||||
def with_new_x(self, x_values):
|
def with_new_x(self, x_values):
|
||||||
if self.func is None:
|
if self.func is None:
|
||||||
raise ValueError('no fit function available to calcualate new y values')
|
raise ValueError('no fit function available to calculate new y values')
|
||||||
|
|
||||||
new_fit = self.copy()
|
new_fit = self.copy()
|
||||||
y_values = self.func.func(self.p_final, x_values, **self.fun_kwargs)
|
y_values = self.func.func(self.p_final, x_values, **self.fun_kwargs)
|
||||||
@ -372,4 +382,4 @@ class FitResult(Points):
|
|||||||
else:
|
else:
|
||||||
part_functions.append(Points(x_values, sub_y, name=sub_name))
|
part_functions.append(Points(x_values, sub_y, name=sub_name))
|
||||||
|
|
||||||
return part_functions
|
return part_functions
|
||||||
|
Loading…
Reference in New Issue
Block a user