# SrFit objects can be examined by calling their show() function. SrFit # parses the model equation and finds two parameters A, B at independent # variable x. The values of parameters A, B are at this stage undefined. linefit.show() # <demo> --- stop --- # We can set A and B to some specific values and calculate model # observations. The x and y attributes of the FitContribution are # the observed values, which may be re-sampled or truncated to a shorter # fitting range. linefit.A linefit.A = 3 linefit.B = 5 print(linefit.A, linefit.A.value) print(linefit.B, linefit.B.value) # <demo> --- stop --- # linefit.evaluate() returns the modeled values and linefit.residual # the difference between observed and modeled data scaled by estimated # standard deviations. print("linefit.evaluate() =", linefit.evaluate()) print("linefit.residual() =", linefit.residual()) plt.plot(xobs, yobs, 'x', linedata.x, linefit.evaluate(), '-') plt.title('Line simulated at A=3, B=5')
large_gaussian.setEquation("A * gaussnorm * exp(-0.5 * (x - x0)**2/sig**2)") # SrFit objects can be examined by calling their show() function. SrFit # parses the model equation and finds two parameters A, B at independent # variable x. The values of parameters A, B are at this stage undefined. large_gaussian.show() # <demo> --- stop --- # We can set A and B to some specific values and calculate model # observations. The x and y attributes of the FitContribution are # the observed values, which may be re-sampled or truncated to a shorter # fitting range. large_gaussian.A = 25000 large_gaussian.x0 = 40 large_gaussian.sig = 20 print(large_gaussian.A, large_gaussian.A.value) print(large_gaussian.x0, large_gaussian.x0.value) print(large_gaussian.sig, large_gaussian.sig.value) # <demo> --- stop --- # linefit.evaluate() returns the modeled values and linefit.residual # the difference between observed and modeled data scaled by estimated # standard deviations. print("large_gaussian.evaluate() =", large_gaussian.evaluate()) print("large_gaussian.residual() =", large_gaussian.residual()) plt.plot(xobs, yobs, 'x', profile.x, large_gaussian.evaluate(), '-')