Ejemplo n.º 1
0
def main():
    ipoc = IPOCStations()
    ms = read('/home/richter/Results/IPOC/xcorr/1bit/stack/all_stack_-1.QHD')
    setHIDist(ms, ipoc)
#    for tr in ms:
#        st = tr.stats.station
#        if 'PB12' in st or 'PAT' in st or 'HMBC' in st or 'LVC' in st:
#            ms.remove(tr)
    print (list(set(ms[0].stats.station.split('-'))))[0]
    ms = ms.select("(st.station.split('-'))[0][:-1] in 'PB03 PB04 PB07 PB09 PB10 PB14 PATCX'.split()")
    ms = ms.select(autocorr=True)
#    ms.plot_(-200, 200, relative='middle', absolutescale=10, annotate=True)
#    ms.plotXcorrVsDist(-300, 300, absolutescale=200)
#    ms.plotXcorrVsDist(-300, relative='starttime', absolutescale=500)
#    plt.show()
#    ms.filter2(0.05, 0.5)

    #ms = ms.select('st.dist<455')
    ms.addXcorrSides()
#    for tr in ms:
#        tr.data = envelope(tr.data)   
#    ms.normalize()    
    ms.downsample2(5)
#    ms.trim2(100 + np.array(ms.getHI('dist')) / 3., None)
#    ms.plotXcorrVsDist(0, 300, relative='starttime')
#    ms.plot_(absolutescale=1)
#    ms = ms[:1]
#    ms = ms[:1]
#    ms.plot_()
#    plt.show()
#    return
    print ms

    lats = np.linspace(-25, -17, 1500)
    lons = np.linspace(-74, -66, 1500)
Ejemplo n.º 2
0
    ms.addXcorrSides()
    for tr in ms:
        tr.data = np.abs(envelope(tr.data))
    dists = ms.getHI('dist')
    maxi = ms.getMaxima()
    v, _ = curve_fit(lambda x, a: x * a, maxi, dists, p0=1)
    return v[0]


#ms = read('/home/richter/Results/IPOC/xcorr/FINAL_filter0.01-0.5_1bit_whitening/stack/day_PB0[12345]Z-PB0[12345]Z_stack_all.QHD')
path = '/home/richter/Results/IPOC/xcorr/FINAL_filter0.01-0.5_1bit_whitening'
ms = read(path + '/stack/day_*_stack_all.QHD')
output = path + '/xcorr_vs_dist.pdf'

ipoc = IPOCStations()
setHIDist(ms, ipoc)

print 'no correlation for pairs:', no_corr_pairs(ms, ipoc)
v = get_vel(ms)
#v = 3.03093386
print 'velocity:', v
fig = plt.figure(figsize=(10, 12))
plot = ms.plotXcorrVsDist(-300, 300, scale=10, fig=fig,
                          figtitle='%d cross-correlations' % len(ms))
plot.ax.plot((-300, 0, 300), (300 * v, 0, 300 * v), 'r')

d = 30
w = 80
xy = np.array([(d, 0), (300 + d, v * 300), (300 + d + w, v * 300), (d + w, 0)])
polygon1 = Polygon(xy, True, alpha=0.4, color='b', zorder=50)
plot.ax.add_patch(polygon1)