コード例 #1
0
        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
        fig = plt.figure(figsize=(width, height))
        ax = plt.subplot(111)
        # Get data
コード例 #2
0

#######################################################################
# 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"])

    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)):
コード例 #3
0
    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"])


    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)))
コード例 #4
0
ファイル: vpPlots.py プロジェクト: padhys/Masters-Thesis
    M = (A - np.mean(A.T,axis=1)).T # subtract the mean (along columns)
    [latent,coeff] = np.linalg.eig( np.cov(M))
    p = np.size(coeff,axis=1)
    idx = np.argsort(latent) # sorting the eigenvalues
    idx = idx[::-1]       # in ascending order
    # sorting eigenvectors according to the sorted eigenvalues
    coeff = coeff[:,idx]
    latent = latent[idx] # sorting eigenvalues
    if numpc < p or numpc >= 0:
        coeff = coeff[:,range(numpc)] # cutting some PCs
        score = np.dot(coeff.T, M) # projection of the data in the new space
        return coeff, score, latent

if __name__  == "__main__":

    m = Params(stnfile, ["mb::H","mb::Vp", "mb::stdVp"])
    # m = Params(stnfile, ["hk::H","hk::R", "hk::stdR"])
    # m.mb_H = m.hk_H
    # m.mb_Vp = m.hk_R

    ## Figure Properties #######
    width = 12
    height = 9
    legsize = width + 3
    ###########################


    #############################################################################
    # Vp estimates against H
    ##############################################################################
    A = np.vstack( (m.mb_H, m.mb_Vp) )
コード例 #5
0
    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

    R1std = p0.stdR
コード例 #6
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.",
コード例 #7
0
# python-mode comment/uncomment region M-;
###########################################################################
# 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.",
コード例 #8
0
        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
        fig = plt.figure( figsize = (width, height) )
        ax = plt.subplot(111)
        # Get data
コード例 #9
0
    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

    R1std = p0.stdR
コード例 #10
0
    ms = 12 / ratio# marker size
    caplen = 7 / ratio
    capwid = 2 / ratio
    elw = 2 / ratio
    ticks = 16 / ratio
    label = 16 / ratio
    title = 18 / ratio
    leg = 14 / ratio


    #############################################################################
    # FIG 1: Vp estimates against H
    ##############################################################################

    if 0:
        f = Params(stnfile, ["fg::H","fg::Vp", "fg::stdVp", "hk::stdR"])

        corrfg = pearsonr(f.fg_Vp, f.fg_H)
        print "FG: Vp vs H: {} stations, correlation = {}".format(len(f.stns), corrfg[0])


        A = np.vstack( (f.fg_H, f.fg_Vp) )
        M = (A.T - np.mean(A,1)).T
        M[0] = M[0] /  np.std(M,1)[0]
        M[1] = M[1] /  np.std(M,1)[1]
        eigVect, pcomp, eigValue, C = princomp(M, 2)

        var = np.sum(pcomp * pcomp, axis = 1)
        var /= np.sum(var)

        print "variance of components is {}".format(var)