Пример #1
0
 def func(scene, max_nbytes, ref1, ref2, ref3, ref4, ref5, ref6):
     acq = QubicAcquisition(instrument, sampling, scene,
                            max_nbytes=max_nbytes)
     sky = np.ones(scene.shape)
     H = acq.get_operator()
     actual1 = H(sky)
     assert_same(actual1, ref1, atol=10)
     actual2 = H.T(actual1)
     assert_same(actual2, ref2, atol=10)
     actual2 = (H.T * H)(sky)
     assert_same(actual2, ref2, atol=10)
     actual3, actual4 = tod2map_all(acq, ref1, disp=False)
     assert_same(actual3, ref3, atol=10000)
     assert_same(actual4, ref4)
     actual5, actual6 = tod2map_each(acq, ref1, disp=False)
     assert_same(actual5, ref5, atol=1000)
     assert_same(actual6, ref6)
Пример #2
0
def test():
    kinds = 'I', 'IQU'
    instrument = QubicInstrument(synthbeam_dtype=float)[:400]
    np.random.seed(0)
    sampling = create_random_pointings([0, 90], 30, 5)
    skies = np.ones(12 * 256**2), np.ones((12 * 256**2, 3))

    def func(sampling, kind, sky, ref1, ref2, ref3, ref4, ref5, ref6):
        nprocs_instrument = max(size // 2, 1)
        acq = QubicAcquisition(instrument,
                               sampling,
                               kind=kind,
                               nprocs_instrument=nprocs_instrument)
        assert_equal(acq.comm.size, size)
        assert_equal(acq.instrument.detector.comm.size, nprocs_instrument)
        assert_equal(acq.sampling.comm.size, size / nprocs_instrument)
        H = acq.get_operator()
        invntt = acq.get_invntt_operator()
        tod = H(sky)
        #actual1 = acq.unpack(H(sky))
        #assert_same(actual1, ref1, atol=20)
        actual2 = H.T(invntt(tod))
        assert_same(actual2, ref2, atol=20)
        actual2 = (H.T * invntt * H)(sky)
        assert_same(actual2, ref2, atol=20)
        actual3, actual4 = tod2map_all(acq, tod, disp=False, maxiter=2)
        assert_same(actual3, ref3, atol=20)
        assert_same(actual4, ref4, atol=20)
        #actual5, actual6 = tod2map_each(acq, tod, disp=False)
        #assert_same(actual5, ref5, atol=1000)
        #assert_same(actual6, ref6)

    for kind, sky in zip(kinds, skies):
        acq = QubicAcquisition(instrument,
                               sampling,
                               kind=kind,
                               comm=MPI.COMM_SELF)
        assert_equal(acq.comm.size, 1)
        H = acq.get_operator()
        invntt = acq.get_invntt_operator()
        tod = H(sky)
        ref1 = acq.unpack(tod)
        ref2 = H.T(invntt(tod))
        ref3, ref4 = tod2map_all(acq, tod, disp=False, maxiter=2)
        ref5, ref6 = None, None  #tod2map_each(acq, tod, disp=False)
        yield (func, sampling, kind, sky, ref1, ref2, ref3, ref4, ref5, ref6)
Пример #3
0
 def func(scene, max_nbytes, ref1, ref2, ref3, ref4, ref5, ref6):
     acq = QubicAcquisition(instrument,
                            sampling,
                            scene,
                            max_nbytes=max_nbytes)
     sky = np.ones(scene.shape)
     H = acq.get_operator()
     actual1 = H(sky)
     assert_same(actual1, ref1, atol=10)
     actual2 = H.T(actual1)
     assert_same(actual2, ref2, atol=10)
     actual2 = (H.T * H)(sky)
     assert_same(actual2, ref2, atol=10)
     actual3, actual4 = tod2map_all(acq, ref1, disp=False)
     assert_same(actual3, ref3, atol=10000)
     assert_same(actual4, ref4)
     actual5, actual6 = tod2map_each(acq, ref1, disp=False)
     assert_same(actual5, ref5, atol=1000)
     assert_same(actual6, ref6)
Пример #4
0
 def func(sampling, kind, sky, ref1, ref2, ref3, ref4, ref5, ref6):
     nprocs_instrument = max(size // 2, 1)
     acq = QubicAcquisition(instrument, sampling, kind=kind,
                            nprocs_instrument=nprocs_instrument)
     assert_equal(acq.comm.size, size)
     assert_equal(acq.instrument.detector.comm.size, nprocs_instrument)
     assert_equal(acq.sampling.comm.size, size / nprocs_instrument)
     H = acq.get_operator()
     invntt = acq.get_invntt_operator()
     tod = H(sky)
     #actual1 = acq.unpack(H(sky))
     #assert_same(actual1, ref1, atol=20)
     actual2 = H.T(invntt(tod))
     assert_same(actual2, ref2, atol=20)
     actual2 = (H.T * invntt * H)(sky)
     assert_same(actual2, ref2, atol=20)
     actual3, actual4 = tod2map_all(acq, tod, disp=False, maxiter=2)
     assert_same(actual3, ref3, atol=20)
     assert_same(actual4, ref4, atol=20)
Пример #5
0
def test():
    kinds = 'I', 'IQU'
    instrument = QubicInstrument(synthbeam_dtype=float)[:400]
    np.random.seed(0)
    sampling = create_random_pointings([0, 90], 30, 5)
    skies = np.ones(12 * 256**2), np.ones((12 * 256**2, 3))

    def func(sampling, kind, sky, ref1, ref2, ref3, ref4, ref5, ref6):
        nprocs_instrument = max(size // 2, 1)
        acq = QubicAcquisition(instrument, sampling, kind=kind,
                               nprocs_instrument=nprocs_instrument)
        assert_equal(acq.comm.size, size)
        assert_equal(acq.instrument.detector.comm.size, nprocs_instrument)
        assert_equal(acq.sampling.comm.size, size / nprocs_instrument)
        H = acq.get_operator()
        invntt = acq.get_invntt_operator()
        tod = H(sky)
        #actual1 = acq.unpack(H(sky))
        #assert_same(actual1, ref1, atol=20)
        actual2 = H.T(invntt(tod))
        assert_same(actual2, ref2, atol=20)
        actual2 = (H.T * invntt * H)(sky)
        assert_same(actual2, ref2, atol=20)
        actual3, actual4 = tod2map_all(acq, tod, disp=False, maxiter=2)
        assert_same(actual3, ref3, atol=20)
        assert_same(actual4, ref4, atol=20)
        #actual5, actual6 = tod2map_each(acq, tod, disp=False)
        #assert_same(actual5, ref5, atol=1000)
        #assert_same(actual6, ref6)

    for kind, sky in zip(kinds, skies):
        acq = QubicAcquisition(instrument, sampling, kind=kind,
                               comm=MPI.COMM_SELF)
        assert_equal(acq.comm.size, 1)
        H = acq.get_operator()
        invntt = acq.get_invntt_operator()
        tod = H(sky)
        ref1 = acq.unpack(tod)
        ref2 = H.T(invntt(tod))
        ref3, ref4 = tod2map_all(acq, tod, disp=False, maxiter=2)
        ref5, ref6 = None, None #tod2map_each(acq, tod, disp=False)
        yield (func, sampling, kind, sky, ref1, ref2, ref3, ref4, ref5, ref6)
Пример #6
0
 def func(sampling, kind, sky, ref1, ref2, ref3, ref4, ref5, ref6):
     nprocs_instrument = max(size // 2, 1)
     acq = QubicAcquisition(instrument,
                            sampling,
                            kind=kind,
                            nprocs_instrument=nprocs_instrument)
     assert_equal(acq.comm.size, size)
     assert_equal(acq.instrument.detector.comm.size, nprocs_instrument)
     assert_equal(acq.sampling.comm.size, size / nprocs_instrument)
     H = acq.get_operator()
     invntt = acq.get_invntt_operator()
     tod = H(sky)
     #actual1 = acq.unpack(H(sky))
     #assert_same(actual1, ref1, atol=20)
     actual2 = H.T(invntt(tod))
     assert_same(actual2, ref2, atol=20)
     actual2 = (H.T * invntt * H)(sky)
     assert_same(actual2, ref2, atol=20)
     actual3, actual4 = tod2map_all(acq, tod, disp=False, maxiter=2)
     assert_same(actual3, ref3, atol=20)
     assert_same(actual4, ref4, atol=20)
Пример #7
0
def test():
    instrument = QubicInstrument()[:10]
    sampling = create_random_pointings([0, 90], 30, 5)
    nside = 64
    scenes = QubicScene(nside, kind='I'), QubicScene(nside)

    def func(scene, max_nbytes, ref1, ref2, ref3, ref4, ref5, ref6):
        acq = QubicAcquisition(instrument,
                               sampling,
                               scene,
                               max_nbytes=max_nbytes)
        sky = np.ones(scene.shape)
        H = acq.get_operator()
        actual1 = H(sky)
        assert_same(actual1, ref1, atol=10)
        actual2 = H.T(actual1)
        assert_same(actual2, ref2, atol=10)
        actual2 = (H.T * H)(sky)
        assert_same(actual2, ref2, atol=10)
        actual3, actual4 = tod2map_all(acq, ref1, disp=False)
        assert_same(actual3, ref3, atol=10000)
        assert_same(actual4, ref4)
        actual5, actual6 = tod2map_each(acq, ref1, disp=False)
        assert_same(actual5, ref5, atol=1000)
        assert_same(actual6, ref6)

    for scene in scenes:
        acq = QubicAcquisition(instrument, sampling, scene)
        sky = np.ones(scene.shape)
        nbytes_per_sampling = acq.get_operator_nbytes() // len(acq.sampling)
        H = acq.get_operator()
        ref1 = H(sky)
        ref2 = H.T(ref1)
        ref3, ref4 = tod2map_all(acq, ref1, disp=False)
        ref5, ref6 = tod2map_each(acq, ref1, disp=False)
        for max_sampling in 10, 29, 30:
            max_nbytes = None if max_sampling is None \
                              else max_sampling * nbytes_per_sampling
            yield (func, scene, max_nbytes, ref1, ref2, ref3, ref4, ref5, ref6)
Пример #8
0
def test():
    instrument = QubicInstrument()[:10]
    sampling = create_random_pointings([0, 90], 30, 5)
    nside = 64
    scenes = QubicScene(nside, kind='I'), QubicScene(nside)

    def func(scene, max_nbytes, ref1, ref2, ref3, ref4, ref5, ref6):
        acq = QubicAcquisition(instrument, sampling, scene,
                               max_nbytes=max_nbytes)
        sky = np.ones(scene.shape)
        H = acq.get_operator()
        actual1 = H(sky)
        assert_same(actual1, ref1, atol=10)
        actual2 = H.T(actual1)
        assert_same(actual2, ref2, atol=10)
        actual2 = (H.T * H)(sky)
        assert_same(actual2, ref2, atol=10)
        actual3, actual4 = tod2map_all(acq, ref1, disp=False)
        assert_same(actual3, ref3, atol=10000)
        assert_same(actual4, ref4)
        actual5, actual6 = tod2map_each(acq, ref1, disp=False)
        assert_same(actual5, ref5, atol=1000)
        assert_same(actual6, ref6)

    for scene in scenes:
        acq = QubicAcquisition(instrument, sampling, scene)
        sky = np.ones(scene.shape)
        nbytes_per_sampling = acq.get_operator_nbytes() // len(acq.sampling)
        H = acq.get_operator()
        ref1 = H(sky)
        ref2 = H.T(ref1)
        ref3, ref4 = tod2map_all(acq, ref1, disp=False)
        ref5, ref6 = tod2map_each(acq, ref1, disp=False)
        for max_sampling in 10, 29, 30:
            max_nbytes = None if max_sampling is None \
                              else max_sampling * nbytes_per_sampling
            yield (func, scene, max_nbytes, ref1, ref2, ref3, ref4, ref5, ref6)