Example #1
0
    plotnum = [False for i in range(15)]
    if len(sys.argv) < 2:
        print help
        exit()
    else:
        plotnum[int(sys.argv[1])] = True
    ####################################################

    ## Figure Properties #######
    width = 12
    height = 9
    legsize = width + 3
    ###########################
    ## Prep Data
    arg = Args()
    arg.addQuery("status", "eq", "processed-ok")
    # Load station params
    d = Params(stnfile, ["hk::H","hk::R"], arg)

    arg = Args()
    m = Params(moonfile, ["H","Vp"])
    m.filter(arg.addQuery("geoprov", "not in", "oceanic"))
    m.filter(arg.addQuery("geoprov", "not in", "Shelf"))

    #######################################################################
    # F0
    # CANADA
    if plotnum[0]:
    ## Kanamori Poisson Histogram
        # Set figure
    plotnum = [False for i in range(15)]
    if len(sys.argv) < 2:
        print help
        exit()
    else:
        plotnum[int(sys.argv[1])] = True
    ####################################################

    ## Figure Properties #######
    width = 12
    height = 5
    legsize = height + 3
    ###########################
    ## Prep Data
    arg = Args()
    arg.addQuery("status", "eq", "processed-ok")
    # Load station params
    d = Params(stnfile, ["hk::H", "hk::R"], arg)

    arg = Args()
    m = Params(moonfile, ["H", "Vp"])
    m.filter(arg.addQuery("geoprov", "not in", "oceanic"))
    m.filter(arg.addQuery("geoprov", "not in", "Shelf"))

    #######################################################################
    # F0
    # CANADA
    if plotnum[0]:
        ## Kanamori Poisson Histogram
        # Set figure
Example #3
0
'''
if len(sys.argv) < 2:
    print help
else:
    plotnum[int(sys.argv[1])] = True


def poisson(R):
    ''' Function to go from Vp/Vs -> Poisson's ratio '''
    return ((R**2 - 2) / (2 * (R**2 - 1)))


#######################################################################
# F0
if plotnum[0]:
    arg1 = Args()
    arg1.addQuery("hk::H", "lt", "45")
    arg2 = Args()
    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"])
Example #4
0
######################
'''
if len(sys.argv) < 2:
    print help
else:
    plotnum[int(sys.argv[1])] = True


def poisson(R):
    ''' Function to go from Vp/Vs -> Poisson's ratio '''
    return  ( (R**2 - 2) / (2*(R**2 - 1)))

#######################################################################
# F0
if plotnum[0]:
    arg1 = Args()
    arg1.addQuery("hk::H", "lt", "45")
    arg2 = Args()
    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"])
Example #5
0
def rmsDifference(x, y):
    assert (len(x) == len(y))
    n = len(x)
    md = 0
    for i in range(n):
        md += (x[i] - y[i])**2

    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
def printinfo(msg, ixs, d, details):
    print "total stations examined:", len(d.stns)
    for jj in range(0,4):
        print msg[jj]
        ix = ixs[jj]
        for ii, stn in enumerate(d.stns[ix]):
            if details:
                print stn, d.hk_c0R[ix][ii], d.hk_c1R[ix][ii]
            else:
                pass
        print "number of stations:", len(d.stns[ix])


#details = False
#printinfo(msg, ixs, d, details)
arg = Args().stations( list(d.stns[ixs[2]]) )
arg.addQuery("status", "eq", "processed-notok")
d.filter(arg)
for stn in d.stns:
    print stn

d = Params(stnfile, ["hk::H","hk::R", "hk::stdR", "hk::c0R", "hk::c1R"])
d.filter(Args().addQuery("status", "in", "processed"))
arg = Args()
arg.stations(list(d.stns[ixs[0]]))
arg.addQuery("status", "eq", "processed-ok")
d.filter(arg)

#for station in d.stns:
#    print station
#print np.fabs(d.hk_c1R - d.hk_c0R)
Example #7
0
###########################################################################
# IMPORTS
###########################################################################
import os, json
import numpy as np
import matplotlib.pyplot as plt
from plotTools import Args, Params

stnfile = os.environ['HOME'] + '/thesis/data/stations.json'
#stdict = json.loads( dbfile.read() )

lim = 0.055

# Load station params
d = Params(stnfile, ["hk::H", "hk::R", "hk::stdR", "hk::c0R", "hk::c1R"])
d.filter(Args().addQuery("status", "in", "processed"))

ix1 = np.abs(d.hk_c0R - d.hk_R) < 2 * d.hk_stdR
ix2 = np.abs(d.hk_c1R - d.hk_R) < 2 * d.hk_stdR
ix3 = np.abs(d.hk_c1R - d.hk_c0R) < lim

ixfail3 = (np.logical_not(ix1) | np.logical_not(ix2)) & np.logical_not(ix3)
ixfail2 = (np.logical_not(ix1) | np.logical_not(ix2)) & ix3
ixpass3 = (ix1 & ix2) & ix3
ixpass2 = (ix1 & ix2) & np.logical_not(ix3)

msg = [
    "For stations failing (1) or (2) and (3) there is a likely significant lateral heterogeneity or some processing flaw and the station may be marked as unused.",
    "For stations failing (1) or (2) but passing (3) the data may be reasonable but my bootstrap error estimate is much too kind. Readjustment of error required.",
    "For station passing (1) and (2) and (3), Great.",
    "For stations passing (1) and (2) but failing (3) the cluster Vp/Vs difference may be above the arbitrary cut-off of +\- 0.05 but could be included provided the std Vp/Vs error is not above some other arbitrarily chosen cap."
Example #8
0
    plotnum = [False for i in range(15)]
    if len(sys.argv) < 2:
        print help
        exit()
    else:
        plotnum[int(sys.argv[1])] = True
    ####################################################

    ## Figure Properties #######
    width = 12
    height = 5
    legsize = height + 3
    ###########################
    ## Prep Data
    arg = Args()
    arg.addQuery("status", "eq", "processed-ok")
    # Load station params
    d = Params(stnfile, ["hk::H","hk::R"], arg)

    arg = Args()
    m = Params(moonfile, ["H","Vp"])
    m.filter(arg.addQuery("geoprov", "not in", "oceanic"))
    m.filter(arg.addQuery("geoprov", "not in", "Shelf"))

    #######################################################################
    # F0
    # CANADA
    if plotnum[0]:
    ## Kanamori Poisson Histogram
        # Set figure
Example #9
0
        plt.plot(M[0], M[1], 'ob', lw = lw, ms = ms, label = "normalized Vp vs H")
        plt.plot(x2, y2,'--r', lw = lw, label="Primary PCA: variance = {:2.1f}%".format(var[0]*100))
        plt.plot(x1, y1,'--g', lw = lw, label="Secondary PCA: variance = {:2.1f}%".format(var[1]*100))

        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)