本文整理汇总了Python中Stoner.Data.odr方法的典型用法代码示例。如果您正苦于以下问题:Python Data.odr方法的具体用法?Python Data.odr怎么用?Python Data.odr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stoner.Data
的用法示例。
在下文中一共展示了Data.odr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import odr [as 别名]
fit = SF.Arrhenius()
d.setas = "xye"
d.lmfit(fit, result=True, header="lmfit")
d.setas = "x...y"
d.plot(fmt="g-")
d.annotate_fit(
SF.Arrhenius,
x=0.5,
y=0.35,
prefix="Arrhenius",
mode="eng",
fontdict={"size": "x-small", "color": "green"},
)
d.setas = "xye"
res = d.odr(SF.Arrhenius, result=True, header="odr", prefix="ODR")
d.setas = "x....y"
d.plot(fmt="m-")
d.annotate_fit(
SF.Arrhenius,
x=0.5,
y=0.2,
prefix="ODR",
mode="eng",
fontdict={"size": "x-small", "color": "magenta"},
)
d.title = "Arrhenius Test Fit"
d.ylabel("Rate")
d.xlabel("Temperature (K)")
示例2: fit
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import odr [as 别名]
fontdict={"size": "x-small", "color": "blue"},
mode="eng",
)
d.annotate_fit(
VFTEquation,
x=0.5,
y=0.35,
prefix="VFTEquation",
fontdict={"size": "x-small", "color": "green"},
mode="eng",
)
# reset the columns for the fit
d.setas = "xye.."
# Now do the odr fit (will overwrite lmfit's metadata)
d.odr(VFTEquation, p0=p0)
d.setas = "x4.y"
# And plot and annotate
d.plot(fmt="m-", label="Orthogonal distance")
d.annotate_fit(
VFTEquation,
x=0.75,
y=0.35,
fontdict={"size": "x-small", "color": "magenta"},
mode="eng",
)
# Finally tidy up the plot a bit
d.yscale = "log"
d.ylim = (1e-35, 1e10)
示例3: linspace
# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import odr [as 别名]
from Stoner import Data
from numpy import linspace, exp, random
# Make some data
x = linspace(0, 10.0, 101)
y = 2 + 4 * exp(-x / 1.7) + random.normal(scale=0.2, size=101)
d = Data(x, y, column_headers=["Time", "Signal"], setas="xy")
d.plot(fmt="ro") # plot our data
func = lambda x, A, B, C: A + B * exp(-x / C)
# Do the fitting and plot the result
fit = d.odr(
func, result=True, header="Fit", A=1, B=1, C=1, prefix="Model", residuals=True
)
# Reset labels
d.labels = []
# Make nice two panel plot layout
ax = d.subplot2grid((3, 1), (2, 0))
d.setas = "x..y"
d.plot(fmt="g+")
d.title = ""
ax = d.subplot2grid((3, 1), (0, 0), rowspan=2)
d.setas = "xyy"
d.plot(fmt=["ro", "b-"])
d.xticklabels = [[]]