nitime icon indicating copy to clipboard operation
nitime copied to clipboard

`test_FilterAnalyzer` fails with scipy 1.8.0

Open risicle opened this issue 3 years ago • 0 comments

Hi,

In maintaining the NixOS package for nitime we noticed that the test test_FilterAnalyzer fails once we bump scipy to 1.8.0:

_____________________________ test_FilterAnalyzer ______________________________

    def test_FilterAnalyzer():
        """Testing the FilterAnalyzer """
        t = np.arange(np.pi / 100, 10 * np.pi, np.pi / 100)
        fast = np.sin(50 * t) + 10
        slow = np.sin(10 * t) - 20
    
        fast_mean = np.mean(fast)
        slow_mean = np.mean(slow)
    
        fast_ts = ts.TimeSeries(data=fast, sampling_rate=np.pi)
        slow_ts = ts.TimeSeries(data=slow, sampling_rate=np.pi)
    
        #Make sure that the DC is preserved
        f_slow = nta.FilterAnalyzer(slow_ts, ub=0.6)
        f_fast = nta.FilterAnalyzer(fast_ts, lb=0.6)
    
        npt.assert_almost_equal(f_slow.filtered_fourier.data.mean(),
                                slow_mean,
                                decimal=2)
    
        npt.assert_almost_equal(f_slow.filtered_boxcar.data.mean(),
                                slow_mean,
                                decimal=2)
    
        npt.assert_almost_equal(f_slow.fir.data.mean(),
                                slow_mean)
    
        npt.assert_almost_equal(f_slow.iir.data.mean(),
                                slow_mean)
    
        npt.assert_almost_equal(f_fast.filtered_fourier.data.mean(),
                                10)
    
        npt.assert_almost_equal(f_fast.filtered_boxcar.data.mean(),
                                10,
                                decimal=2)
    
        npt.assert_almost_equal(f_fast.fir.data.mean(),
                                10)
    
        npt.assert_almost_equal(f_fast.iir.data.mean(),
                                10)
    
        #Check that things work with a two-channel time-series:
        T2 = ts.TimeSeries(np.vstack([fast, slow]), sampling_rate=np.pi)
        f_both = nta.FilterAnalyzer(T2, ub=1.0, lb=0.1)
        #These are rather basic tests:
        npt.assert_equal(f_both.fir.shape, T2.shape)
>       npt.assert_equal(f_both.iir.shape, T2.shape)

Full build log available at https://hydra.nixos.org/log/12f43cyblp08zbjc5psd8ayxxmq3if72-python3.9-nitime-0.9.drv where all the python dependency versions can be seen. This is on an x86_64 linux system.

risicle avatar May 26 '22 23:05 risicle