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


Python Data.ylabel方法代码示例

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


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

示例1: linspace

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import ylabel [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: zip

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import ylabel [as 别名]
d.curve_fit(SF.bdr, p0=[2.5, 3.2, 0.3, 15.0, 1.0], result=True, header="curve_fit")
d.setas = "xyey"
d.plot(fmt=["r.", "b-"])
d.annotate_fit(
    SF.bdr, x=0.6, y=0.05, prefix="bdr", fontdict={"size": "x-small", "color": "blue"}
)

# lmfit
d.setas = "xy"
fit = SF.BDR(missing="drop")
p0 = fit.guess(I, x=V)
for p, v, mi, mx in zip(
    ["A", "phi", "dphi", "d", "mass"],
    [2.500, 3.2, 0.3, 15.0, 1.0],
    [0.100, 1.0, 0.05, 5.0, 0.5],
    [10, 10.0, 2.0, 30.0, 5.0],
):
    p0[p].value = v
    p0[p].bounds = [mi, mx]
d.lmfit(fit, p0=p0, result=True, header="lmfit")
d.setas = "x...y"
d.plot(fmt="g-")
d.annotate_fit(
    fit, x=0.2, y=0.05, prefix="BDR", fontdict={"size": "x-small", "color": "green"}
)

d.ylabel = "Current"
d.title = "BDR Model test"
d.tight_layout()
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:31,代码来源:BDR.py

示例3:

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import ylabel [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

示例4: linspace

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import ylabel [as 别名]
"""Decompose Example"""
from Stoner import Data
from Stoner.tools import format_val
from numpy import linspace, reshape, array

x = linspace(-10, 10, 201)
y = 0.3 * x ** 3 - 6 * x ** 2 + 11 * x - 20
d = Data(x, y, setas="xy", column_headers=["X", "Y"])
d.decompose()
d.setas = "xyyy"
coeffs = d.polyfit(polynomial_order=3)
str_coeffs = [format_val(c, mode="eng") for c in coeffs.ravel()]
str_coeffs = reshape(array(str_coeffs), coeffs.shape)
d.plot()
d.text(-6, -800, "Coefficients\n{}".format(str_coeffs), fontdict={"size": "x-small"})
d.ylabel = "Data"
d.title = "Decompose Example"
d.tight_layout()
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:20,代码来源:decompose.py

示例5:

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import ylabel [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

示例6: gmean

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import ylabel [as 别名]
        result.data[:, c] = (resfldr[1][:, c] + resfldr[0][:, c]) / 2.0
    for c in [1, 3, 5, 7]:
        result.data[:, c] = gmean((resfldr[0][:, c], resfldr[1][:, c]), axis=0)

    # Doing the Kittel fit with an orthogonal distance regression as we have x errors not y errors
    p0 = [2, 200e3, 10e3]  # Some sensible guesses
    result.lmfit(
        Inverse_Kittel, p0=p0, result=True, header="Kittel Fit", output="report"
    )
    result.setas[-1] = "y"

    result.template.yformatter = TexEngFormatter
    result.template.xformatter = TexEngFormatter
    result.labels = None
    result.figure(figsize=(6, 8))
    result.subplot(211)
    result.plot(fmt=["r.", "b-"])
    result.annotate_fit(Inverse_Kittel, x=7e9, y=1e5, fontdict={"size": 8})
    result.ylabel = "$H_{res} \\mathrm{(Am^{-1})}$"
    result.title = "Inverse Kittel Fit"

    # Get alpha
    result.subplot(212)
    result.setas(y="Delta_H", e="Delta_H.stderr", x="Freq")
    result.y /= mu_0
    result.e /= mu_0
    result.lmfit(Linear, result=True, header="Width", output="report")
    result.setas[-1] = "y"
    result.plot(fmt=["r.", "b-"])
    result.annotate_fit(Linear, x=5.5e9, y=2.8e3, fontdict={"size": 8})
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:32,代码来源:plot-folder-test.py


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