def test_spread(self, params): fps, frq = params sig = sinusoid(frq, fps=fps) dft = Dft(fps=fps, window=None) sxx = dft.transform(sig) sps = features.spectral_spread(sxx.frqs, sxx.power) self.assertLess(sps.item(), 1.0)
def test_centroid(self, params): fps, frq = params sig = sinusoid(frq, fps=fps) dft = Dft(fps=fps, window=None) sxx = dft.transform(sig) spc = features.spectral_centroid(sxx.frqs, sxx.power) self.assertAlmostEqual(spc.item(), frq)
def setUp(self): self.fps = 9000 self.n_perseg = 512 self.n_overlap = 256 self.amps = np.array([1., .5, .25, .1, .05]) self.frqs = np.array([440, 550, 660, 880, 1760]) self.signal = sinusoid(self.frqs, self.amps, fps=self.fps) self.stft = StftSegments(self.fps)
def setUp(self): self.fps = 9000 self.frqs = np.array([440, 550, 660, 880, 1760]) self.amps = np.array([1., .5, .25, .1, .05]) self.signal = sinusoid(self.frqs, self.amps, fps=self.fps, comps=True)