remove complex kwarg when necessary #246
| @@ -401,7 +401,10 @@ class FitResult(Points): | |||||||
|             raise ValueError('no fit function available to calculate 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) |         fun_kwargs = {k: v for k, v in self.fun_kwargs.items()} | ||||||
|  |         if self.fun_kwargs.get('complex_mode', -1) == -1: | ||||||
|  |             fun_kwargs.pop('complex_mode', None) | ||||||
|  |         y_values = self.func.func(self.p_final, x_values, **fun_kwargs) | ||||||
|         y_values = check_complex(y_values, self.fun_kwargs.get('complex_mode', -1), self._data_complex) |         y_values = check_complex(y_values, self.fun_kwargs.get('complex_mode', -1), self._data_complex) | ||||||
|  |  | ||||||
|         new_fit.set_data(x_values, y_values, y_err=0.0) |         new_fit.set_data(x_values, y_values, y_err=0.0) | ||||||
| @@ -414,6 +417,9 @@ class FitResult(Points): | |||||||
|  |  | ||||||
|         part_functions = [] |         part_functions = [] | ||||||
|         actual_mode = self.fun_kwargs.get('complex_mode', -1) |         actual_mode = self.fun_kwargs.get('complex_mode', -1) | ||||||
|  |         fun_kwargs = {k: v for k, v in self.fun_kwargs.items()} | ||||||
|  |         if self.fun_kwargs.get('complex_mode', -1) == -1: | ||||||
|  |             fun_kwargs.pop('complex_mode', None) | ||||||
|  |  | ||||||
|         for sub_name, sub_y in zip(self.func.sub_name(), self.func.sub(self.p_final, x_values, **self.fun_kwargs)): |         for sub_name, sub_y in zip(self.func.sub_name(), self.func.sub(self.p_final, x_values, **self.fun_kwargs)): | ||||||
|             sub_y = check_complex(sub_y, actual_mode, self._data_complex) |             sub_y = check_complex(sub_y, actual_mode, self._data_complex) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user