Ejemplo n.º 1
0
 def test_global_fit_image_using_ds9_region_garbage_warns(
         self, logger, caplog):
     regstr = 'physical;circle(30,30,1)'
     with open('region.reg', 'w') as fobj:
         print(regstr, file=fobj)
     main_imager('test.hdf5 -g --exclude region.reg'.split())
     assert 'Only regions in fk5' in caplog.text
     os.unlink('region.reg')
Ejemplo n.º 2
0
 def test_global_fit_image_using_ds9_region_noncircular_warns(
         self, logger, caplog):
     regstr = 'image;line(100,100,200,200)'
     with open('region.reg', 'w') as fobj:
         print(regstr, file=fobj)
     main_imager('test.hdf5 -g --exclude region.reg'.split())
     assert 'Only circular regions' in caplog.text
     os.unlink('region.reg')
Ejemplo n.º 3
0
    def test_baseline_using_ds9_region(self):
        regstr = 'fk5;circle(180,45,960")'
        with open('region.reg', 'w') as fobj:
            print(regstr, file=fobj)

        main_imager(('-c {} --refilt '.format(self.config_file) +
                     '--sub --exclude region.reg').split())
        os.unlink('region.reg')
Ejemplo n.º 4
0
    def test_global_fit_image_using_ds9_region(self):
        scanset = ScanSet('test.hdf5')
        # It works after calculating images
        images = scanset.calculate_images()
        nx, ny = images['Feed0_RCP'].shape

        regstr = 'image;circle({},{},{})'.format(nx // 2, ny // 2, nx // 4)
        with open('region.reg', 'w') as fobj:
            print(regstr, file=fobj)

        main_imager('test.hdf5 -g --exclude region.reg'.split())
        os.unlink('region.reg')
Ejemplo n.º 5
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(' '))
Ejemplo n.º 6
0
 def test_imager_sample_config(self):
     if os.path.exists('sample_config_file.ini'):
         os.unlink('sample_config_file.ini')
     with pytest.raises(SystemExit):
         main_imager(['--sample-config'])
     assert os.path.exists('sample_config_file.ini')
Ejemplo n.º 7
0
 def test_imager_global_fit_invalid(self):
     '''Test image production.'''
     with pytest.raises(ValueError) as excinfo:
         main_imager('test.hdf5 -g -e 10 10 2 1'.split(' '))
         assert "Exclusion region has to be specified as " in str(excinfo)
Ejemplo n.º 8
0
 def test_use_command_line_config(self):
     main_imager(['-c', self.config_file])
Ejemplo n.º 9
0
 def test_use_command_line(self):
     main_imager(
         ('test.hdf5 -u Jy/beam ' + '--calibrate {}'.format(self.calfile) +
          ' -o bubu.hdf5 --debug --scrunch-channels').split(' '))
Ejemplo n.º 10
0
 def test_imager_no_config(self):
     with pytest.raises(ValueError) as excinfo:
         main_imager([])
     assert "Please specify the config file!" in str(excinfo)