示例#1
0
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()

rec.addContribution(linefit)
rec.show()


# <demo> --- stop ---

# FitContributions may have many parameters.  We need to tell the recipe
# which of them should be tuned by the fit.

rec.addVar(rec.linefit.A)
rec.addVar(rec.linefit.B)

# The addVar function created two attributes A, B for the rec object
# which link ot the A and B parameters of the linefit contribution.

print("rec.A =", rec.A)
print("rec.A.value =", rec.A.value)
示例#2
0
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()

rec.addContribution(linefit)
rec.show()

# <demo> --- stop ---

# FitContributions may have many parameters.  We need to tell the recipe
# which of them should be tuned by the fit.

rec.addVar(rec.linefit.A)
rec.addVar(rec.linefit.B)

# The addVar function created two attributes A, B for the rec object
# which link ot the A and B parameters of the linefit contribution.

print("rec.A =", rec.A)
print("rec.A.value =", rec.A.value)
示例#3
0
# 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
recipe = FitRecipe()

# clearFitHooks suppresses printout of iteration number
recipe.clearFitHooks()

recipe.addContribution(large_gaussian)
recipe.addContribution(small_gaussian)

recipe.show()

# <demo> --- stop ---

# FitContributions may have many parameters.  We need to tell the recipe
# which of them should be tuned by the fit.

recipe.addVar(large_gaussian.lgA)
recipe.addVar(large_gaussian.lgx0)
recipe.addVar(large_gaussian.lgsig)

recipe.addVar(small_gaussian.sgA)
recipe.addVar(small_gaussian.sgx0)
recipe.addVar(small_gaussian.sgsig)

# The addVar function created two attributes A, B for the rec object