def FowlerNordheim(V, params):
    """Simmons model tunnelling at V>phi
    V=bias voltage, params=[A, phi, d]
    A in m^2, phi barrier height in eV, d barrier width in angstrom

    Simmons model as in
    Simmons J. App. Phys. 34 6 1963
    """
    return _SF.FowlerNordheim(V, *params)
def BDR(V, params):
    """BDR model tunnelling
    V=bias voltage, params=[A, phi, dphi, d, mass]
    A: in m^2, phi: average barrier height in eV, dphi: change in barrier height in eV,
    d: barrier width in angstrom, mass: effective electron mass as a fraction of electron rest mass

    See Brinkman et. al. J. Appl. Phys. 41 1915 (1970)
    or Tuan Comm. in Phys. 16, 1, (2006)"""
    return _SF.BDR(V, *params)
def WLfit(B, params):
    """Weak localisation
    VRH(B, params):
    B = mag. field, params=list of parameter values, s0, B1, B2

    2D WL model as per
    Wu PRL 98, 136801 (2007)
    Porter PRB 86, 064423 (2012)
    """
    return _SF.WLfit(B, *params)
def FluchsSondheimer(t, params):
    """Evaluate a Fluchs-Sondheumer model function for conductivity.

    Args:
        t (array): Thickness values
        params (array): [mean-free-path, reflection co-efficient,sigma_0]

    Returns:
        Reduced Resistivity

    Note:
        Expression used from: G.N.Gould and L.A. Moraga, Thin Solid Films 10 (2), 1972 pp 327-330
"""
    return _SF.FluchsSondheimer(t, *params)
def strijkers(V, params):
    """strijkers(V, params):
    
    Args:
    V (array): bias voltages
    params (list): parameter values: omega, delta,P and Z
    
    Note:
        PCAR fitting Strijkers modified BTK model
        BTK PRB 25 4515 1982, Strijkers PRB 63, 104510 2000
        
        Only using 1 delta, not modified for proximity
    """
    return _SF.Strijkers(V, *params)
示例#6
0
"""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"
示例#7
0
"""Example of nDimArrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal

# Make some data
V = linspace(-4, 4, 1001)
I = SF.simmons(V, 2500, 5.2, 15.0) + normal(size=len(V), scale=100e-9)
dI = ones_like(V) * 100e-9

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(
示例#8
0
"""Example of nDimArrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal

# Make some data
V = linspace(-4, 4, 1001)
I = SF.simmons(V, 2500, 5.2, 15.0) + normal(size=len(V), scale=100e-9)
dI = ones_like(V) * 100e-9

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")
示例#9
0
"""Example of Arrhenius 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.arrhenius(T+normal(size=len(T),scale=1.0,loc=1.0),1E6,0.5)
d=Data(T,R,setas="xy",column_headers=["T","Rate"])

#Curve_fit on its own
d.curve_fit(SF.arrhenius,p0=[1E6,0.5],result=True,header="curve_fit")
d.setas="xyy"
d.plot()
d.annotate_fit(SF.arrhenius,x=200,y=0.04)

# lmfit using lmfit guesses
fit=SF.Arrhenius()
p0=fit.guess(R,x=T)
d.lmfit(fit,p0=p0,result=True,header="lmfit")
d.setas="x..y"
d.plot()
d.annotate_fit(SF.Arrhenius,x=200,y=0.02,prefix="Arrhenius")

d.title="Arrhenius Test Fit"
d.ylabel="Rate"
d.xlabel="Temperature (K)"
示例#10
0
"""Test Weak-localisation fitting."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal
from copy import copy

B = linspace(-0.01, 0.01, 100)
params = [1, 1.0e-11, 250]
G = SF.langevin(B, *params) + normal(size=len(B), scale=5e-3)
dG = ones_like(B) * 5e-3
d = Data(B,
         G,
         dG,
         setas="xye",
         column_headers=["Field $\\mu_0H (T)$", "Moment", "dM"])

func = lambda H, M_s, m: SF.langevin(H, M_s, m, 250)

d.curve_fit(func, p0=copy(params)[0:2], result=True, header="curve_fit")

d.setas = "xye"
fit = SF.Langevin()
p0 = fit.guess(G, x=B)
for p, v in zip(p0, params):
    p0[p].set(v)
    p0[p].max = v * 5
    p0[p].min = 0
    p0[p].vary = p != "T"

d.lmfit(fit, p0=p0, result=True, header="lmfit")
def PowerLaw(x, p):
    """Power Law Fitting Equation"""
    return _SF.PowerLaw(x, *p)
示例#12
0
"""Example of PowerLaw Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace
from numpy.random import normal

# Make some data
T = linspace(50, 500, 101)
R = SF.powerLaw(T, 1e-2, 0.6666666) * normal(size=len(T), scale=0.1, loc=1.0)
d = Data(T, R, setas="xy", column_headers=["T", "Rate"])

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

# lmfit using lmfit guesses
fit = SF.PowerLaw()
p0 = fit.guess(R, x=T)
d.lmfit(fit, p0=p0, result=True, header="lmfit")
d.setas = "x..y"
d.plot(fmt="g-")
d.annotate_fit(SF.PowerLaw, x=0.5, y=0.05, prefix="PowerLaw")

d.title = "Powerlaw Test Fit"
d.ylabel = "Rate"
d.xlabel = "Temperature (K)"
示例#13
0
"""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(50, 500, 101)
R = SF.nDimArrhenius(T + normal(size=len(T), scale=5.0, loc=1.0), 1e6, 0.5, 2)
d = Data(T, R, setas="xy", column_headers=["T", "Rate"])

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

# lmfit using lmfit guesses
fit = SF.NDimArrhenius()
p0 = fit.guess(R, x=T)
d.lmfit(fit, p0=p0, result=True, header="lmfit")
d.setas = "x..y"
d.plot(fmt="g-")
d.annotate_fit(SF.NDimArrhenius, x=0.25, y=0.05, prefix="NDimArrhenius")

d.title = "n-D Arrhenius Test Fit"
d.ylabel = "Rate"
d.xlabel = "Temperature (K)"
示例#14
0
"""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(50, 500, 101)
R = SF.nDimArrhenius(T + normal(size=len(T), scale=5.0, loc=1.0), 1E6, 0.5, 2)
d = Data(T, R, setas="xy", column_headers=["T", "Rate"])

#Curve_fit on its own
d.curve_fit(SF.nDimArrhenius,
            p0=[1E6, 0.5, 2],
            result=True,
            header="curve_fit")
d.setas = "xyy"
d.plot()
d.annotate_fit(SF.nDimArrhenius, x=150, y=6E5)

# lmfit using lmfit guesses
fit = SF.NDimArrhenius()
p0 = fit.guess(R, x=T)
d.lmfit(fit, p0=p0, result=True, header="lmfit")
d.setas = "x..y"
d.plot()
d.annotate_fit(SF.NDimArrhenius, x=150, y=3.5E5, prefix="NDimArrhenius")

d.title = "n-D Arrhenius Test Fit"
d.ylabel = "Rate"
d.xlabel = "Temperature (K)"
def TersoffHammann(V, params):
    """TersoffHamman model for tunnelling through STM tip
    V=bias voltage, params=[A]
    """
    return _SF.TersoffHammann(V, *params)
示例#16
0
"""Example of Quadratic Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace
from numpy.random import normal
import matplotlib.pyplot as plt

# Make some data
x = linspace(-10, 10, 101)
y = SF.quadratic(x + normal(size=len(x), scale=0.1), 4, -2, 11) * normal(
    size=len(x), scale=0.05, loc=1.0)
s = y * 0.05
d = Data(x, y, s, setas="xye", column_headers=["X", "Y"])
d.plot(fmt="r.")

d.polyfit(result=True, header="Polyfit")
d.setas = "x..y"
d.plot(fmt="m-", label="Polyfit")
d.text(
    -9,
    450,
    "Polynominal co-efficients\n{}".format(
        d["2nd-order polyfit coefficients"]),
    fontdict={
        "size": "x-small",
        "color": "magenta"
    },
)

d.setas = "xy"
d.curve_fit(SF.quadratic, result=True, header="Curve-fit")
def Linear(x, p):
    """Simple linear function"""
    return _SF.Lineaer(x, *p)
def NDimArrhenius(x, p):
    """Arrhenius Equation without T dependendent prefactor"""
    return _SF.NDimArrhehius(x, *p)
def Quadratic(x, p):
    """Simple Qudratic Function."""
    return _SF.Quadratic(x, *p)
示例#20
0
"""Test Weak-localisation fitting."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal
from copy import copy

B = linspace(-0.01, 0.01, 100)
params = [1, 1.0e-11, 250]
G = SF.langevin(B, *params) + normal(size=len(B), scale=5e-3)
dG = ones_like(B) * 5e-3
d = Data(B, G, dG, setas="xye", column_headers=["Field $\\mu_0H (T)$", "Moment", "dM"])

func = lambda H, M_s, m: SF.langevin(H, M_s, m, 250)

d.curve_fit(func, p0=copy(params)[0:2], result=True, header="curve_fit")

d.setas = "xye"
fit = SF.Langevin()
p0 = fit.guess(G, x=B)
for p, v in zip(p0, params):
    p0[p].set(v)
    p0[p].max = v * 5
    p0[p].min = 0
    p0[p].vary = p != "T"

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


d.setas = "xyeyy"
d.plot(fmt=["r.", "b-", "g-"])
示例#21
0
"""Example of nDimArrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal

# Make some data
V = linspace(-10, 10, 1000)
I = SF.bdr(V, 2.5, 3.2, 0.3, 15.0, 1.0) + normal(size=len(V), scale=1.0e-3)
dI = ones_like(V) * 1.0e-3

# Curve fit
d = Data(V, I, dI, setas="xye", column_headers=["Bias", "Current", "Noise"])

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],
):
"""Example of Arrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import logspace, log10
from numpy.random import normal

#Make some data
T = logspace(log10(200), log10(350), 51)
params = (1E6, 0.5, 150)
noise = 0.5
R = SF.vftEquation(T, *params) * normal(size=len(T), scale=noise, loc=1.0)
dR = SF.vftEquation(T, *params) * noise

d = Data(T, R, dR, setas="xye", column_headers=["T", "Rate"])

#Curve_fit on its own
d.curve_fit(SF.vftEquation, p0=params, result=True, header="curve_fit")

# lmfit using lmfit guesses
fit = SF.VFTEquation()
p0 = params
d.lmfit(fit, p0=p0, result=True, header="lmfit")

d.setas = "xyeyyy"
d.plot(fmt=["k+", "r-", "b-"])
d.yscale = "log"
d.ylim = (1E-43, 1)
d.annotate_fit(SF.vftEquation,
               x=270,
               y=1E-27,
               fontdict={"size": "x-small"},
def ModArrhenius(x, p):
    """Arrhenius Equation with a variable T power dependent prefactor"""
    return _SF.ModArrhehius(x, *p)
示例#24
0
"""Example of Quadratic Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace
from numpy.random import normal
import matplotlib.pyplot as plt

# Make some data
x = linspace(-10, 10, 101)
y = SF.quadratic(x + normal(size=len(x), scale=0.1), 4, -2, 11) * normal(
    size=len(x), scale=0.05, loc=1.0
)
s = y * 0.05
d = Data(x, y, s, setas="xye", column_headers=["X", "Y"])
d.plot(fmt="r.")

d.polyfit(result=True, header="Polyfit")
d.setas = "x..y"
d.plot(fmt="m-", label="Polyfit")
d.text(
    -9,
    450,
    "Polynominal co-efficients\n{}".format(d["2nd-order polyfit coefficients"]),
    fontdict={"size": "x-small", "color": "magenta"},
)

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(
示例#25
0
"""Example of Arrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ceil, log10, abs
from numpy.random import normal

# Make some data
T = linspace(200, 350, 101)
R = SF.arrhenius(T + normal(size=len(T), scale=3.0, loc=0.0), 1e6, 0.5)
E = 10 ** ceil(log10(abs(R - SF.arrhenius(T, 1e6, 0.5))))
d = Data(T, R, E, setas="xye", column_headers=["T", "Rate"])

# Curve_fit on its own
d.curve_fit(SF.arrhenius, p0=(1e6, 0.5), result=True, header="curve_fit")
d.setas = "xyey"
d.plot(fmt=["r.", "b-"])
d.annotate_fit(
    SF.arrhenius,
    x=0.5,
    y=0.5,
    mode="eng",
    fontdict={"size": "x-small", "color": "blue"},
)

# lmfit using lmfit guesses
fit = SF.Arrhenius()
d.setas = "xye"
d.lmfit(fit, result=True, header="lmfit")
d.setas = "x...y"
d.plot(fmt="g-")
d.annotate_fit(
示例#26
0
"""Test Weak-localisation fitting."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal

B = linspace(2, 100, 26)
params = [12.5, 0.75, 1e3]
G = SF.fluchsSondheimer(B, *params) + normal(size=len(B), scale=5e-5)
dG = ones_like(B) * 5e-5
d = Data(
    B,
    G,
    dG,
    setas="xye",
    column_headers=["Thickness (nm)", "Conductance", "dConductance"],
)

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

d.setas = "xye"
d.lmfit(SF.FluchsSondheimer, p0=params, result=True, header="lmfit")

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

d.annotate_fit(SF.fluchsSondheimer,
               x=0.2,
               y=0.6,
               fontdict={
                   "size": "x-small",
示例#27
0
"""Test Weak-localisation fitting."""
from Stoner import Data
import Stoner.Fit as SF
from Stoner.plot.formats import TexEngFormatter

from numpy import linspace, ones_like
from numpy.random import normal
from copy import copy

B = linspace(1e3, 5e4, 51)
params = [2.2, 1e5, 2e2]
G = SF.kittelEquation(B, *params) + normal(size=len(B), scale=5e7)
dG = ones_like(B) * 5e7

d = Data(
    B,
    G,
    dG,
    setas="xye",
    column_headers=["Field $Oe$", r"$\nu (Hz)$", r"\delta $\nu (Hz)$"],
)

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-"])
示例#28
0
"""Test Weak-localisation fitting."""
from Stoner import Data
import Stoner.Fit as SF
from Stoner.plot.formats import TexEngFormatter

from numpy import linspace, ones_like
from numpy.random import normal
from copy import copy

B = linspace(0, 5E4, 51)
params = [2.2, 1E5, 2E2]
G = SF.kittelEquation(B, *params) + normal(size=len(B), scale=5E7)
dG = ones_like(B) * 5E7

d = Data(B,
         G,
         dG,
         setas="xye",
         column_headers=["Field $Oe$", r"$\nu (Hz)$", r"\delta $\nu (Hz)$"])

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"
示例#29
0
"""Example of nDimArrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal

# Make some data
V = linspace(-4, 4, 101)
I = SF.simmons(V, 2500, 3.2, 15.0) + normal(size=len(V), scale=5e-7)
dI = ones_like(V) * 500e-9

p0 = p0 = [2500, 3, 10.0]

d = Data(V, I, dI, setas="xye", column_headers=["Bias", "Current", "Noise"])

d.curve_fit(SF.simmons, p0=p0, result=True, header="curve_fit", maxfev=2000)
d.setas = "xyey"
d.plot(fmt=["r,", "b-"], capsize=1)
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()
示例#30
0
"""Test Weak-localisation fitting."""
from Stoner import Data
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=20, y=65.05, fontdict={"size": "x-small"})
d.annotate_fit(SF.BlochGrueneisen,
               x=100,
               y=65,
               fontdict={"size": "x-small"},
示例#31
0
"""Test Weak-localisation fitting."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal

B = linspace(2, 100, 26)
params = [12.5, 0.75, 1e3]
G = SF.fluchsSondheimer(B, *params) + normal(size=len(B), scale=5e-5)
dG = ones_like(B) * 5e-5
d = Data(
    B,
    G,
    dG,
    setas="xye",
    column_headers=["Thickness (nm)", "Conductance", "dConductance"],
)

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

d.setas = "xye"
d.lmfit(SF.FluchsSondheimer, p0=params, result=True, header="lmfit")

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

d.annotate_fit(
    SF.fluchsSondheimer, x=0.2, y=0.6, fontdict={"size": "x-small", "color": "blue"}
)
d.annotate_fit(
    SF.FluchsSondheimer,
示例#32
0
"""Example of Arrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ceil, log10, abs as np_abs
from numpy.random import normal

# Make some data
T = linspace(200, 350, 101)
R = SF.arrhenius(T + normal(size=len(T), scale=3.0, loc=0.0), 1e6, 0.5)
E = 10 ** ceil(log10(np_abs(R - SF.arrhenius(T, 1e6, 0.5))))
d = Data(T, R, E, setas="xye", column_headers=["T", "Rate"])

# Curve_fit on its own
d.curve_fit(SF.arrhenius, p0=(1e6, 0.5), result=True, header="curve_fit")
d.setas = "xyey"
d.plot(fmt=["r.", "b-"])
d.annotate_fit(
    SF.arrhenius,
    x=0.5,
    y=0.5,
    mode="eng",
    fontdict={"size": "x-small", "color": "blue"},
)

# lmfit using lmfit guesses
fit = SF.Arrhenius()
d.setas = "xye"
d.lmfit(fit, result=True, header="lmfit")
d.setas = "x...y"
d.plot(fmt="g-")
d.annotate_fit(
示例#33
0
"""Test Weak-localisation fitting."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal
from copy import copy

B = linspace(-8, 8, 201)
params = [1e-3, 2.0, 0.25, 1.4]
G = SF.wlfit(B, *params) + normal(size=len(B), scale=5e-7)
dG = ones_like(B) * 5e-7
d = Data(
    B,
    G,
    dG,
    setas="xye",
    column_headers=["Field $\\mu_0H (T)$", "Conductance", "dConductance"],
)

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

d.setas = "xye"
d.lmfit(SF.WLfit, p0=copy(params), result=True, header="lmfit")

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

d.annotate_fit(SF.wlfit, x=0.05, y=0.75, fontdict={"size": "x-small", "color": "blue"})
d.annotate_fit(
    SF.WLfit,
    x=0.05,
示例#34
0
"""Example of nDimArrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from  numpy import linspace,ones_like
from numpy.random import normal

#Make some data
V=linspace(-4,4,1000)
I=SF.fowlerNordheim(V,2500,3.2,15.0)+normal(size=len(V),scale=10E-6)
dI=ones_like(V)*10E-6

d=Data(V,I,dI,setas="xye",column_headers=["Bias","Current","Noise"])

d.curve_fit(SF.fowlerNordheim,p0=[2500,3.2,15.0],result=True,header="curve_fit")
d.setas="xyey"
d.plot(fmt=["r.","b-"])
d.annotate_fit(SF.fowlerNordheim,x=0,y=10,prefix="fowlerNordheim",fontdict={"size":"x-small"})

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()
d.annotate_fit(fit,x=-3,y=-60,prefix="FowlerNordheim",fontdict={"size":"x-small"})

d.ylabel="Current"
示例#35
0
"""Example of nDimArrhenius Fit."""
from Stoner import Data
import Stoner.Fit as SF
from numpy import linspace, ones_like
from numpy.random import normal

# Make some data
V = linspace(-4, 4, 1000)
I = SF.fowlerNordheim(V, 2500, 3.2, 15.0) + normal(size=len(V), scale=1e-6)
dI = ones_like(V) * 10e-6

d = Data(V, I, dI, setas="xye", column_headers=["Bias", "Current", "Noise"])

d.curve_fit(SF.fowlerNordheim, p0=[2500, 3.2, 15.0], result=True, header="curve_fit")
d.setas = "xyey"
d.plot(fmt=["r.", "b-"])
d.annotate_fit(
    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]
):
示例#36
0
"""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)"
示例#37
0
"""Test Weak-localisation fitting."""
from Stoner import Data
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"