fast_chans_list[ix]))
    ax[0].grid(True)

    ax[1].semilogy(f, np.ones_like(f), ls='--')
    ax[1].semilogy(f, clean_psd / darm_psd)
    ax[1].set_ylim([0.01, 10])
    ax[1].set_xlabel('Frequency [Hz]')
    ax[1].set_ylabel('Clean/Dirty ASD Ratio')
    ax[1].grid(True)

    plt.tight_layout()
    plt.savefig('ns/ns_subtraction_{}.png'.format(ix))
    plt.close()

    cln = TimeSeries(clean, sample_rate=fs_fast, t0=st)
    specgram = cln.spectrogram(2, fftlength=1, overlap=.9)**(1 / 2.)
    plot = specgram.imshow(norm='log')
    ax = plot.gca()
    ax.set_yscale('log')
    ax.set_ylim(10, 100)
    ax.set_title('Witness: {}'.format(fast_chans_list[ix]))
    ax.colorbar(
        label=r'Gravitational-wave amplitude [strain/$\sqrt{\mathrm{Hz}}$]')
    plt.savefig('ns/ns_sub_spec_{}.png'.format(fast_chans_list[ix]))
    plt.close()

dts = TimeSeries(darm_copy, sample_rate=fs_fast, t0=st)
specgram = dts.spectrogram(2, fftlength=1, overlap=.9)**(1 / 2.)
plot = specgram.imshow(norm='log')
ax = plot.gca()
ax.set_yscale('log')
示例#2
0
data = TimeSeries.get(chan1, st, st+dur, nproc=4)
if data.sample_rate.value != fs:
    data = data.resample(fs)
wit = data.value
wit = butter_filter(wit, low=low, high=high, fs=fs)
wit = wit.reshape(dur*fs)

clean = darm_copy - nlms(darm, wit, M=1, leak=0.0, psi=1e-6, mu=0.5)

#-------------------------------------------------------------------------------
#                               Plot if Good Results
#-------------------------------------------------------------------------------
clean = clean[fs*10:]
darm = darm[fs*10:]
ts = TimeSeries(clean, sample_rate=fs)
specgram = ts.spectrogram(2, fftlength=1, overlap=.5)**(1/2.)
mn, mx = np.min(specgram.value), np.max(specgram.value)
plot = specgram.imshow(norm='log', vmin=mn/10, vmax=mx*10)
ax = plot.gca()
ax.set_yscale('log')
ax.set_ylim(10, 200)
ax.colorbar(label=r'Gravitational-wave amplitude [strain/$\sqrt{\mathrm{Hz}}$]')
plt.savefig('wandering.png')
plt.close()

dts = TimeSeries(darm_copy, sample_rate=fs)
specgram = dts.spectrogram(2, fftlength=1, overlap=.5)**(1/2.)
plot = specgram.imshow(norm='log', vmin=mn/10, vmax=mx*10)
ax = plot.gca()
ax.set_yscale('log')
ax.set_ylim(10, 200)