def test_TQU_1_id_no_patchy(self):
     # No patch and one patch has to give the same result
     patch_ids = np.zeros(hp.nside2npix(self.NSIDE), dtype=int)
     with suppress_stdout():
         res = ilc(self.components, dict(Frequencies=self.freqs), self.d)
         res_patch = ilc(self.components, dict(Frequencies=self.freqs),
                         self.d, patch_ids)
     aac(res.s, res_patch.s)
     aac(res.freq_cov, res_patch.freq_cov[0])
    def test_QU_no_ids_no_patchy(self):
        with suppress_stdout():
            res = ilc(self.components, dict(Frequencies=self.freqs),
                      self.d[:, 1:])

        aac(res.s[0], self.s[1:], atol=self.TOL)
        aac(res.freq_cov, self.exp_freq_cov, atol=self.TOL)
    def test_QU_ids_patchy(self):
        patch_ids = np.arange(self.cov[1:].size).reshape(-1, 12) // 4
        patch_ids = hp.ud_grade(patch_ids, self.NSIDE)

        with suppress_stdout():
            res = ilc(self.components, dict(Frequencies=self.freqs),
                      self.d_patchy[:, 1:], patch_ids)
        aac(res.s[0], self.s_patchy[1:], atol=self.TOL)
    def test_TQU_ids_no_patchy(self):
        patch_ids = np.arange(self.cov.size).reshape(-1, 12) // 4
        patch_ids = hp.ud_grade(patch_ids, self.NSIDE)

        with suppress_stdout():
            res = ilc(self.components, dict(frequency=self.freqs), self.d,
                      patch_ids)

        aac(res.s[0], self.s, atol=self.TOL)
    def test_QU_ids_patchy_mask(self):
        mask_good = (np.arange(hp.nside2npix(self.NSIDE)) % 13).astype(bool)
        patch_ids = np.arange(self.cov[1:].size).reshape(-1, 12) // 4
        patch_ids = hp.ud_grade(patch_ids, self.NSIDE)

        data = self.d_patchy[:, 1:].copy()
        data[..., ~mask_good] = hp.UNSEEN
        ref = self.s_patchy[1:].copy()
        ref[..., ~mask_good] = hp.UNSEEN
        with suppress_stdout():
            res = ilc(self.components, dict(Frequencies=self.freqs), data,
                      patch_ids)
        aac(res.s[0], ref, atol=self.TOL)
    def test_TQU_no_ids_no_patchy(self):
        with suppress_stdout():
            res = ilc(self.components, dict(frequency=self.freqs), self.d)

        aac(res.s[0], self.s, atol=self.TOL)
        aac(res.freq_cov, self.exp_freq_cov, atol=self.TOL)