當前位置: 首頁>>代碼示例>>Python>>正文


Python FitResults.printResults方法代碼示例

本文整理匯總了Python中diffpy.srfit.fitbase.FitResults.printResults方法的典型用法代碼示例。如果您正苦於以下問題:Python FitResults.printResults方法的具體用法?Python FitResults.printResults怎麽用?Python FitResults.printResults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在diffpy.srfit.fitbase.FitResults的用法示例。


在下文中一共展示了FitResults.printResults方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
def main():

    # Make the data and the recipe
    strufile = "data/C60.stru"
    q = numpy.arange(1, 20, 0.05)
    makeData(strufile, q, "C60.iq", 1.0, 100.68, 0.005, 0.13, 2)

    # Make the recipe
    recipe = makeRecipe(strufile, "C60.iq")

    # Optimize
    scipyOptimize(recipe)

    # Generate and print the FitResults
    res = FitResults(recipe)
    # We want to see how much speed-up we get from bringing the scale and
    # background outside of the intensity generator.  Get the number of calls
    # to the residual function from the FitRecipe, and the number of calls to
    # 'iofq' from the IntensityGenerator.
    rescount = recipe.fithooks[0].count
    calcount = recipe.bucky.I.count
    footer = "iofq called %i%% of the time"%int(100.0*calcount/rescount)
    res.printResults(footer = footer)

    # Plot!
    plotResults(recipe)

    return
開發者ID:cfarrow,項目名稱:diffpy.srfit,代碼行數:30,代碼來源:npintensity.py

示例2: main

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
def main():
    """Refine the C60 molecule.

    From previous examples we know that the radius of the model structure is
    slightly too small. The annealing algorithm has to determine the proper
    radius, and must also account for thermal vibrations in the PDF.

    """

    molecule = makeC60()
    recipe = makeRecipe(molecule, "data/C60.gr")
    recipe.fithooks[0].verbose = 0

    # Optimize
    # Group related atomic positions for the optimizer
    parlist = [getXYZNames(i) for i in xrange(60)]
    groupAnneal(recipe, parlist)

    # Print results
    recipe.fix("all")
    res = FitResults(recipe, showfixed = False)
    res.printResults()

    # Save the structure
    molecule.write("C60_refined.stru", "pdffit")

    # Plot results
    plotResults(recipe)

    return
開發者ID:XiaohaoYang,項目名稱:diffpy.srfit,代碼行數:32,代碼來源:anneal.py

示例3: main

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
def main():
    """Set up and refine the recipe."""

    # Make the data and the recipe
    cdsciffile = "data/CdS.cif"
    znsciffile = "data/ZnS.cif"
    data = "data/CdS_ZnS_nano.gr"

    # Make the recipe
    stru1 = loadCrystal(cdsciffile)
    stru2 = loadCrystal(znsciffile)
    recipe = makeRecipe(stru1, stru2, data)
    from diffpy.srfit.fitbase.fithook import PlotFitHook
    recipe.pushFitHook(PlotFitHook())
    recipe.fithooks[0].verbose = 3

    # Optimize - we do this in steps to help convergence
    recipe.fix("all")

    # Start with the lattice parameters. In makeRecipe, these were tagged with
    # "lat". Here is how we use that.
    recipe.free("lat")
    leastsq(recipe.residual, recipe.values, maxfev = 50)

    # Now the scale and phase fraction.
    recipe.free("scale", "scale_CdS")
    leastsq(recipe.residual, recipe.values, maxfev = 50)

    # The ADPs.
    recipe.free("adp")
    leastsq(recipe.residual, recipe.values, maxfev = 100)

    # The delta2 parameters.
    recipe.free("delta2_cds", "delta2_zns")
    leastsq(recipe.residual, recipe.values, maxfev = 50)

    # The shape parameters.
    recipe.free("radius", "thickness")
    leastsq(recipe.residual, recipe.values, maxfev = 50)

    # The positional parameters.
    recipe.free("xyz")
    leastsq(recipe.residual, recipe.values)

    # Generate and print the FitResults
    res = FitResults(recipe)
    res.printResults()

    # Plot!
    plotResults(recipe)
    return
開發者ID:chiahaoliu,項目名稱:diffpy.srfit,代碼行數:53,代碼來源:coreshellnp.py

示例4: gaussianfit

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
def gaussianfit(x, y, dy=None, A=1.0, sig=1.0, x0=0.0):
#def gaussianfit(arg):
    '''main function to fit and plot gaussian curve
        x, y, dy:   gaussian date to be fitted 
        A, sig, x0: initial value
    '''
    #print type(arg)
    dy = np.ones_like(x) if dy==None else dy
    
    recipe = makeRecipe(x, y, dy, A, sig, x0)
    scipyOptimize(recipe)
    res = FitResults(recipe)
    res.printResults()
    plotResults(recipe)
    return 
開發者ID:XiaohaoYang,項目名稱:srfit-demos,代碼行數:17,代碼來源:gaussianfit.py

示例5: main

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
def main():

    # Create the recipe
    recipe = makeRecipeII()

    # Refine using the optimizer of your choice
    scipyOptimize(recipe)

    # Get the results in a FitResults object.
    res = FitResults(recipe)

    # Print the results
    res.printResults()

    # Plot the results
    plotResults(recipe)

    return
開發者ID:XiaohaoYang,項目名稱:diffpy.srfit,代碼行數:20,代碼來源:debyemodelII.py

示例6: main

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
def main():

    p = Profile()
    p.loadtxt("data/gaussian.dat")

    # FitContribution operations
    # "|="  -   Union of necessary components.
    # "<<"  -   Inject a parameter value
    c = FitContribution("g1")
    c |= p
    c |= "A * exp(-0.5*(x-x0)**2/sigma**2)"
    c.A << 0.5
    c.x0 << 5
    c.sigma << 1

    # FitRecipe operations
    # "|="  -   Union of necessary components.
    # "+="  -   Add Parameter or create a new one. Each tuple is a set of
    #           arguments for either setVar or addVar.
    # "*="  -   Constrain a parameter. Think of "*" as a push-pin holding one
    #           parameter's value to that of another.
    # "%="  -   Restrain a parameter or equation. Think of "%" as a rope
    #           loosely tying parameters to a value.
    r = FitRecipe()
    r |= c
    r += (c.A, 0.5), (c.x0, 5), "sig"
    r *= c.sigma, "sig"
    r %= c.A, 0.5, 0.5

    from gaussianrecipe import scipyOptimize

    scipyOptimize(r)

    res = FitResults(r)

    # Print the results.
    res.printResults()

    # Plot the results.
    from gaussianrecipe import plotResults

    plotResults(r)

    return
開發者ID:ericdill,項目名稱:diffpy.srfit,代碼行數:46,代碼來源:interface.py

示例7: main

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
def main():
    """The workflow of creating, running and inspecting a fit."""

    # Create the recipe
    recipe = makeRecipe()

    # Refine using the optimizer of your choice
    scipyOptimize(recipe)

    # Get the results.
    res = FitResults(recipe)

    # Print the results
    res.printResults()

    # Plot the results
    plotResults(recipe)

    return
開發者ID:cfarrow,項目名稱:diffpy.srfit,代碼行數:21,代碼來源:debyemodel.py

示例8: main

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
def main():

    molecule = makeC60()
    # Make the data and the recipe
    recipe = makeRecipe(molecule, "data/C60.gr")
    # Tell the fithook that we want very verbose output.
    recipe.fithooks[0].verbose = 3

    # Optimize
    from scipy.optimize import leastsq
    leastsq(recipe.residual, recipe.getValues())

    # Print results
    res = FitResults(recipe)
    res.printResults()

    # Plot results
    plotResults(recipe)

    return
開發者ID:XiaohaoYang,項目名稱:diffpy.srfit,代碼行數:22,代碼來源:nppdfobjcryst.py

示例9: main

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
def main():

    # Make two different data sets, each from the same structure, but with
    # different scale, noise, broadening and background.
    strufile = "data/C60.stru"
    q = numpy.arange(1, 20, 0.05)
    makeData(strufile, q, "C60_1.iq", 8.1, 101.68, 0.008, 0.12, 2, 0.01)
    makeData(strufile, q, "C60_2.iq", 3.2, 101.68, 0.02, 0.003, 0, 1)

    # Make the recipe
    recipe = makeRecipe(strufile, "C60_1.iq", "C60_2.iq")

    # Optimize
    # Since the backgrounds have a large effect on the profile, we will refine
    # them first, but do so separately.
    # To refine the background from the first contribution, we will fix
    # all other parameters and give the second contribution no weight in the
    # fit.
    recipe.fix("all")
    recipe.free("bcoeffs1")
    recipe.setWeight(recipe.bucky2, 0)
    scipyOptimize(recipe)
    # Now do the same for the second background
    recipe.fix("all")
    recipe.free("bcoeffs1")
    recipe.setWeight(recipe.bucky2, 1)
    recipe.setWeight(recipe.bucky1, 0)
    scipyOptimize(recipe)
    # Now refine everything with the structure parameters included
    recipe.free("all")
    recipe.setWeight(recipe.bucky1, 1)
    scipyOptimize(recipe)

    # Generate and print the FitResults
    res = FitResults(recipe)
    res.printResults()

    # Plot!
    plotResults(recipe)

    return
開發者ID:chiahaoliu,項目名稱:diffpy.srfit,代碼行數:43,代碼來源:npintensityII.py

示例10: makeRecipe

# 需要導入模塊: from diffpy.srfit.fitbase import FitResults [as 別名]
# 或者: from diffpy.srfit.fitbase.FitResults import printResults [as 別名]
    pylab.plot(r,diffzero,'k-')
    pylab.xlabel("$r (\AA)$")
    pylab.ylabel("$G (\AA^{-2})$")
    pylab.legend(loc=1)

    pylab.show()
    return


if __name__ == "__main__":

    # Make the data and the recipe
    niciffile = "data/ni.cif"
    siciffile = "data/si.cif"
    data = "data/si90ni10-q27r60-xray.gr"

    # Make the recipe
    recipe = makeRecipe(niciffile, siciffile, data)

    # Optimize
    scipyOptimize(recipe)

    # Generate and print the FitResults
    res = FitResults(recipe)
    res.printResults()

    # Plot!
    plotResults(recipe)

# End of file
開發者ID:XiaohaoYang,項目名稱:diffpy.srfit,代碼行數:32,代碼來源:crystalpdftwophase.py


注:本文中的diffpy.srfit.fitbase.FitResults.printResults方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。