当前位置: 首页>>代码示例>>Python>>正文


Python Data.xlabel方法代码示例

本文整理汇总了Python中Stoner.Data.xlabel方法的典型用法代码示例。如果您正苦于以下问题:Python Data.xlabel方法的具体用法?Python Data.xlabel怎么用?Python Data.xlabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stoner.Data的用法示例。


在下文中一共展示了Data.xlabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: linspace

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import xlabel [as 别名]
"""Example of nDimArrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace
from numpy.random import normal

# Make some data
T = linspace(200, 350, 101)
R = SF.modArrhenius(T, 1e6, 0.5, 1.5) * normal(scale=0.00005, loc=1.0, size=len(T))
d = Data(T, R, setas="xy", column_headers=["T", "Rate"])

# Curve_fit on its own
d.curve_fit(SF.modArrhenius, p0=[1e6, 0.5, 1.5], result=True, header="curve_fit")
d.setas = "xyy"
d.plot(fmt=["r.", "b-"])
d.annotate_fit(SF.modArrhenius, x=0.2, y=0.5)

# lmfit using lmfit guesses
fit = SF.ModArrhenius()
p0 = [1e6, 0.5, 1.5]
d.lmfit(fit, p0=p0, result=True, header="lmfit")
d.setas = "x..y"
d.plot()
d.annotate_fit(SF.ModArrhenius, x=0.2, y=0.25, prefix="ModArrhenius")

d.title = "Modified Arrhenius Test Fit"
d.ylabel = "Rate"
d.xlabel = "Temperature (K)"
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:30,代码来源:modArrhenius.py

示例2:

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import xlabel [as 别名]
d.show()
#Now convert the angle to sin^2
t.apply(lambda x: np.sin(np.radians(x[0]/2.0))**2, 0,header=r"$sin^2\theta$")
# Now create the m^2 order
m=np.arange(len(t))+fringe_offset
m=m**2
#And add it to t
t.add_column(m, column_header='$m^2$')
#Now we can it a straight line
t.setas="x..y"
fit=t.lmfit(Linear,result=True,replace=False,header="Fit")
g=t["LinearModel:slope"]
gerr=t["LinearModel:slope err"]/g
g=np.sqrt(1.0/g)
gerr/=2.0
l=float(d['Lambda'])
th=l/(2*g)
therr=th*(gerr)

t.inset(loc="top right",width=0.5,height=0.4)
t.plot_xy(r"Fit",r"$sin^2\theta$", 'b-',label="Fit")
t.plot_xy(r"$m^2$",r"$sin^2\theta$", 'ro',label="Peak Position")
t.xlabel="Fringe $m^2$"
t.ylabel=r"$sin^2\theta$"
t.title=""
t.legend(loc="upper left")
t.draw()
pyplot.sca(t.axes[0])
# Get the wavelength from the metadata
# Calculate thickness and report
pyplot.text (0.05,0.05, "Thickness is: {} $\AA$".format(format_error(th,therr,latex=True)), transform=main_fig.axes[0].transAxes)
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:33,代码来源:Kiessig.py

示例3: exp

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import xlabel [as 别名]
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.differential_evolution(
    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=["r.", "b-"])
d.xticklabels = [[]]
d.xlabel = ""

# Annotate plot with fitting parameters
d.annotate_fit(func, prefix="Model", x=0.7, y=0.3, fontdict={"size": "x-small"})
text = r"$y=A+Be^{-x/C}$" + "\n\n"
d.text(7.2, 3.9, text, fontdict={"size": "x-small"})
d.title = u"Differential Evolution  Fit"
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:32,代码来源:differential_evolution_simple.py

示例4:

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import xlabel [as 别名]
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)")
d.yscale("log")
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:32,代码来源:Arrhenius.py


注:本文中的Stoner.Data.xlabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。