Exemplo n.º 1
0
 def test_preprocess_invalid(self):
     with pytest.warns(UserWarning) as record:
         main_preprocess([self.config_file])
     assert "is not in a known format" in record[0].message.args[0]
     with pytest.warns(UserWarning) as record:
         main_preprocess(['asdfasldkfjw'])
     assert "does not exist" in record[0].message.args[0]
Exemplo n.º 2
0
    def test_baseline_preprocess_using_ds9_region(self):
        regstr = 'fk5;circle(180,45,960")'
        with open('region.reg', 'w') as fobj:
            print(regstr, file=fobj)

        main_preprocess(('-c {} '.format(self.config_file) +
                         '--sub --exclude region.reg').split())
        os.unlink('region.reg')
Exemplo n.º 3
0
    def test_preprocess_single_files(self):
        files = glob.glob(os.path.join(self.obsdir_ra, '*.fits'))

        main_preprocess(files[:2] + ['--debug', '-c', self.config_file])
        for file in files[:2]:
            # I used debug_file_format : eps in the config
            if HAS_MPL:
                assert os.path.exists(file.replace('.fits', '_0.eps'))
Exemplo n.º 4
0
 def _process(pp_args, verbosity):
     """Calls the main_preprocess function as a separate process, so that
     multiple processes can run concurrently speeding up the whole operation
     when receiving separate feeds files."""
     exit_code = 0
     try:
         with warnings.catch_warnings():
             if not verbosity:
                 warnings.simplefilter('ignore')
             if main_preprocess(pp_args):
                 exit_code = 1
     except KeyboardInterrupt:
         exit_code = 15 
     except:
         log.exception(sys.exc_info()[1])
         exit_code = 1
     sys.exit(exit_code)
Exemplo n.º 5
0
 def test_preprocess_config(self):
     main_preprocess(['-c', self.config_file])
Exemplo n.º 6
0
 def test_preprocess_no_config(self):
     with pytest.raises(ValueError) as excinfo:
         main_preprocess([])
     assert "Please specify the config file!" in str(excinfo)
Exemplo n.º 7
0
 def test_preprocess_single_files(self):
     files = glob.glob(os.path.join(self.obsdir_ra, '*.fits'))
     main_preprocess(files[:2])