Esempio n. 1
0
Ntapers = 8
psd, f, jackknife, _, _ = mtspec(data=st[0].data,
                                 delta=st[0].stats.delta,
                                 time_bandwidth=Tw,
                                 number_of_tapers=Ntapers,
                                 nfft=st[0].stats.npts,
                                 statistics=True)

#resample spectra to regular periods
period = (1. / f) / 60
period_interp = arange(12, 120, 0.001)
f = interp1d(period, psd)
psd_interp = f(period_interp)

#Smooth over
psd_median = rm(psd_interp, 700)
fill1 = (len(psd_interp) - len(psd_median)) / 2
fill2 = fill1 + 1
psd_median = r_[zeros(fill1), array(psd_median), zeros(fill2)]

##################################

#### WHole spectrum pressure

Tw = 5
Ntapers = 8
psd_pres, f_pres, jackknife, _, _ = mtspec(data=stp[0].data,
                                           delta=stp[0].stats.delta,
                                           time_bandwidth=Tw,
                                           number_of_tapers=Ntapers,
                                           nfft=stp[0].stats.npts,
Esempio n. 2
0
    

#### WHole spectrum

Tw=5
Ntapers=8
psd, f, jackknife, _, _ = mtspec(data=st[0].data, delta=st[0].stats.delta, time_bandwidth=Tw,number_of_tapers=Ntapers, nfft=st[0].stats.npts, statistics=True)

#resample spectra to regular periods
period=(1./f)/60
period_interp=arange(12,120,0.001)
f=interp1d(period,psd)
psd_interp=f(period_interp)

#Smooth over
psd_median=rm(psd_interp,700)
fill1=(len(psd_interp)-len(psd_median))/2
fill2=fill1+1
psd_median=r_[zeros(fill1),array(psd_median),zeros(fill2)]

##################################



#go to period
period_spec=1./fspec[1:]


#Fitler
fcorner=1./(2*3600)
def highpass(data,fcorner,fsample,order):
Esempio n. 3
0
    st[0].data = st[0].data - mean(st[0].data)
    psd_total, f_total, jackknife, _, _ = mtspec(data=st[0].data,
                                                 delta=st[0].stats.delta,
                                                 time_bandwidth=Tw,
                                                 number_of_tapers=Ntapers,
                                                 nfft=st[0].stats.npts,
                                                 statistics=True)

    #resample spectra to regular periods
    period_total = (1. / f_total) / 60
    period_interp = arange(12, max_period, 0.001)
    f = interp1d(period_total, psd_total)
    psd_interp = f(period_interp)

    #Smooth over
    psd_median = rm(psd_interp, median_window)
    fill1 = (len(psd_interp) - len(psd_median)) / 2
    fill2 = fill1 + 1
    psd_median = r_[zeros(fill1), array(psd_median), zeros(fill2)]
    psd_lims = psd_median.max() * 2

    #Now work on spectrogram
    #Make time variable
    time = arange(Nsamples * dt / 2, st[0].times()[-1], dt * Nsamples / 2)
    Nslices = len(time)
    print Nslices

    #get spectrogram
    sample1 = 0
    sample2 = sample1 + Nsamples