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)
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], ): 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"} )