示例#1
0
def startsemblance(nostat,
                   nsamp,
                   i,
                   nstep,
                   dimX,
                   dimY,
                   mint,
                   new_freq,
                   minSampleCount,
                   isParent=True):

    backSemb = []

    if isParent:
        backSemb = execsemblance(nostat, nsamp, i, nstep, dimX, dimY, mint,
                                 new_freq, minSampleCount)

    else:
        trace = Basic.readMatrix(trace_txt, nostat, minSampleCount, '%e')
        traveltime = Basic.readMatrix(travel_txt, nostat, dimX * dimY, '%e')
        latv = Basic.readVector(latv_txt, '%e')
        lonv = Basic.readVector(lonv_txt, '%e')

    for j in range(dimX * dimY):
        semb = 0
        nomin = 0
        denom = 0

        for l in range(int(nsamp)):
            sum = 0

            for k in range(nostat):
                relstart_samples = int((traveltime[k][j] - mint) * new_freq +
                                       0.5) + i * nstep

                val = trace[k][relstart_samples + l]
                sum += val
                denom += (val * val)

            nomin += sum * sum
            semb = nomin / (float(nostat) * denom)

        backSemb.append(semb)

    return backSemb
示例#2
0
def execsemblance(nostat, nsamp, i, nstep, dimX,dimY, mint, new_freq, minSampleCount) :

    f = [nostat, nsamp, i, nstep, dimX,dimY, mint, new_freq, minSampleCount]
    args  = Basic.floatToString(f, delim= ',')
    prog  = sys.executable + ' ' + __file__
    cmd   = prog  + ' ' + args

    Logfile.add('--------------------------------------------', cmd)
    result = Basic.systemCmd(cmd)
    Logfile.addLines(result)
    backSemb = Basic.readVector(semb_txt)
    return backSemb