def test_correlation_t2(self):
        '''Test for EnsembleSeries.correlation() when the target is an EnsembleSeries with less number of Series
        '''
        nt = 100
        t0, v0 = gen_colored_noise(nt=nt)
        t0, noise = gen_normal(nt=nt)

        ts0 = pyleo.Series(time=t0, value=v0)
        ts1 = pyleo.Series(time=t0, value=v0 + noise)
        ts2 = pyleo.Series(time=t0, value=v0 + 2 * noise)
        ts3 = pyleo.Series(time=t0, value=v0 + 1 / 2 * noise)
        ts4 = pyleo.Series(time=t0, value=v0 + 3 / 2 * noise)

        ts_list1 = [ts0, ts1, ts4]
        ts_list2 = [ts2, ts3]

        ts_ens = pyleo.EnsembleSeries(ts_list1)
        ts_target = pyleo.EnsembleSeries(ts_list2)

        corr_res = ts_ens.correlation(ts_target)
        signif_list = corr_res.signif
        for signif in signif_list:
            assert signif is True

        assert np.size(corr_res.p) == np.size(ts_list1)
    def test_correlation_t0(self):
        '''Test for EnsembleSeries.correlation() when the target is a Series
        '''
        nt = 100
        t0, v0 = gen_colored_noise(nt=nt)
        t0, noise = gen_normal(nt=nt)

        ts0 = pyleo.Series(time=t0, value=v0)
        ts1 = pyleo.Series(time=t0, value=v0 + noise)
        ts2 = pyleo.Series(time=t0, value=v0 + 2 * noise)

        ts_list = [ts1, ts2]

        ts_ens = pyleo.EnsembleSeries(ts_list)

        corr_res = ts_ens.correlation(ts0)
        signif_list = corr_res.signif
        for signif in signif_list:
            assert signif is True
    def test_plot_traces_t0(self):
        ''' Test EnsembleSeries.plot_traces() on a list of colored noise
        '''
        nn = 30  # number of noise realizations
        nt = 500
        series_list = []

        signal = pyleo.gen_ts(model='colored_noise', nt=nt,
                              alpha=1.0).standardize()
        noise = np.random.randn(nt, nn)

        for idx in range(nn):  # noise
            ts = pyleo.Series(time=signal.time,
                              value=signal.value + noise[:, idx])
            series_list.append(ts)

        ts_ens = pyleo.EnsembleSeries(series_list)

        fig, ax = ts_ens.plot_traces(alpha=0.2, num_traces=8, mute=True)