Commit 351c69c0 authored by Andrew Quinn's avatar Andrew Quinn
Browse files

small irasa clean ups and simple test case

parent b338e000
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2037,7 +2037,7 @@ def irasa(x, method='original', resample_factors=None, aperiodic_average='median
        print(np.vstack((full_pxx, aperiodic_pxx)).shape)
        aperiodic_pxx = np.vstack((full_pxx, aperiodic_pxx)).min(axis=0)

    return full_pxx - aperiodic_pxx, aperiodic_pxx, valid_freqs, full_pxx, pxx
    return f, aperiodic_pxx, full_pxx - aperiodic_pxx


@set_verbose
+5 −2
Original line number Diff line number Diff line
@@ -116,9 +116,12 @@ class TestBasicIRASA(unittest.TestCase):

    def test_canary_irasa(self):
        """Ensure irasa runs."""
        from ..stft import irasa
        from ..stft import irasa, periodogram

        # Run test 5 times
        for ii in range(5):
            xx = np.random.randn(4096,)
            full, aperiodic, valid, pxx = irasa(xx, nperseg=2**(4+ii))
            f, pxx = periodogram(xx, nperseg=2**(4+ii), average='median')
            f2, aperiodic, oscillatory = irasa(xx, nperseg=2**(4+ii))
            assert(np.all(f == f2))
            assert(np.allclose(pxx, aperiodic+oscillatory))
+1 −1

File changed.

Contains only whitespace changes.