def test_des(): """Check that draw_psf makes the same image using draw_psf.py and draw_psf.yaml. Also run a few of the config files in the des directory to make sure they at least run to completion without errors. """ original_dir = os.getcwd() try: os.chdir('des') new_dir = os.getcwd() if new_dir not in sys.path: sys.path.append(new_dir) import draw_psf print('Running draw_psf.py') draw_psf.main(['last=1']) logging.basicConfig(format="%(message)s", level=logging.WARNING, stream=sys.stdout) logger = logging.getLogger('galsim') print('Running draw_psf.yaml') configs = galsim.config.ReadConfig('draw_psf.yaml', logger=logger) for config in configs: config['output']['nfiles'] = 1 galsim.config.Process(config, logger=logger) assert check_same('output/DECam_00154912_01_psfex_image.fits', 'output_yaml/DECam_00154912_01_psfex_image.fits') assert check_same('output/DECam_00154912_01_fitpsf_image.fits', 'output_yaml/DECam_00154912_01_fitpsf_image.fits') config = galsim.config.ReadConfig('meds.yaml', logger=logger)[0] config['output']['nfiles'] = 1 config['output']['nobjects'] = 100 config['gal']['items'][0]['gal_type'] = 'parametric' config['input']['cosmos_catalog'][ 'file_name'] = '../data/real_galaxy_catalog_23.5_example.fits' del config['input']['cosmos_catalog']['sample'] config['input']['des_wcs']['bad_ccds'] = list(range( 2, 63)) # All but CCD 1 galsim.config.Process(config, logger=logger) input_cosmos = config['input'][ 'cosmos_catalog'] # Save example COSMOS catalog spec. config = galsim.config.ReadConfig('blend.yaml', logger=logger)[0] galsim.config.Process(config, logger=logger) config = galsim.config.ReadConfig('blendset.yaml', logger=logger)[0] config['input']['cosmos_catalog'] = input_cosmos config['input']['des_psfex']['file_name']['num'] = 1 galsim.config.Process(config, logger=logger) finally: os.chdir(original_dir)
def test_des(): """Check that draw_psf makes the same image using draw_psf.py and draw_psf.yaml. Also run a few of the config files in the des directory to make sure they at least run to completion without errors. """ original_dir = os.getcwd() try: os.chdir("des") new_dir = os.getcwd() if new_dir not in sys.path: sys.path.append(new_dir) import draw_psf print("Running draw_psf.py") draw_psf.main(["last=1"]) logging.basicConfig(format="%(message)s", level=logging.WARNING, stream=sys.stdout) logger = logging.getLogger("galsim") print("Running draw_psf.yaml") configs = galsim.config.ReadConfig("draw_psf.yaml", logger=logger) for config in configs: config["output"]["nfiles"] = 1 galsim.config.Process(config, logger=logger) assert check_same("output/DECam_00154912_01_psfex_image.fits", "output_yaml/DECam_00154912_01_psfex_image.fits") assert check_same( "output/DECam_00154912_01_fitpsf_image.fits", "output_yaml/DECam_00154912_01_fitpsf_image.fits" ) config = galsim.config.ReadConfig("meds.yaml", logger=logger)[0] config["output"]["nfiles"] = 1 config["output"]["nobjects"] = 100 config["gal"]["items"][0]["gal_type"] = "parametric" config["input"]["cosmos_catalog"]["file_name"] = "../data/real_galaxy_catalog_23.5_example.fits" del config["input"]["cosmos_catalog"]["sample"] config["input"]["des_wcs"]["bad_ccds"] = list(range(2, 63)) # All but CCD 1 galsim.config.Process(config, logger=logger) input_cosmos = config["input"]["cosmos_catalog"] # Save example COSMOS catalog spec. config = galsim.config.ReadConfig("blend.yaml", logger=logger)[0] galsim.config.Process(config, logger=logger) config = galsim.config.ReadConfig("blendset.yaml", logger=logger)[0] config["input"]["cosmos_catalog"] = input_cosmos config["input"]["des_psfex"]["file_name"]["num"] = 1 galsim.config.Process(config, logger=logger) finally: os.chdir(original_dir)
def test_des(): """Check that draw_psf makes the same image using draw_psf.py and draw_psf.yaml. Also run a few of the config files in the des directory to make sure they at least run to completion without errors. """ original_dir = os.getcwd() try: os.chdir('des') new_dir = os.getcwd() if new_dir not in sys.path: sys.path.append(new_dir) import draw_psf print('Running draw_psf.py') draw_psf.main(['last=1']) logger = logging.getLogger('galsim') logger.setLevel(logging.WARNING) print('Running draw_psf.yaml') configs = galsim.config.ReadConfig('draw_psf.yaml', logger=logger) for config in configs: config['output']['nfiles'] = 1 galsim.config.Process(config, logger=logger, except_abort=True) assert check_same('output/DECam_00154912_01_psfex_image.fits', 'output_yaml/DECam_00154912_01_psfex_image.fits') assert check_same('output/DECam_00154912_01_fitpsf_image.fits', 'output_yaml/DECam_00154912_01_fitpsf_image.fits') config = galsim.config.ReadConfig('meds.yaml', logger=logger)[0] config['output']['nfiles'] = 1 config['output']['nobjects'] = 100 config['gal']['items'][0]['gal_type'] = 'parametric' config['input']['cosmos_catalog']['file_name'] = '../data/real_galaxy_catalog_23.5_example.fits' del config['input']['cosmos_catalog']['sample'] config['input']['des_wcs']['bad_ccds'] = list(range(2,63)) # All but CCD 1 galsim.config.Process(config, logger=logger, except_abort=True) input_cosmos = config['input']['cosmos_catalog'] # Save example COSMOS catalog spec. config = galsim.config.ReadConfig('blend.yaml', logger=logger)[0] galsim.config.Process(config, logger=logger, except_abort=True) config = galsim.config.ReadConfig('blendset.yaml', logger=logger)[0] config['input']['cosmos_catalog'] = input_cosmos config['input']['des_psfex']['file_name']['num'] = 1 galsim.config.Process(config, logger=logger, except_abort=True) finally: os.chdir(original_dir)