Example #1
0
    def test_imager_global_fit_valid(self):
        '''Test image production.'''
        # Get information on images
        scanset = ScanSet('test.hdf5')
        scanset.fit_full_images(no_offsets=True)
        # It works after calculating images
        images = scanset.calculate_images()
        nx, ny = images['Feed0_RCP'].shape
        excluded = [[nx // 2, ny // 2, nx // 4]]

        main_imager('test.hdf5 -g '
                    '-e {} {} {}'.format(*(excluded[0])).split(' '))
Example #2
0
    def test_global_fit_image_fails_mixup_channels(self):
        '''Test image production.'''

        scanset = ScanSet('test.hdf5')
        images = scanset.calculate_images()
        scanset['Ch0_feed'] = np.random.randint(0, 3, len(scanset['Ch0_feed']))
        with pytest.raises(ValueError) as excinfo:
            images = scanset.fit_full_images()

        assert "Feeds are mixed up" in str(excinfo)
Example #3
0
    def test_global_fit_image(self):
        '''Test image production.'''
        scanset = ScanSet('test.hdf5')
        # It works with no parameters, before calculating images,
        # with no_offsets
        scanset.fit_full_images(no_offsets=True)
        # It works after calculating images
        images = scanset.calculate_images()
        nx, ny = images['Feed0_RCP'].shape
        excluded = [[nx // 2, ny // 2, nx // 4]]
        scanset.fit_full_images(excluded=excluded, chans='Feed0_RCP')
        os.path.exists("out_iter_Feed0_RCP_002.txt")
        scanset.fit_full_images(excluded=excluded, chans='Feed0_LCP')
        os.path.exists("out_iter_Feed0_LCP_000.txt")

        if not HAS_MPL:
            with pytest.raises(ImportError) as excinfo:
                display_intermediate(scanset,
                                     chan="Feed0_RCP",
                                     excluded=excluded,
                                     parfile="out_iter_Feed0_RCP_002.txt")

            assert "display_intermediate: matplotlib" in str(excinfo)
        else:
            display_intermediate(scanset,
                                 chan="Feed0_RCP",
                                 excluded=excluded,
                                 parfile="out_iter_Feed0_RCP_002.txt")
            os.path.exists("out_iter_Feed0_LCP_002.png")