def test_hybrid(self): """correctly compute hybrid statistic""" hybrid_x, hybrid_periods = hybrid(self.sig, llim=None, ulim=50) hybrid_x = abs(hybrid_x) max_idx = list(hybrid_x).index(max(hybrid_x)) hybrid_p = hybrid_periods[max_idx] self.assertEqual(hybrid_p, self.p)
def test_hybrid_returns_all(self): """correctly returns hybrid, ipdft and autocorr statistics""" ipdft_pwr, ipdft_prd = ipdft(self.sig, llim=2, ulim=50) auto_x, auto_periods = auto_corr(self.sig, llim=2, ulim=50) hybrid_x, hybrid_periods = hybrid(self.sig, llim=None, ulim=50) hybrid_ipdft_autocorr_stats, hybrid_periods = hybrid(self.sig, llim=None, ulim=50, return_all=True) self.assertEqual(hybrid_ipdft_autocorr_stats[0], hybrid_x) self.assertEqual(hybrid_ipdft_autocorr_stats[1], ipdft_pwr) self.assertEqual(hybrid_ipdft_autocorr_stats[2], auto_x) ipdft_pwr, ipdft_prd = ipdft(self.sig, llim=10, ulim=10) auto_x, auto_periods = auto_corr(self.sig, llim=10, ulim=10) hybrid_x, hybrid_periods = hybrid(self.sig, llim=10, ulim=10) hybrid_ipdft_autocorr_stats, hybrid_periods = hybrid(self.sig, llim=10, ulim=10, return_all=True) self.assertEqual(hybrid_ipdft_autocorr_stats[0], hybrid_x) self.assertEqual(hybrid_ipdft_autocorr_stats[1], ipdft_pwr) self.assertEqual(hybrid_ipdft_autocorr_stats[2], auto_x)