Esempio n. 1
0
    def test_spectrogram_complex(self, rand_complex_data_gen, num_samps, fs):
        cpu_sig, gpu_sig = rand_complex_data_gen(num_samps)

        _, _, cPxx_spec = signal.spectrogram(cpu_sig, fs)
        _, _, gPxx_spec = cusignal.spectrogram(gpu_sig, fs)
        gPxx_spec = cp.asnumpy(gPxx_spec)

        assert array_equal(cPxx_spec, gPxx_spec)
Esempio n. 2
0
def test_spectrogram_complex(num_samps, fs):
    cpu_sig = np.random.rand(num_samps) + 1j * np.random.rand(num_samps)
    gpu_sig = cp.asarray(cpu_sig)

    cf, ct, cPxx_spec = signal.spectrogram(cpu_sig, fs)
    gf, gt, gPxx_spec = cusignal.spectrogram(gpu_sig, fs)
    gPxx_spec = cp.asnumpy(gPxx_spec)

    assert array_equal(cPxx_spec, gPxx_spec)
Esempio n. 3
0
 def gpu_version(self, sig, fs, nperseg):
     with cp.cuda.Stream.null:
         out = cusignal.spectrogram(sig, fs, nperseg=nperseg)
     cp.cuda.Stream.null.synchronize()
     return out