def test_main_mbfitsw(self): main_convert([self.skydip, '-f', 'mbfitsw', '--test']) newfiles = glob.glob(self.skydip + '*KKG*.fits') assert len(newfiles) > 0 shutil.rmtree(self.skydip + '_mbfitsw') with fits.open(newfiles[0]) as hdul: header = hdul['SCAN-MBFITS'].header assert header['SCANTYPE'] == 'SKYDIP' for fname in newfiles: os.unlink(fname)
def test_main_mbfitsw_polar(self): main_convert([self.example, '-f', 'mbfitsw', '--test']) newfiles = glob.glob(self.example + '*CCB*.fits') assert len(newfiles) > 0 shutil.rmtree(self.example + '_mbfitsw') with fits.open(newfiles[0]) as hdul: header = hdul['SCAN-MBFITS'].header assert header['SCANTYPE'] == 'MAP' for fname in newfiles: os.unlink(fname)
def test_main_mbfits(self): newdir = main_convert([self.skydip, '-f', 'mbfits', '--test'])[0] assert os.path.exists(newdir) assert os.path.isdir(newdir) assert os.path.exists(os.path.join(newdir, 'GROUPING.fits')) scanfile = os.path.join(newdir, 'SCAN.fits') assert os.path.exists(scanfile) with fits.open(scanfile) as hdul: header = hdul[1].header assert header['SCANTYPE'] == 'SKYDIP' shutil.rmtree(self.skydip + '_mbfits')
def test_main_nondir_mbfits(self): with pytest.raises(ValueError) as excinfo: main_convert([self.fname, '-f', 'mbfits']) assert "Input for MBFITS conversion must be " in str(excinfo)
def test_main_garbage_format(self): with pytest.warns(UserWarning): main_convert([self.fname, '-f', 'weruoiq']) assert not os.path.exists(self.fname.replace('.fits', '_weruoiq.fits'))
def test_main_dir(self): main_convert([self.skydip, '-f', 'fitsmod']) newfile = os.path.join(self.skydip, 'skydip_mod_fitsmod.fits') assert os.path.exists(newfile) os.unlink(newfile)
def test_main(self): main_convert([self.fname, '-f', 'fitsmod']) assert os.path.exists(self.fname.replace('.fits', '_fitsmod.fits')) os.unlink(self.fname.replace('.fits', '_fitsmod.fits'))
def test_main_classfits_nodding(self): newdir = main_convert([self.nodding, '-f', 'classfits', '--test'])[0] assert os.path.exists(newdir) assert os.path.isdir(newdir) shutil.rmtree(self.nodding + '_classfits')