コード例 #1
0
    #filt = np.roll(gaussian,i-900)
    #filt_spec = np.real(corr_spectrum)*filt
    #phase_spec.append(np.angle(filt_spec))
plt.figure()
plt.plot(freq,np.array(phase_spec))
plt.figure()
phase_spec = np.angle(corr_spectrum)
amp_spec = np.abs(corr_spectrum)
plt.figure()
plt.plot(freq,np.cos(phase_spec)*amp_spec)
plt.plot(freq,np.real(corr_spectrum))
plt.plot(freq,np.angle(np.real(corr_spectrum)))
plt.plot(freq,corr_spectrum)
#%%                                   
crossings,phase_vel = noise.get_smooth_pv(freq,smoothed,dist/1000.,ref_curve,\
                         freqmin=0.004,freqmax=0.25, min_vel=1.5, max_vel=5.5,\
                        filt_width=3,filt_height=0.2,x_overlap=0.75,y_overlap=0.75,pick_threshold=1.7,\
                       horizontal_polarization=False, smooth_spectrum=False,plotting=True)

plt.figure(figsize=(16,10))
plt.subplot(2,2,1)
plt.plot(freq,np.real(corr_spectrum))
plt.plot(freq,np.real(smoothed))
plt.title("Cross-correlation spectrum Love")
plt.xlabel("Frequency")
plt.subplot(2,2,2)
plt.plot(crossings[:,0],crossings[:,1],'o',ms=10)
plt.plot(ref_curve[:,0],ref_curve[:,1],label='reference curve')
plt.plot(phase_vel[:,0],phase_vel[:,1],'o',ms=5,label='picks')
plt.xlabel("Frequency")
plt.ylabel("Velocity [km/s]")
plt.title("Zero crossings")
コード例 #2
0
        if velocity_filter:
            ccspec = CORR
        else:
            ccspec = np.fft.rfft(TCORR)

        if plotresult:
            print("\n    ---", qualitycheck, "---")

        crossings, phase_vel = noise.get_smooth_pv(
            freqax,
            ccspec,
            dist,
            ref_curve,
            freqmin=min_freq,
            freqmax=max_freq,
            min_vel=min_vel,
            max_vel=max_vel,
            filt_width=3,
            filt_height=1.2,
            pick_threshold=pick_thresh,
            horizontal_polarization=horizontal_polarization,
            smooth_spectrum=not (velocity_filter),
            plotting=show_pickplots)

        if qualitycheck == 'symmetric':
            phase_vel_final = phase_vel  # save only symmetric result
            spec_symm = spectrum.copy()
            crossings_symm = crossings.copy()
            tcorr_symm = TCORR.copy()
            corr_symm = CORR.copy()
コード例 #3
0
    elif snr_filter_time_domain:
        snr_filt = snr_filt_td
 
    """ getting zero crossings and extracting phase velocity """   
    min_freq = 1./(dist/3.5)
    if min_freq < 1./max_period:
        min_freq = 1./max_period
    if velocity_filter:
        ccspec = CORR
    else:
        ccspec = spectrum[:,1]+1j*spectrum[:,2]

    try:
        try:
            crossings,phase_vel = noise.get_smooth_pv(spectrum[:,0],ccspec,dist,ref_curve,
                         freqmin=min_freq,freqmax=1./min_period, min_vel=min_vel, max_vel=max_vel,
                         filt_width=3,filt_height=0.2,x_overlap=0.75,y_overlap=0.75,pick_threshold=pick_thresh,
                       horizontal_polarization=horizontal_polarization, smooth_spectrum=not(velocity_filter),plotting=plotresult)
        except:
            crossings,phase_vel = noise.get_smooth_pv(spectrum[:,0],ccspec,dist,ref_curve,
                         freqmin=min_freq,freqmax=1./min_period, min_vel=min_vel, max_vel=max_vel,
                         filt_width=5,filt_height=0.2,x_overlap=0.85,y_overlap=0.85,pick_threshold=pick_thresh*1.2,
                       horizontal_polarization=horizontal_polarization, smooth_spectrum=not(velocity_filter),plotting=plotresult)            

        if snr_filter_frequency_domain or snr_filter_time_domain:
            freq_filtered = np.array([])
            phase_vel_filtered = np.array([])
            for i in range(len(intervals)-1):
                if snr_filt[i]:
                    lim1 = intervals[i]
                    lim2 = intervals[i+1]
                    phase_vel_filtered = np.append(phase_vel_filtered,phase_vel[:,1][(lim1<=phase_vel[:,0])*(phase_vel[:,0]<lim2)])