avgv = []

        provs = ["Churchill Province", "Superior Province", "Slave Province", "Grenville Province"]

        color = ["b", "g", "m", "y", "k", "c"]
        handles = ()
        labels = ()
        plt.subplots_adjust(left=None, bottom=None, right=0.75, top=None, wspace=None, hspace=0.05)

        for (ii, province) in enumerate(provs):

            d.reset()
            arg = Args()
            arg.addQuery("geoprov", "in", province)
            d2 = Params(stnfile, ["hk::H", "hk::R"], arg)
            d.sync(d2)

            prov = province.replace(" ", "")
            dk, avgdk, bins, ptype = getdata("kan", d, m, vdict, prov)
            avgp.append(avgdk)

            ax = plt.subplot(4, 1, ii + 1)

            n, bins, patches = plt.hist(
                dk, bins=bins, histtype="bar", color=color[ii], rwidth=1, alpha=0.6, label=province
            )

            handle, label = ax.get_legend_handles_labels()
            handles += (handle[0],)
            labels += (label[0],)
Beispiel #2
0
    arg2.addQuery("hk::H", "lt", "40")
    arg3 = Args()
    arg3.addQuery("hk::H", "lt", "35")
    arg4 = Args()

    fstns = os.environ['HOME'] + '/thesis/stations.json'

    a = Params(fstns, arg1, ["mb::H"])
    b = Params(fstns, arg2, ["mb::H"])
    c = Params(fstns, arg2, ["hk::H"])
    d = Params(fstns, arg3, ["hk::H"])
    e = Params(fstns, arg3, ["wm::H"])
    f = Params(fstns, arg4, ["wm::H"])

    lena = len(a.mb_H)
    a.sync(b)
    assert len(a.reset().mb_H) == lena

    assert np.equal(a.sync(b).mb_H, b.sync(a).mb_H).all()

    c.sync(d.sync(e.sync(f)))

    for ii in range(len(f.stns)):
        assert c.stns[ii] == f.stns[ii]
        assert c.hk_H[ii] == d.hk_H[ii]

    assert f.sync(d) == f.reset().sync(e)

    c.reset()
    d.reset()
    e.reset()
Beispiel #3
0
    arg3 = Args()
    arg3.addQuery("hk::H", "lt", "35")
    arg4 = Args()

    fstns = os.environ['HOME'] + '/thesis/stations.json'

    a = Params(fstns, arg1, ["mb::H"])
    b = Params(fstns, arg2, ["mb::H"])
    c = Params(fstns, arg2, ["hk::H"])
    d = Params(fstns, arg3, ["hk::H"])
    e = Params(fstns, arg3, ["wm::H"])
    f = Params(fstns, arg4, ["wm::H"])


    lena = len(a.mb_H)
    a.sync(b)
    assert len(a.reset().mb_H) == lena

    assert np.equal(a.sync(b).mb_H, b.sync(a).mb_H).all()

    c.sync(d.sync(e.sync(f)))

    for ii in range(len(f.stns)):
        assert c.stns[ii] == f.stns[ii]
        assert c.hk_H[ii] == d.hk_H[ii]

    assert f.sync(d) == f.reset().sync(e)

    c.reset()
    d.reset()
    e.reset()
Beispiel #4
0
    return np.sqrt(md / (n))


for i in range(1, 2):

    pro = os.environ['HOME'] + data[2 * i + 1]
    pub = os.environ['HOME'] + data[2 * i]

    arg = Args().addQuery("stdR", "lt", 0.06)

    p0 = Params(pro, ["H", "R", "stdR", "stdH"], arg)
    p2 = Params(pub, ["H", "R", "stdR", "stdH"], arg)

    p1 = Params(stnfile, ["hk::H", "hk::R", "hk::stdR", "hk::stdH"])

    p0.sync(p2)

    stns = p0.stns

    R1 = p0.R
    R2 = p2.R

    H1 = p0.H
    H2 = p2.H

    R1std = p0.stdR
    R2std = p2.stdR

    H1std = p0.stdH
    H2std = p2.stdH
Beispiel #5
0
    plt.legend(loc= 2)
    plt.ylabel("Station Vp [km/s]")
    plt.xlabel("Station Thickness H [km]")
    plt.grid(True)


    #############################################################################
    # Vp estimates and controlled source
    ##############################################################################
    arg = Args().stations(["ALE","ALGO","ARVN","BANO","CBRQ","DAWY","DELO","FCC","FFC","HAL","KGNO","KSVO","LMN","MBC","MNT","MOBC","ORIO","PEMO","PGC","PLVO","PMB","PTCO","SJNN","SUNO","ULM","ULM2","WAPA ","WHY","WSLR ","YKW1","YOSQ"])
    m.filter(arg)
    m.filter(Args().addQuery("mb::Vp", "gt", "5.5"))
    m.filter(Args().addQuery("mb::stdVp", "lt", "0.8"))

    c = Params(csfile, ["H","Vp"])
    c.sync(m)

    stdVp = 2 * m.mb_stdVp # 2 stdError
    t = np.arange(len(m.mb_Vp[0:11]))

    corr = spearmanr(m.mb_Vp[0:11], c.Vp[0:11])
    fig = plt.figure( figsize = (width, height) )
    plt.plot(t, m.mb_Vp[0:11], '-ob', lw = 4, ms = 12, label = "Bostock (2010) Vp estimate")
    plt.errorbar(t, m.mb_Vp[0:11], yerr=stdVp[0:11], xerr=None, fmt=None, ecolor = 'blue',
                 elinewidth = 2, capsize = 7, mew = 2, label = "2 std dev Bootstrap")
    plt.plot(t, c.Vp[0:11], '-og', lw = 4, ms = 12, label = "Proximal active source estimate")
    plt.title("Active Source P-wave velocity comparison\n Correlation = {0:2.3f}".format(corr[0]), size = 18)
    plt.legend()
    plt.xlabel("Stations")
    plt.ylabel("Vp [km/s]")
    plt.xticks(t, c.stns[0:11], size = 12)
Beispiel #6
0
            "Grenville Province"
            ]

        color = ['b', 'g', 'm', 'y', 'k', 'c']
        handles = ()
        labels = ()
        plt.subplots_adjust(left= None, bottom=None, right = 0.75, top=None,
                            wspace=None, hspace=0.05)

        for (ii, province) in enumerate(provs):

            d.reset()
            arg = Args()
            arg.addQuery("geoprov", "in", province)
            d2 = Params(stnfile,  ["hk::H","hk::R"], arg)
            d.sync(d2)

            prov = province.replace(" ", "")
            dk, avgdk, bins, ptype = getdata("kan", d, m, vdict, prov)
            avgp.append( avgdk )

            ax = ( plt.subplot(4,1,ii + 1) )

            n, bins, patches = plt.hist(dk, bins = bins, histtype = "bar",
                     color = color[ii], rwidth = 1, alpha = 0.6,
                     label = province)

            handle, label = ax.get_legend_handles_labels()
            handles += (handle[0],)
            labels += (label[0],)
    return np.sqrt(md/(n))


for i in range(1,2):

    pro = os.environ['HOME'] + data[2*i + 1]
    pub = os.environ['HOME'] + data[2*i]

    arg = Args().addQuery("stdR", "lt", 0.06)

    p0 = Params(pro, ["H", "R", "stdR", "stdH"], arg)
    p2 = Params(pub, ["H", "R", "stdR", "stdH"], arg)

    p1 = Params(stnfile, ["hk::H","hk::R", "hk::stdR", "hk::stdH"])

    p0.sync(p2)

    stns = p0.stns

    R1 = p0.R
    R2 = p2.R

    H1 = p0.H
    H2 = p2.H

    R1std = p0.stdR
    R2std = p2.stdR

    H1std = p0.stdH
    H2std = p2.stdH
Beispiel #8
0
        plt.legend(loc= 2, prop={'size': leg})
        plt.ylabel("normalized Vp", size = label)
        plt.xlabel("normalized H", size = label)
        plt.grid(True)
        plt.axis("equal")

    #############################################################################
    # FIG 2: Vp estimates and controlled source
    ##############################################################################
    if 0:
        maxerr = 0.25#0.24#0.21
        arg = Args().addQuery("fg::stdVp", "lt", str(maxerr))
        f = Params(stnfile, ["fg::H","fg::Vp", "fg::stdH", "fg::stdVp", "hk::stdR"], arg)

        c = Params(csfile, ["H","Vp"])
        c.sync(f)

        stdVp = 2 * f.fg_stdVp # 2 stdError
        stdH = 2 * f.fg_stdH
        t = np.arange(len(f.fg_Vp))

        corr = pearsonr(f.fg_Vp, c.Vp)
        print "Active Source vs FG Vp with {} stations: correlation = {}".format(len(f.stns), corr[0])


        fig = plt.figure()
        ax1 = fig.add_subplot(111)


        l1=ax1.plot(t, f.fg_Vp, '-ob', lw = lw, ms = ms, label = "Full Gridsearch Vp estimate")
        l2=ax1.errorbar(t, f.fg_Vp, yerr=stdVp, xerr=None, fmt=None, ecolor = 'blue',