Beispiel #1
0
def sac_metadata(st):

   for tr in st:
       tr.stats.sac['evla'] = -8.13
       tr.stats.sac['evlo'] = -71.27
       tr.stats.sac['stla'] = 40.290
       tr.stats.sac['stlo'] = -116.500
       tr.stats.sac['o'] = 0
   st = convert.set_gcarc(st)
   return st
Beispiel #2
0
def stack_precursor_PKIKP(st_list_in,**kwargs):
    '''
    Stack the precursor amplitudes for PKPdf scattering envelopes
    '''

    tw = kwargs.get('time',(-30,0))
    rw = kwargs.get('range',(130,140))
    ax_grab = kwargs.get('ax_grab',False)
    interp = kwargs.get('interp','lanczos')

    def plot_env(envelope,rw,tw):
        e = np.log10(envelope)
        if ax_grab != False:
            ax = ax_grab
        else:
            fig, ax = plt.subplots()
        image = ax.imshow(np.log10(np.flipud(envelope)+1e-8),aspect='auto',
            cmap='Spectral_r',extent=[(tw[0]),(tw[1]),rw[0],rw[1]],
            interpolation=interp,vmin=-2.0,vmax=0)
        ax.set_ylabel('Range (degrees)',fontsize=14)
        ax.set_xlabel(r'Seconds before $PKPdf$',fontsize=14)
        #ax.text(121,-19,'CMB',color='w',fontsize=14)
        cbar = plt.colorbar(image,ax=ax)
        cbar.solids.set_rasterized(True)
        cbar.set_label(r'$\log_{10}(Amplitude)$',fontsize=14)
        ax.grid(color='k')

    env_list = []
    for st in st_list_in:
        st = convert.set_gcarc(st)
        env,wave = new_precursor_PKIKP(st,plot=False,filter=(0.5,1.0),time=tw)
        env_list.append(env)
    avg_env = np.sum(env_list,axis=0)/len(env_list)

    plot_env(avg_env,rw,tw)
    plt.show()