예제 #1
0
def plotOmegas(x, y, axis, i, averageLines):
    inf.smallerFont(axis, 8)
    markers=["o", "s","D","^","d","h","p","o"]
    newax = fig.add_axes([0.43, 0.15, 0.25, 0.25])
    newax.scatter(x, y, color=cm(abs(i/9)), alpha=0.75, edgecolors='none', label=labelAlfa[i], marker=markers[i])
    newax.set_ylim(-0.05,1.05)
    loc = plticker.MultipleLocator(40.0) # this locator puts ticks at regular intervals
    newax.xaxis.set_major_locator(loc)
    loc = plticker.MultipleLocator(1/3) # this locator puts ticks at regular intervals
    newax.yaxis.set_major_locator(loc)
    newax.yaxis.set_major_formatter(plticker.FixedFormatter(("0", "$0$", r"$\frac{1}{3}$", r"$\frac{2}{3}$", "$1$")))
    inf.smallerFont(newax,8)
    newax.set_xlim(xmin,xmax)
    lg = newax.legend(prop={'size': 7}, loc=(0.5,0.13), scatterpoints=1)
    newax.add_artist(lg)
    newax.legend(prop={'size': 7}, loc=(0.5,1.55), scatterpoints=1)
    axis.semilogy(x, y, ls="",color=cm(abs(i/9)), label=labelAlfa[i], marker=markers[i], mec='none',alpha=0.75)
    
    for j in range(0,3):
        axis.semilogy(x[rngt[j]:rngt[j+1]], fun.constant(x[rngt[j]:rngt[j+1]], averageLines[j]), color=cm(abs(i/9)))
    axis.set_ylim(2e-4,2)
    axis.set_ylabel(r"$\omega_\alpha$", size=8)
    axis.set_xlabel(r"$1/k_BT$", size=8)
    arrow = dict(arrowstyle="-", connectionstyle="arc3", ls="--", color="gray")
    if i == 0: # range separation lines
        axis.annotate("", xy=(45,2e-4), xytext=(45,2), arrowprops=arrow)
        axis.annotate("", xy=(94,2e-4), xytext=(94,2), arrowprops=arrow)
        axis.annotate("(b)", xy=(-0.2, 0.93), xycoords="axes fraction", size=8)
예제 #2
0
def fitAndPlotLinear(x, y, rngt, ax, alfa, showPlot, labelAlfa, p):
    markers=["o", "s","D","^","d","h","p","o"]
    labelRange = ['low', 'med', 'high']
    labelRange = labelRange+list([str(i) for i in rngt])
    cm = plt.get_cmap('Set1')
    cm1 = plt.get_cmap('Set3')
    slopes = []
    if showPlot:
        inf.smallerFont(ax, 8)
        ax.scatter(x, y, color=cm(abs(alfa/9)), alpha=0.75, edgecolors='none', marker=markers[alfa])#, "o", lw=0.5)
        arrow = dict(arrowstyle="-", connectionstyle="arc3", ls="--", color="gray")
        putLabels(ax, p.calc, alfa)
    for i in range(0,len(rngt)-1):
        a, b = fun.linearFit(x, y, rngt[i], rngt[i+1])
        slopes.append(b)
        if showPlot:
            ax.semilogy(x[rngt[i]:rngt[i+1]+1], np.exp(fun.linear(x[rngt[i]:rngt[i+1]+1], a, b)), ls="-", color=cm1((i+abs(alfa)*3)/12))
            xHalf = (x[rngt[i]]+x[rngt[i+1]]+1)/2
            text = "{:03.3f}".format(-b)
            yHalf = np.exp(fun.linear(xHalf, a, b))
            if alfa == -1:
                ax.text(xHalf, 2e1, r"$"+roman.toRoman(i+1)+r"$", color="gray", ha="right", va="center")#, transform=axarr[i].transAxes)
                xHalf *= 1.15
                yHalf *= 5
                text = r"$E_a="+text+r"$"

            bbox_props = dict(boxstyle="round", fc="w", ec="1", alpha=0.6)
            ax.text(xHalf,yHalf, text, color=cm(abs(alfa/9)), bbox=bbox_props, ha="center", va="center", size=6)
    if showPlot and alfa > -1:
        locator = LogLocator(100,[1e-1])
        ax.yaxis.set_major_locator(locator)
    return slopes
예제 #3
0
def annotateBasic(ax, ax2):
    ax.set_xlim(30, 120)
    ax.set_ylim(1e-2, 1e3)
    ax.set_yscale("log")
    ax.set_xlabel(r"$1/k_BT + ln(F^{1.78})$", size=8)
    ax2.set_ylim(0.6, 1.2)
    inf.smallerFont(ax, 8)
    inf.smallerFont(ax2, 6)
    ax.annotate("",
                xy=(45, 1e-2),
                xycoords='data',
                xytext=(45, 1e3),
                arrowprops=dict(arrowstyle="-",
                                connectionstyle="arc3",
                                ls="--",
                                color="gray"))
    ax.annotate("",
                xy=(63, 1e-2),
                xycoords='data',
                xytext=(63, 1e3),
                arrowprops=dict(arrowstyle="-",
                                connectionstyle="arc3",
                                ls="--",
                                color="gray"))
    y = 2e-2
    ax.text(70, y, "$I$", color="gray", size=8)
    ax.text(50, y, "$II$", color="gray", size=8)
    ax.text(35, y, "$III$", color="gray", size=8)
    legends = []
    rLg = mlines.Line2D([], [],
                        color='black',
                        ls="-",
                        lw=4,
                        markersize=10,
                        label=r"$g\; \frac{\langle R^2\rangle}{t F^{0.8}}$")
    nLg = mlines.Line2D([], [],
                        color='black',
                        ls="-.",
                        lw=3,
                        markersize=8,
                        label=r"$gl^2\; \frac{\langle N_h\rangle}{t F^{0.8}}$")
    iLg = mlines.Line2D([], [],
                        color='black',
                        ls='--',
                        markersize=8,
                        label=r"$N_{isl}$")
    fLg = mlines.Line2D([], [],
                        color='lightgray',
                        ls='-',
                        markersize=8,
                        label=r"$Fit$")
    legends.append(rLg)
    legends.append(nLg)
    legends.append(fLg)
    alpha = 0.3
    return legends, alpha
def plotOmegas(x, y, axis, i, averageLines, total, labelAlfa, ymin):
    inf.smallerFont(axis, 8)
    cm = plt.get_cmap('tab20')
    markers = ["o", "s", "D", "^", "d", "h", "p"]
    # #newax = fig.add_axes([0.43, 0.15, 0.25, 0.25])
    # newax.scatter(x, y, color=cm(abs(i/9)), alpha=0.75, edgecolors='none', label=labelAlfa[i], marker=markers[i])
    # newax.set_ylim(-0.05,1.05)
    # loc = plticker.MultipleLocator(40.0) # this locator puts ticks at regular intervals
    # newax.xaxis.set_major_locator(loc)
    # loc = plticker.MultipleLocator(1/3) # this locator puts ticks at regular intervals
    # newax.yaxis.set_major_locator(loc)
    # newax.yaxis.set_major_formatter(plticker.FixedFormatter(("0", "$0$", r"$\frac{1}{3}$", r"$\frac{2}{3}$", "$1$")))
    # inf.smallerFont(newax,8)
    #newax.set_xlim(xmin,xmax)
    # lg = newax.legend(prop={'size': 7}, loc=(0.5,0.13), scatterpoints=1)
    # newax.add_artist(lg)
    # newax.legend(prop={'size': 7}, loc=(0.5,1.55), scatterpoints=1)
    axis.semilogy(x,
                  y,
                  ls="",
                  color=cm(abs((i % 20) / 20)),
                  label=labelAlfa[i],
                  marker=markers[i % 7],
                  mec=getMec(i),
                  alpha=0.75)

    #for j in range(0,len(rngt)-1):
    #    axis.semilogy(x[rngt[j]:rngt[j+1]], fun.constant(x[rngt[j]:rngt[j+1]], averageLines[j]), color=cm(abs(i/9)))
    axis.set_ylim(ymin, 2)
    if total:
        rl = ""
    else:
        rl = "TOF"
    axis.set_ylabel(r"$\omega^{" + rl + r"}_\alpha$")
    axis.set_xlabel(r"$1/k_BT$")
    arrow = dict(arrowstyle="-", connectionstyle="arc3", ls="--", color="gray")
    axis.legend(prop={'size': 5}, loc="best", scatterpoints=1)
    if i == 0:  # range separation lines
        axis.annotate("", xy=(45, 2e-4), xytext=(45, 2), arrowprops=arrow)
        axis.annotate("", xy=(94, 2e-4), xytext=(94, 2), arrowprops=arrow)
            epsilon[:,j,i] = omega[:,j,i]*(ratioEa[:,j,i]-multiplicityEa[:,j,i])

    myLegends = []
    myLabels = []#[r"$E_a$", r"$E^f + \sum_\alpha \;\epsilon_\alpha$"]
    myLegends += lgs
        
    for i in range(maxAlfa-1,minAlfa-1,-1): #alfa
        myLabels.append(labelAlfa[i])
    myLabels.append("Rel. err.")
    plt.figlegend(myLegends, myLabels, loc=(0.68,0.15), prop={'size':11})
    #plt.savefig("multiplicitiesOmegas"+ext+".svg", bbox_inches='tight')

if lmbdas:
    figS, axar = plt.subplots(2, sharex=True, figsize=(5,4))
    figS.subplots_adjust(top=0.95,left=0.15, right=0.95)
    inf.smallerFont(axar[0], 8)
    inf.smallerFont(axar[1], 8)

    p.minA = 0; p.maxA = 4; p.maxA = 4
    if p.rLib == "farkas":
        p.minA = 0; p.maxA = 7; p.maxA = 7
        labelAlfa[4] = labelAlfa[22]
        labelAlfa[5] = labelAlfa[23]
        labelAlfa[6] = labelAlfa[24]
    tempMavgS, omegaS, totalRateS, totalRateEventsS, ratesS, ratiosS = mi.getMavgAndOmega(p,temperatures,workingPath)
    totalRateEventsS = np.copy(rates[:,:,2]) # it is a inner rate
    os.chdir(workingPath)
    activationEnergyT, multiplicityEaS = mi.getMultiplicityEa(p,temperatures,labelAlfa,sp,tempMavgS,omegaS,totalRateEventsS,ext="")
    os.chdir(workingPath)
    ratioEaTmp = np.zeros(len(temperatures))
    multiplicityEaTmp = np.zeros(len(temperatures))