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


Python Data.title方法代码示例

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


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

示例1: Data

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
"""Add an inset to a plot."""
from Stoner import Data

p = Data("sample.txt", setas="xy")
p.plot()
p.inset(loc=1, width="50%", height="50%")
p.setas = "x.y"
p.plot()
p.title = ""  # Turn off the inset title
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:11,代码来源:inset_plot.py

示例2: linspace

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal
from copy import deepcopy

T = linspace(4.2, 300, 101)
params = [265, 65, 1.0, 5]
params2 = deepcopy(params)
G = SF.blochGrueneisen(T, *params) + normal(size=len(T), scale=5e-5)
dG = ones_like(T) * 5e-5
d = Data(T, G, dG, setas="xye", column_headers=["Temperature (K)", "Resistivity", "dR"])

d.curve_fit(SF.blochGrueneisen, p0=params, result=True, header="curve_fit")

d.setas = "xy"
d.lmfit(SF.BlochGrueneisen, p0=params2, result=True, header="lmfit")

d.setas = "xyeyy"
d.plot(fmt=["r.", "b-", "g-"])

d.annotate_fit(SF.blochGrueneisen, x=0.65, y=0.35, fontdict={"size": "x-small"})
d.annotate_fit(
    SF.BlochGrueneisen,
    x=0.65,
    y=0.05,
    fontdict={"size": "x-small"},
    prefix="BlochGrueneisen",
)
d.title = "Bloch-Grueneisen Fit"
d.tight_layout()
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:32,代码来源:b_g.py

示例3:

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

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

示例5:

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
    ODRModel,
    result=True,
    header="ODR-Fit",
    residuals=True,
    output="report",
    prefix="ODRModel",
)
# 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+", label="Fit residuals")
d.setas = "x....y"
d.plot(fmt="b+", label="ODRModel Residuals")
d.title = ""

ax = d.subplot2grid((3, 1), (0, 0), rowspan=2)
d.setas = "xyy.y"
d.plot(fmt=["ro", "g-", "b-"])
d.xticklabels = [[]]
d.ax_xlabel = ""

# Annotate plot with fitting parameters
d.annotate_fit(PowerLaw, x=0.1, y=0.25, fontdict={"size": "x-small"})
d.annotate_fit(
    ODRModel, x=0.65, y=0.15, fontdict={"size": "x-small"}, prefix="ODRModel"
)
d.title = u"curve_fit with models"
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:32,代码来源:curvefit_models.py

示例6:

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
d.setas = "xy"
d.curve_fit(SF.quadratic, result=True, header="Curve-fit")
d.setas = "x...y"
d.plot(fmt="b-", label="curve-fit")
d.annotate_fit(
    SF.quadratic,
    prefix="quadratic",
    x=0.2,
    y=0.65,
    fontdict={"size": "x-small", "color": "blue"},
)

d.setas = "xy"
fit = SF.Quadratic()
p0 = fit.guess(y, x=x)
d.lmfit(SF.Quadratic, p0=p0, result=True, header="lmfit")

d.setas = "x...y"
d.plot(fmt="g-", label="lmfit")
d.annotate_fit(
    SF.Quadratic,
    prefix="Quadratic",
    x=0.65,
    y=0.65,
    fontdict={"size": "x-small", "color": "green"},
)

d.title = "Qudratic Fitting"
plt.legend(loc=4)
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:31,代码来源:Quadratic.py

示例7:

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
d.curve_fit(SF.kittelEquation, p0=copy(params), result=True, header="curve_fit")

fit = SF.KittelEquation()
p0 = fit.guess(G, x=B)

d.lmfit(fit, p0=p0, result=True, header="lmfit")

d.setas = "xyeyy"
d.plot(fmt=["r.", "b-", "g-"])

d.annotate_fit(
    SF.kittelEquation,
    x=0.5,
    y=0.25,
    fontdict={"size": "x-small", "color": "blue"},
    mode="eng",
)
d.annotate_fit(
    SF.KittelEquation,
    x=0.5,
    y=0.05,
    fontdict={"size": "x-small", "color": "green"},
    prefix="KittelEquation",
    mode="eng",
)
d.title = "Kittel Fit"
d.fig.gca().xaxis.set_major_formatter(TexEngFormatter())
d.fig.gca().yaxis.set_major_formatter(TexEngFormatter())
d.tight_layout()
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:31,代码来源:kittel.py

示例8: zip

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
    SF.fowlerNordheim,
    x=0.2,
    y=0.6,
    prefix="fowlerNordheim",
    fontdict={"size": "x-small", "color": "blue"},
)

d.setas = "xye"
fit = SF.FowlerNordheim()
p0 = [2500, 5.2, 15.0]
p0 = fit.guess(I, x=V)
for p, v, mi, mx in zip(
    ["A", "phi", "d"], [2500, 3.2, 15.0], [100, 1, 5], [1e4, 20.0, 30.0]
):
    p0[p].value = v
    p0[p].bounds = [mi, mx]
d.lmfit(SF.FowlerNordheim, p0=p0, result=True, header="lmfit")
d.setas = "x...y"
d.plot(fmt="g-")
d.annotate_fit(
    fit,
    x=0.2,
    y=0.2,
    prefix="FowlerNordheim",
    fontdict={"size": "x-small", "color": "green"},
)

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

示例9: Data

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
"""Scale data to stitch it together."""
from Stoner import Data

from Stoner.Util import format_error
import matplotlib.pyplot as plt

# Load and plot two sets of data
s1 = Data("Stitch-scan1.txt", setas="xy")
s2 = Data("Stitch-scan2.txt", setas="xy")
s1.plot(label="Set 1")
s2.fig = s1.fig
s2.plot(label="Set 2")
# Stitch scan 2 onto scan 1
s2.stitch(s1)

s2.plot(label="Stictched")
s2.title = "Stictching Example"

# Tidy up the plot by adding annotation fo the stirching co-efficients
labels = ["A", "B", "C"]
txt = []
lead = r"$x'\rightarrow x+A$" + "\n" + r"$y'=\rightarrow By+C$" + "\n"
for l, v, e in zip(
    labels, s2["Stitching Coefficients"], s2["Stitching Coeffient Errors"]
):
    txt.append(format_error(v, e, latex=True, prefix=l + "="))
plt.text(0.7, 0.65, lead + "\n".join(txt), fontdict={"size": "x-small"})
plt.draw()
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:30,代码来源:stitch.py

示例10:

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

示例11: gmean

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

示例12: Data

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
d = Data(V, I, dI, setas="xye", column_headers=["Bias", "Current", "Noise"])

d.curve_fit(SF.simmons, p0=[2500, 5.2, 15.0], result=True, header="curve_fit")
d.setas = "xyey"
d.plot(fmt=["r.", "b-"])
d.annotate_fit(
    SF.simmons,
    x=0.25,
    y=0.25,
    prefix="simmons",
    fontdict={"size": "x-small", "color": "blue"},
)

d.setas = "xye"
fit = SF.Simmons()
p0 = [2500, 5.2, 15.0]
d.lmfit(SF.Simmons, p0=p0, result=True, header="lmfit")
d.setas = "x...y"
d.plot(fmt="g-")
d.annotate_fit(
    fit,
    x=0.65,
    y=0.25,
    prefix="Simmons",
    fontdict={"size": "x-small", "color": "green"},
)

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

示例13: exp

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [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.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 = [[]]
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"Orthogonal Distance Regression  Fit"
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:31,代码来源:odr_simple.py

示例14:

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
        data.del_rows(isnan(data.y))

        #Normalise data on y axis between +/- 1
        data.normalise(base=(-1.,1.), replace=True)

        #Swap x and y axes around so that R is x and T is y
        data=~data

        #Curve fit a straight line, using only the central 90% of the resistance transition
        data.curve_fit(linear,bounds=lambda x,r:-threshold<x<threshold,result=True,p0=[7.0,0.0]) #result=True to record fit into metadata

        #Plot the results
        data.setas[-1]="y"
        data.subplot(1,len(r_cols),i+1)
        data.plot(fmt=["k.","r-"])
        data.annotate_fit(linear,x=-1.,y=7.3c,fontsize="small")
        data.title="Ramp {}".format(data[iterator][0])
        row.extend([data["linear:intercept"],data["linear:intercept err"]])
    data.tight_layout()
    result+=np.array(row)

result.column_headers=["Ramp","Sample 4 R","dR","Sample 7 R","dR"]
result.setas="xyeye"
result.plot(fmt=["k.","r."])






开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:26,代码来源:Tc_Fit.py

示例15: guess_vals

# 需要导入模块: from Stoner import Data [as 别名]
# 或者: from Stoner.Data import title [as 别名]
@simple_model.guesser
def guess_vals(y, x=None):
    """Should guess parameter values really!"""
    m = (y.max() - y.min()) / (x[y.argmax()] - x[y.argmin()])
    c = x.mean() * m - y.mean()  # return one value per parameter
    return [m, c]


# Add a function to sry vonstraints on parameters (optional)
@simple_model.hinter
def hint_parameters():
    """Five some hints about the parameter."""
    return {"m": {"max": 10.0, "min": 0.0}, "c": {"max": 5.0, "min": -5.0}}


# Create some x,y data
x = linspace(0, 10, 101)
y = 4.5 * x - 2.3 + normal(scale=0.4, size=len(x))

# Make The Data object
d = Data(x, y, setas="xy", column_headers=["X", "Y"])

# Do the fit
d.lmfit(simple_model, result=True)

# Plot the result
d.setas = "xyy"
d.plot(fmt=["r+", "b-"])
d.title = "Simple Model Fit"
d.annotate_fit(simple_model, x=0.05, y=0.5)
开发者ID:gb119,项目名称:Stoner-PythonCode,代码行数:32,代码来源:make_model.py


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