示例#1
0
    def test_load_blm_mmax_fits(self):
        '''
        Test loading up a blm .fits array that has mmax < lmax
        '''

        if int(hp.__version__.replace('.', '')) < 1101:
            return

        beam = Beam(**self.beam_opts)
        beam.po_file = self.blm_name_mmax_fits

        # test if unpolarized beam is loaded and scaled
        blm_expd = beam.amplitude * self.blm
        blm_expd[-1] = 0
        np.testing.assert_array_almost_equal(beam.blm[0], blm_expd)

        # After loading we expect mmax to be equal to the truncated value.
        self.assertEqual(beam.mmax, 2)

        # Test if you can also load up the full beam, note that these
        # are just 3 copies of main beam, but truncated.
        beam.delete_blm()
        beam.po_file = self.blm_cross_name_mmax_fits

        np.testing.assert_array_almost_equal(blm_expd, beam.blm[0])
        np.testing.assert_array_almost_equal(blm_expd, beam.blm[1])
        np.testing.assert_array_almost_equal(blm_expd, beam.blm[2])
示例#2
0
    def test_load_blm_fits(self):
        '''
        Test loading up a blm .fits array
        '''

        if int(hp.__version__.replace('.', '')) < 1101:
            return

        beam = Beam(**self.beam_opts)
        beam.po_file = self.blm_name_fits

        # test if unpolarized beam is loaded and scaled
        np.testing.assert_array_almost_equal(beam.blm[0],
                                             beam.amplitude * self.blm)

        # test if copol parts are correct
        blmm2_expd = self.blmm2_expd * beam.amplitude
        blmp2_expd = self.blmp2_expd * beam.amplitude
        np.testing.assert_array_almost_equal(blmm2_expd, beam.blm[1])
        np.testing.assert_array_almost_equal(blmp2_expd, beam.blm[2])

        # test if you can also load up the full beam
        beam.delete_blm()
        beam.po_file = self.blm_cross_name_fits
        np.testing.assert_array_almost_equal(self.blm * beam.amplitude,
                                             beam.blm[0])
        np.testing.assert_array_almost_equal(self.blm * beam.amplitude,
                                             beam.blm[1])
        np.testing.assert_array_almost_equal(self.blm * beam.amplitude,
                                             beam.blm[2])
示例#3
0
    def test_load_blm(self):
        '''
        Test loading up a blm array
        '''

        beam = Beam(**self.beam_opts)

        # test if unpolarized beam is loaded and scaled
        np.testing.assert_array_almost_equal(beam.blm[0],
                                             beam.amplitude * self.blm)

        # test if copol parts are correct
        blmm2_expd = self.blmm2_expd * beam.amplitude
        blmp2_expd = self.blmp2_expd * beam.amplitude
        np.testing.assert_array_almost_equal(blmm2_expd, beam.blm[1])
        np.testing.assert_array_almost_equal(blmp2_expd, beam.blm[2])

        # test if you can also load up the full beam
        beam.delete_blm()
        beam.po_file = self.blm_cross_name
        np.testing.assert_array_almost_equal(self.blm * beam.amplitude,
                                             beam.blm[0])
        np.testing.assert_array_almost_equal(self.blm * beam.amplitude,
                                             beam.blm[1])
        np.testing.assert_array_almost_equal(self.blm * beam.amplitude,
                                             beam.blm[2])