def create(inFile, outDir):

    if not os.path.exists(outDir):
        os.makedirs(outDir)

    s = Seismogram(inFile)
    s.readHeader()
    s.readData()
    x, y = s.reverse()
    x = cosine_taper(x, 0.10)
    y = cosine_taper(y, 0.10)
    s.writeAdjointSource(x, y, outDir)
예제 #2
0
def create(synFile, datFile, outDir):

    if not os.path.exists(outDir):
        os.makedirs(outDir)

    syn = Seismogram(synFile)
    dat = Seismogram(datFile)

    # Read
    syn.readHeader()
    dat.readHeader()
    syn.readData()
    dat.readData()

    xDat, yDat = dat.reverse()
    xSyn, ySyn = syn.reverse()

    xDat = cosine_taper(xDat, 0.10)
    yDat = cosine_taper(yDat, 0.10)
    xSyn = cosine_taper(xSyn, 0.10)
    ySyn = cosine_taper(ySyn, 0.10)

    xRes = xSyn - xDat
    yRes = ySyn - yDat

    xRes = np.fromfunction(lambda i: xRes[i] if abs(xRes[i]).any() > 1e-100 else 0, 
                          (xRes.shape), dtype=int)
    yRes = np.fromfunction(lambda i: yRes[i] if abs(yRes[i]).any() > 1e-100 else 0, 
                          (yRes.shape), dtype=int)
    syn.writeAdjointSource(xRes, yRes, outDir)