Closed PengfeiRen96 closed 3 years ago
If the return state is really 2 than that is strange because according to the documentation it should only be 0 or -1 indicating that there was an error or not. Maybe you mean the fit state, which can be 2 and means that the Hessian is singular. That might hint that the used fit model is not a good model here, some parameters may not be needed or something else is wrong.
This could happen if the input data is perfectly symmetric. In this case, the rotation angle has no effect on chi-square.
@superchromix Thanks for your help, the problem was solved when I modified the initial parameter.
The code is: import numpy as np import matplotlib.pyplot as plt import pygpufit.gpufit as gf
def gauss2d_angle(x, y, amp, x0, y0, sigma_x, sigma_y, theta): a = (np.cos(theta) 2) / (2 sigma_x 2) + (np.sin(theta) 2) / (2 sigma_y 2) b = -(np.sin(2 theta)) / (4 sigma_x 2) + (np.sin(2 theta)) / (4 sigma_y 2) c = (np.sin(theta) 2) / (2 sigma_x 2) + (np.cos(theta) 2) / (2 sigma_y 2) out = amp np.exp(- (a ((x - x0) * 2) + 2 b (x - x0) (y - y0)
if name == 'main':