Пример #1
0
# 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')

# <demo> --- stop ---

# We want to find optimum model parameters that fit the simulated curve
# to the observations.  This is done by associating FitContribution with
# a FitRecipe object.  FitRecipe can manage multiple fit contributions and
# optimize all models to fit their respective profiles.

from diffpy.srfit.fitbase import FitRecipe
rec = FitRecipe()
# clearFitHooks suppresses printout of iteration number
rec.clearFitHooks()
Пример #2
0
# 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')

# <demo> --- stop ---

# We want to find optimum model parameters that fit the simulated curve
# to the observations.  This is done by associating FitContribution with
# a FitRecipe object.  FitRecipe can manage multiple fit contributions and
# optimize all models to fit their respective profiles.

from diffpy.srfit.fitbase import FitRecipe
rec = FitRecipe()
# clearFitHooks suppresses printout of iteration number
rec.clearFitHooks()
Пример #3
0
small_gaussian.sgsig = 3

print(large_gaussian.lgA, large_gaussian.lgA.value)
print(large_gaussian.lgx0, large_gaussian.lgx0.value)
print(large_gaussian.lgsig, large_gaussian.lgsig.value)
print(small_gaussian.sgA, small_gaussian.sgA.value)
print(small_gaussian.sgx0, small_gaussian.sgx0.value)
print(small_gaussian.sgsig, small_gaussian.sgsig.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())
print("small_gaussian.evaluate() =", small_gaussian.evaluate())
print("small_gaussian.residual() =", small_gaussian.residual())
plt.plot(xobs, yobs, 'x', profile.x, large_gaussian.evaluate(), '-', profile.x,
         small_gaussian.evaluate())
plt.title(
    'Two Gaussians simulated at A=25000, x0=40, sig=20 and A=500, x0=68, sig=3'
)

# <demo> --- stop ---

# We want to find optimum model parameters that fit the simulated curve
# to the observations.  This is done by associating FitContribution with
# a FitRecipe object.  FitRecipe can manage multiple fit contributions and
# optimize all models to fit their respective profiles.