Example #1
0
def getMeanStationVelocities1(stationTraces=None):
	# get station velocities from a set of station positions.
	# the previous way we did this was probaly pretty silly - which was just to average (x_i-x_{i-1})/dt.
	# in this method:  get positions; fit to a linear function: lat = lat0 + v_lat*t, lon = lon0 + v_lon*t
	#
	#if stationPositions==None: stationPositions=getStationPositions()
	times=map(operator.itemgetter(0), stationTraces[1:])
	#positions=[times]
	returnVelocities=[]
	lflon=yp.linefit()
	lflat=yp.linefit()
	for i in xrange(1, len(stationTraces[1])):
		thispositions=map(operator.itemgetter(i), stationTraces)
		thislats=map(operator.itemgetter(0), thispositions[1:])
		thislons=map(operator.itemgetter(1), thispositions[1:])
		thisStation = thispositions[0]
		#print "lens: %d, %d, %d" % (len(times), len(thislats), len(thislons))
		#
		# now, fit x,y to lines.
		lflon.datas=[times, thislons, scipy.zeros(len(thislons))+1]
		lflat.datas=[times, thislats, scipy.zeros(len(thislats))+1]
		#print lflon.datas
		lonfits=lflon.doFit()
		latfits=lflat.doFit()
		#
		#returnVelocities+=[[thisStation, lflon.a, lflat.a, lflon.b, lflat.b, lflon.varaprime, lflat.varaprime, lflon.varbprime, lflat.varbprime]]
		# note that we have returned the a parameter as well. this can be used to infer the expected starting position (aka, we do not treat
		# the first measurement as being special). obviously, use times[0] to get the starting position. be careful, since the raw lat/lon outputs
		# (a values) will look "normal" since movement is slow and t0 is relatively recent.
		#
		# but let's go ahead and return the starting position, as per the data set provided.
		lon0=lflon.a + lflon.b*times[0]
		lat0=lflat.a + lflat.b*times[0]
		returnVelocities+=[[thisStation, lon0, lat0, lflon.b, lflat.b, lflon.varaprime, lflat.varaprime, lflon.varbprime, lflat.varbprime]]
	
	return returnVelocities
Example #2
0
def plotMFIdistsRho(bclust=2.2, rhorange=[0.1, 1.0, 0.2], kmaxFP=10 ** 6, nMax=200, pim=4.9, fpmodel=1, fignums=[0, 1]):
    # rhorange = [minrho, maxrho, dRho]
    bofpim = []
    for fignum in fignums:
        plt.figure(fignum)
        plt.clf()
        plt.xlabel("$log_{10}(k)$", size=18)
        plt.ylabel("$log_{10}(N(k))$", size=18)

        #
    primeRhos = [0.1, 0.3, 0.5, 0.7, 0.9, 1.0]
    thisrho = rhorange[0]
    icount = 0
    while thisrho <= rhorange[1]:
        X = getMFIsquarePropModel(bclust, thisrho, pim, kmaxFP, nMax, fpmodel)
        x = []
        y1 = []
        y2 = []
        xstart = 25
        for rw in X:
            # print rw
            x += [math.log10(rw[2])]
            # print rw[3]
            y1 += [math.log10(rw[3])]
            y2 += [math.log10(rw[4])]
        lf1 = yp.linefit([x[xstart:], y1[xstart:]])
        lf2 = yp.linefit([x[xstart:], y2[xstart:]])
        lf1.doFit()
        lf2.doFit()
        # lf1.doFit(None, None, 3)
        # lf2.doFit(None, None, 3)
        #
        bofpim += [[pim, lf1.a, -lf1.b, lf1.meanVar(), lf2.a, -lf2.b, lf2.meanVar()]]
        plt.figure(fignums[0])
        plt.title("$\\beta=2.2$")
        plt.plot(
            x,
            y1,
            "%s.-" % yp.pycolor(icount),
            label="$\\rho = %s, \\epsilon=%s, b=%s$" % (str(thisrho), str(pim), str(-lf1.b)),
            lw=2,
        )  # beta!=2
        plt.plot(
            [x[0], x[xstart], x[-1]],
            [lf1.a + lf1.b * x[0], lf1.a + lf1.b * x[xstart], lf1.a + lf1.b * x[-1]],
            "%s|-" % yp.pycolor(icount),
            ms=15,
        )
        plt.figure(fignums[1])
        plt.title("$\\beta=2.0$")
        plt.plot(
            x,
            y2,
            "%s.-" % yp.pycolor(icount),
            label="$\\rho = %s, \\epsilon=%s, b=%s$" % (str(thisrho), str(pim), str(-lf2.b)),
            lw=2,
        )  # beta=2 approximation
        plt.plot(
            [x[0], x[xstart], x[-1]],
            [lf2.a + lf2.b * x[0], lf2.a + lf2.b * x[xstart], lf2.a + lf2.b * x[-1]],
            "%s|-" % yp.pycolor(icount),
            ms=15,
        )
        icount += 1
        #
        thisrho += rhorange[2]
    plt.show()
    #
    for fignum in fignums:
        plt.figure(fignum)
        plt.legend(loc="best")
    return bofpim
Example #3
0
def plotMFIdists2(
    bclust=2.2, rho=0.59, kmaxFP=10 ** 6, nMax=100, pimrange=[0.0, 5.0], doClf=[True, True, False], fpmodel=0
):
    # MFI dists with variable b(pim)
    # for now, just approximate values of bclust:
    bclust = [[0.0, 2.2], [1.0, 2.22], [2.0, 2.24], [3.0, 2.27], [4.0, 2.35], [4.6, 2.37]]
    # and for now, we know we're going to do .2 intervals, so:
    mybclusts = []
    for i in xrange(len(bclust)):
        # for rw in bclust:
        rw = bclust[i]
        mybclusts += [rw]
        if mybclusts[-1] == bclust[-1]:
            break
        # print mybclusts[-1]
        while mybclusts[-1][0] < bclust[i + 1][0]:
            mybclusts += [[mybclusts[-1][0] + 0.2, mybclusts[-1][1]]]
        # return mybclusts
        #

    pim = pimrange[0]
    bofpim = []
    plt.figure(0)
    if doClf[0]:
        plt.clf()
    plt.figure(1)
    if doClf[1]:
        plt.clf()

    i = 0
    while pim <= pimrange[1]:
        # X=getMFIsquarePropModel(bclust, rho, pim, kmaxFP, nMax)
        X = getMFIsquarePropModel(mybclusts[i][1], rho, pim, kmaxFP, nMax, fpmodel)
        x = []
        y1 = []
        y2 = []
        for rw in X:
            # print rw
            x += [math.log(rw[2])]
            y1 += [math.log(rw[3])]
            y2 += [math.log(rw[4])]
        lf1 = yp.linefit([x[1:], y1[1:]])
        lf2 = yp.linefit([x[1:], y2[1:]])

        lf1.doFit()
        lf2.doFit()
        #
        bofpim += [[pim, lf1.a, -lf1.b, lf1.meanVar(), lf2.a, -lf2.b, lf2.meanVar()]]

        plt.figure(0)
        # plt.loglog(map(operator.itemgetter(2), X), map(operator.itemgetter(3), X), '.-')
        plt.plot(x, y1, ".-", label="pim=%s, b=%s" % (str(pim), str(-lf1.b)))
        plt.figure(1)
        # plt.loglog(map(operator.itemgetter(2), X), map(operator.itemgetter(4), X), '.-')
        plt.plot(x, y2, ".-", label="pim=%s, b=%s" % (str(pim), str(-lf2.b)))
        #
        pim += 0.2
        i += 1
    plt.figure(0)
    plt.legend(loc="upper right")
    plt.figure(1)
    plt.legend(loc="upper right")

    plt.figure(2)
    plt.clf()
    plt.plot(
        map(operator.itemgetter(0), bofpim),
        map(operator.itemgetter(2), bofpim),
        ".-",
        label="$ beta =2.2, rho = %s $" % str(rho),
        lw=2,
    )
    plt.plot(
        map(operator.itemgetter(0), bofpim),
        map(operator.itemgetter(5), bofpim),
        ".-",
        label="$ beta =2.0,  rho = %s $" % str(rho),
        lw=2,
    )
    plt.xlabel("$p_{immune}$", size=16)
    plt.ylabel("$b_{fires}$", size=16)
    plt.legend(loc="best")

    plt.show()
    #
    return bofpim
Example #4
0
def plotMFIdistsBetaEps(bclust=2.2, kmaxFP=10 ** 9, nMax=200, pimrange=[0.0, 5.0, 1.0], beta=1.25, fignums=[0, 1]):
    # def plotMFIdistsBetaEps(bclust=2.2, kmaxFP=10**9, nMax=200, pimlist=[0.0,1.0, 2.0, 3.0, 4.0, 4.9], beta=1.25, fignums=[0,1]):
    # (this function is probably redundant. same as ...Beta(), but fix beta and range over pim.) we know we get nice PL
    # when we vary the shape dimension. what about if we fix D (beta) and vary eps. with the fractal-footprint?
    #
    # fig 5 in PRE pub.
    #
    # pimrange=[0.0,4.9,1.]
    # "beta" version, use footprint ~ n**beta 1<beta<2.0 (or maybe 2.25 or something).
    # for now, fixed epsilon (pim), fixed rho.
    # rhorange = [minrho, maxrho, dRho]
    # note: bcluse is slope of b-distribution, beta is the exponent for shape area/raduis (n) scaling.
    fsize = 20
    thisfont = pltf.FontProperties(size=fsize)
    thisfont2 = pltf.FontProperties(size=fsize - 2)
    #
    fpmodel = 2  # aka, MFI with fractal dimension treatment (as opposed to solid shapes, etc.)
    rho = 1.0  # basically, this puts all the empty sites into the fractal/branching structure.
    thisrho = rho
    bofpim = []
    for fignum in fignums:
        plt.figure(fignum)
        plt.clf()
        plt.xlabel("$log_{10}(k)$", size=fsize + 2)
        plt.ylabel("$log_{10}(N(k))$", size=fsize + 2)
        #
        # starts=[]
        #
    primeRhos = [0.1, 0.3, 0.5, 0.7, 0.9, 1.0]
    # thisrho=rhorange[0]
    icount = 0
    # while thisrho<=rhorange[1]:
    # for beta in betas:
    pim = pimrange[0]
    pim0 = pim
    while pim0 <= pimrange[1]:
        # for pim in pimlist:
        # X=getMFIsquarePropModel(bclust, thisrho, pim, kmaxFP, nMax, fpmodel)
        pim = pim0
        if pim > 4.9:
            pim = 4.9
        print "prams: %s, %s, %s, %s, %s, %s, %s" % (bclust, thisrho, pim, kmaxFP, nMax, fpmodel, beta)
        # pim=pimrange[0]+float(icount)*pimrange[2]
        X = getMFIsquarePropModel(bclust, thisrho, pim, kmaxFP, nMax, fpmodel, beta)
        print "beta=%f, len=%d" % (beta, len(X))
        x = []
        y1 = []
        y2 = []
        # xstart=25
        xstart = 15
        sxtop = 500
        for rw in X:
            # print rw
            x += [math.log10(rw[2])]
            # print rw[3]
            y1 += [math.log10(rw[3])]
            y2 += [math.log10(rw[4])]
        lf1 = yp.linefit([x[xstart:], y1[xstart:]])
        lf2 = yp.linefit([x[xstart:], y2[xstart:]])
        lf1.doFit()
        lf2.doFit()
        # lf1.doFit(None, None, 3)
        # lf2.doFit(None, None, 3)
        #
        dotsies = yp.integerSpacedPoints([x[1:], y1[1:]], 0.5)
        dotsies[0] += [x[-1]]
        dotsies[1] += [y1[-1]]
        if fpmodel > 1:
            bofpim += [[pim, beta, lf1.a, -lf1.b, lf1.meanVar(), lf2.a, -lf2.b, lf2.meanVar()]]
        else:
            bofpim += [[pim, lf1.a, -lf1.b, lf1.meanVar(), lf2.a, -lf2.b, lf2.meanVar()]]
        plt.figure(fignums[0])
        # plt.title('$\\beta=2.2$')
        # plt.plot(x[1:],y1[1:],'%s.-' % yp.pycolor(icount), label='$\\rho = %s, \\epsilon=%s, D=%s, b=%s$' % (str(thisrho), str(pim), str(beta), str(-lf1.b)[0:5]), lw=2)		# beta!=2
        plt.plot(
            dotsies[0],
            dotsies[1],
            "%s%s" % (yp.pycolor(icount), yp.fitMarkerShortList[icount % len(yp.fitMarkerShortList)]),
            label="$\\epsilon=%s, b=%s$" % (str(pim), str(-lf1.b)[0:5]),
            ms=10,
        )
        plt.plot(x[1:], y1[1:], "%s-" % yp.pycolor(icount), lw=2, ms=10)  # beta!=2
        plt.plot(
            [x[0], x[xstart], x[-1]],
            [lf1.a + lf1.b * x[0], lf1.a + lf1.b * x[xstart], lf1.a + lf1.b * x[-1]],
            "%s|-" % yp.pycolor(icount),
            ms=15,
        )
        plt.figure(fignums[1])
        # plt.title('$\\beta=2.0$')
        # plt.plot(x[1:], y2[1:], '%s.-' % yp.pycolor(icount), label='$\\rho = %s, \\epsilon=%s, D=%s, b=%s$' % (str(thisrho), str(pim), str(beta), str(-lf2.b)[0:5]), lw=2)		# beta=2 approximation
        plt.plot(
            x[1:],
            y2[1:],
            "%s.-" % yp.pycolor(icount),
            label="$\\epsilon=%s, b=%s$" % (str(pim), str(-lf2.b)[0:5]),
            lw=2,
            ms=10,
        )  # beta=2
        plt.plot(
            [x[0], x[xstart], x[-1]],
            [lf2.a + lf2.b * x[0], lf2.a + lf2.b * x[xstart], lf2.a + lf2.b * x[-1]],
            "%s|-" % yp.pycolor(icount),
            ms=15,
        )
        icount += 1
        pim0 += pimrange[2]
        #
        # thisrho+=rhorange[2]
        #
    for fignum in fignums:
        plt.figure(fignum)
        ax = plt.gca()
        plt.subplots_adjust(bottom=0.15)
        plt.setp(ax.get_xticklabels(), fontsize=fsize)
        plt.setp(ax.get_yticklabels(), fontsize=fsize)

        # lgd=plt.legend(loc='best', numpoints=1, title='$D=1.25$', prop=thisfont2, ncol=1)
        lgd = plt.legend(loc="best", numpoints=1, prop=thisfont2, ncol=1)
        lgd.set_title("$D=1.25$")
        plt.setp(lgd.get_title(), fontsize=fsize)
        if fignum > 0:
            continue
        plt.savefig(
            "writeup/mfi-aps/mfi-PRE-letter/figs/mfi-fractalType-varEps-bc%s-D125.png" % str(bclust).replace(".", "")
        )
        plt.savefig(
            "writeup/mfi-aps/mfi-PRE-letter/figs/mfi-fractalType-varEps-bc%s-D125.eps" % str(bclust).replace(".", "")
        )
    plt.show()

    return bofpim
Example #5
0
def plotMFIdistsBeta(
    bclust=2.2,
    kmaxFP=10 ** 9,
    nMax=200,
    pim=4.9,
    betas=[0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.5],
    fignums=[0, 1],
    dosave=False,
):
    # "Fig-4" in PRE publication.
    #
    # "beta" version, use footprint ~ n**beta 1<beta<2.0 (or maybe 2.25 or something).
    # for now, fixed epsilon (pim), fixed rho.
    # rhorange = [minrho, maxrho, dRho]
    # note: bcluse is slope of b-distribution, beta is the exponent for shape area/raduis (n) scaling.
    fpmodel = 2
    rho = 1.0  # basically, this puts all the empty sites into the fractal/branching structure.
    thisrho = rho
    #
    fsize = 20
    thisfont = pltf.FontProperties(size=fsize)
    thisfont2 = pltf.FontProperties(size=fsize - 2)
    #
    bofpim = []
    for fignum in fignums:
        plt.figure(fignum)
        plt.clf()
        plt.xlabel("$log_{10}(k)$", size=fsize + 2)
        plt.ylabel("$log_{10}(N(k))$", size=fsize + 2)
        #
        # starts=[]
        #
    primeRhos = [0.1, 0.3, 0.5, 0.7, 0.9, 1.0]
    # thisrho=rhorange[0]
    icount = 0
    # while thisrho<=rhorange[1]:
    fitMarkerShortList = ["o", "^", "s", "p", "*", "h", "+", "H", "D", "x"]
    for beta in betas:
        # X=getMFIsquarePropModel(bclust, thisrho, pim, kmaxFP, nMax, fpmodel)
        print "prams: %s, %s, %s, %s, %s, %s, %s" % (bclust, thisrho, pim, kmaxFP, nMax, fpmodel, beta)
        X = getMFIsquarePropModel(bclust, thisrho, pim, kmaxFP, nMax, fpmodel, beta)
        print "beta=%f, len=%d" % (beta, len(X))
        x = []
        y1 = []
        y2 = []
        # xstart=25
        xstart = 2
        sxtop = 500
        for rw in X:
            # print rw
            x += [math.log10(rw[2])]
            # print rw[3]
            y1 += [math.log10(rw[3])]
            y2 += [math.log10(rw[4])]
        lf1 = yp.linefit([x[xstart:], y1[xstart:]])
        lf2 = yp.linefit([x[xstart:], y2[xstart:]])
        lf1.doFit()
        lf2.doFit()
        # lf1.doFit(None, None, 3)
        # lf2.doFit(None, None, 3)
        #
        if fpmodel > 1:
            bofpim += [[pim, beta, lf1.a, -lf1.b, lf1.meanVar(), lf2.a, -lf2.b, lf2.meanVar()]]
        else:
            bofpim += [[pim, lf1.a, -lf1.b, lf1.meanVar(), lf2.a, -lf2.b, lf2.meanVar()]]
        plt.figure(fignums[0])
        # plt.title('$\\beta=2.2$')
        # plt.plot(x[1:],y1[1:],'%s.-' % yp.pycolor(icount), label='$\\rho = %s, \\epsilon=%s, \\beta_s=%s, b=%s$' % (str(thisrho), str(pim), str(beta), str(-lf1.b)[0:5]), lw=2)		# beta!=2
        dotsies = yp.integerSpacedPoints([x[1:], y1[1:]], 0.5)
        dotsies[0] += [x[-1]]
        dotsies[1] += [y1[-1]]  # add end-bits for completeness.
        plt.plot(x[1:], y1[1:], "%s-" % yp.pycolor(icount), lw=2, ms=10)  # beta!=2
        plt.plot(
            dotsies[0],
            dotsies[1],
            "%s%s" % (yp.pycolor(icount), fitMarkerShortList[icount % len(fitMarkerShortList)]),
            label="$D=%s, b=%s$" % (str(beta), str(-lf1.b)[0:5]),
            ms=10,
        )
        plt.plot(
            [x[0], x[xstart], x[-1]],
            [lf1.a + lf1.b * x[0], lf1.a + lf1.b * x[xstart], lf1.a + lf1.b * x[-1]],
            "%s|-" % yp.pycolor(icount),
            ms=20,
            lw=2,
        )
        #
        plt.figure(fignums[1])
        # plt.title('$\\beta=2.0$')
        # plt.plot(x[1:], y2[1:], '%s.-' % yp.pycolor(icount), label='$\\rho = %s, \\epsilon=%s, \\beta_s=%s, b=%s$' % (str(thisrho), str(pim), str(beta), str(-lf2.b)[0:5]), lw=2)		# beta=2 approximation
        plt.plot(
            x[1:],
            y2[1:],
            "%s.-" % yp.pycolor(icount),
            label="$D=%s, b=%s$" % (str(beta), str(-lf2.b)[0:5]),
            lw=2,
            ms=10,
        )  # beta=2 approximation
        plt.plot(
            [x[0], x[xstart], x[-1]],
            [lf2.a + lf2.b * x[0], lf2.a + lf2.b * x[xstart], lf2.a + lf2.b * x[-1]],
            "%s|-" % yp.pycolor(icount),
            ms=15,
            lw=2,
        )
        icount += 1
        #
        # thisrho+=rhorange[2]
        #
    for fignum in fignums:
        plt.figure(fignum)
        ax = plt.gca()
        plt.subplots_adjust(bottom=0.15)
        plt.setp(ax.get_xticklabels(), fontsize=fsize)
        plt.setp(ax.get_yticklabels(), fontsize=fsize)

        # plt.legend(loc='best', numpoints=1, prop=thisfont2, ncol=1, title='$\\epsilon=4.9$')
        lgd = plt.legend(loc="best", numpoints=1, prop=thisfont2, ncol=1)
        lgd.set_title("$\\epsilon=4.9$")
        plt.setp(lgd.get_title(), fontsize=fsize)
        # mfi-fractalType-varEps-bc22-D125
        if fignum > 0:
            continue
        if dosave:
            plt.savefig(
                "writeup/mfi-aps/mfi-PRE-letter/figs/mfi-fractalType-eps49-bc%s-varD.png" % str(bclust).replace(".", "")
            )
            plt.savefig(
                "writeup/mfi-aps/mfi-PRE-letter/figs/mfi-fractalType-eps49-bc%s-varD.eps" % str(bclust).replace(".", "")
            )
    plt.show()
    return bofpim
Example #6
0
def plotMFIdists(
    bclust=2.2, rho=0.59, kmaxFP=10 ** 6, nMax=200, pimrange=[0.0, 4.9], doClf=[True, True, False], fpmodel=1, lineNum=0
):
    # pim=0.0
    # lineNum is the index of the line on the plot when we plot multiple lines on a single canvas.
    beta = 1.5
    print "lineNum: %d" % lineNum
    xstart = 15
    pim = pimrange[0]
    bofpim = []
    plt.figure(0)
    if doClf[0]:
        plt.clf()
    plt.figure(1)
    if doClf[1]:
        plt.clf()

    plt.figure(3)
    plt.clf()
    plt.figure(4)
    plt.clf()
    # primePims=[0.0, .4, 1.0, 1.4, 2.0, 2.4, 3.0, 3.4, 4.0, 4.6, 4.8]
    # primePims=[0, 4, 10, 14, 20, 24, 30, 34, 40, 46, 49]
    primePims = [0, 10, 20, 30, 40, 48]

    icount = -1
    icount2 = 0
    while pim <= (pimrange[1] + 0.0001):
        print pim
        icount += 1
        X = getMFIsquarePropModel(bclust, rho, pim, kmaxFP, nMax, fpmodel, beta)
        x = []
        y1 = []
        y2 = []
        for rw in X:
            # print rw
            x += [math.log10(rw[2])]
            # print rw[3]
            y1 += [math.log10(rw[3])]
            y2 += [math.log10(rw[4])]
        lf1 = yp.linefit([x[xstart:], y1[xstart:]])
        lf2 = yp.linefit([x[xstart:], y2[xstart:]])
        lf1.doFit()
        lf2.doFit()
        # lf1.doFit(None, None, 3)
        # lf2.doFit(None, None, 3)
        #
        bofpim += [[pim, lf1.a, -lf1.b, lf1.meanVar(), lf2.a, -lf2.b, lf2.meanVar()]]
        a1 = bofpim[-1][1]
        b1 = bofpim[-1][2]
        a2 = bofpim[-1][4]
        b2 = bofpim[-1][5]

        plt.figure(0)
        # plt.loglog(map(operator.itemgetter(2), X), map(operator.itemgetter(3), X), '.-')
        plt.plot(x, y1, "%s.-" % yp.pycolor(icount), label="$\\epsilon=%s, b=%s$" % (str(pim), str(-lf1.b)))  # beta!=2
        # plt.plot([x[0], x[-1]], [a1-b1*x[0], a1-b1*x[-1]], '%s*-' % yp.pycolor(icount))
        #
        plt.figure(1)
        # plt.loglog(map(operator.itemgetter(2), X), map(operator.itemgetter(4), X), '.-')
        plt.plot(
            x, y2, "%s.-" % yp.pycolor(icount), label="$\\epsilon=%s, b=%s$" % (str(pim), str(-lf2.b))
        )  # beta=2 approximation
        # plt.plot([x[0], x[-1]], [a2-b2*x[0], a2-b2*x[-1]], '%s*-' % yp.pycolor(icount))
        #
        # plt.loglog(map(operator.itemgetter(2), X), map(operator.itemgetter(3), X), '.-')
        if int(10.0 * pim) in primePims:
            plt.figure(3)
            plt.plot(
                x,
                y1,
                "%s.-" % yp.pycolor(icount2),
                label="$\\epsilon=%s, b=%s$" % (str(pim), str(-round(lf1.b, 2))),
                lw=2,
            )
            plt.plot(
                [x[0], x[xstart], x[-1]],
                [a1 - b1 * x[0], a1 - b1 * x[xstart], a1 - b1 * x[-1]],
                "%s*-" % yp.pycolor(icount2),
            )
            plt.figure(4)
            plt.plot(
                x,
                y2,
                "%s.-" % yp.pycolor(icount2),
                label="$\\epsilon=%s, b=%s$" % (str(pim), str(-round(lf2.b, 2))),
                lw=2,
            )
            plt.plot(
                [x[0], x[xstart], x[-1]],
                [a2 - b2 * x[0], a2 - b2 * x[xstart], a2 - b2 * x[-1]],
                "%s*-" % yp.pycolor(icount2),
            )
            icount2 += 1
        pim += 0.2

        plt.figure(0)
    plt.legend(loc="upper right")
    plt.figure(1)
    plt.legend(loc="upper right")
    plt.figure(3)
    plt.legend(loc="lower left")
    plt.xlabel("$log(k)$", size=18)
    plt.ylabel("$log(N(k))$", size=18)
    plt.figure(4)
    plt.legend(loc="lower left")
    plt.xlabel("$log(k)$", size=18)
    plt.ylabel("$log(N(k))$", size=18)
    for i in xrange(5):
        plt.figure(i)
        plt.title("$\\rho=%f$" % rho)

    plt.figure(2)
    if doClf[2]:
        plt.clf()
    # if int(10.0*pim) in primePims:
    plt.plot(
        map(operator.itemgetter(0), bofpim),
        map(operator.itemgetter(2), bofpim),
        "%s.-" % yp.pycolor(lineNum),
        label="$ \\beta = 2.2, \\rho = %s $" % str(rho),
        lw=2,
    )
    plt.plot(
        map(operator.itemgetter(0), bofpim),
        map(operator.itemgetter(5), bofpim),
        "%s>-" % yp.pycolor(lineNum),
        label="$ \\beta = 2.0,  \\rho = %s $" % str(rho),
        lw=2,
    )
    plt.xlabel("$\\epsilon$", size=18)
    plt.ylabel("$b_{fires}$", size=18)
    plt.show()
    #
    return bofpim