예제 #1
0
def test_demo9():
    """Check that demo9 makes the same image using demo9.py and demo9.yaml.
    """
    # For this one, we'll use the json file instead, partly just to get coverage of the
    # JSON parsing functionality, but also because the changes to the base config
    # are pretty minor, so we can effect them with the new_params option.
    import demo9

    print("Running demo9.py")
    demo9.main([])
    logging.basicConfig(format="%(message)s", level=logging.INFO, stream=sys.stdout)
    logger = logging.getLogger("galsim")
    config = galsim.config.ReadConfig("json/demo9.json", logger=logger)[0]
    print("Running demo9.json")
    new_params = {"output.skip": {"type": "List", "items": [0, 0, 0, 0, 0, 1]}}
    galsim.config.Process(config, logger=logger, new_params=new_params, njobs=3, job=1)
    galsim.config.Process(config, logger=logger, new_params=new_params, njobs=3, job=2)
    galsim.config.Process(config, logger=logger, new_params=new_params, njobs=3, job=3)
    new_params = {"output.noclobber": True}
    galsim.config.Process(config, logger=logger, new_params=new_params)
    for dir_num in range(1, 5):
        for file_num in range(5):
            file_name = "nfw%d/cluster%04d.fits" % (dir_num, file_num)
            truth_name = "nfw%d/truth%04d.dat" % (dir_num, file_num)
            assert check_same("output/" + file_name, "output_json/" + file_name)
            assert check_same("output/" + truth_name, "output_json/" + truth_name)
예제 #2
0
def test_demo9():
    """Check that demo9 makes the same image using demo9.py and demo9.yaml.
    """
    # For this one, we'll use the json file instead, partly just to get coverage of the
    # JSON parsing functionality, but also because the changes to the base config
    # are pretty minor, so we can effect them with the new_params option.
    import demo9
    print('Running demo9.py')
    demo9.main([])
    logger = logging.getLogger('galsim')
    logger.setLevel(logging.WARNING)
    config = galsim.config.ReadConfig('json/demo9.json', logger=logger)[0]
    print('Running demo9.json')
    new_params = { 'output.skip' : { 'type' : 'List', 'items' : [0,0,0,0,0,1] } }
    galsim.config.Process(config, logger=logger, new_params=new_params, njobs=3, job=1,
                          except_abort=True)
    galsim.config.Process(config, logger=logger, new_params=new_params, njobs=3, job=2,
                          except_abort=True)
    galsim.config.Process(config, logger=logger, new_params=new_params, njobs=3, job=3,
                          except_abort=True)
    new_params = { 'output.noclobber' : True }
    galsim.config.Process(config, logger=logger, new_params=new_params, except_abort=True)
    for dir_num in range(1,5):
        for file_num in range(5):
            file_name = 'nfw%d/cluster%04d.fits'%(dir_num, file_num)
            truth_name = 'nfw%d/truth%04d.dat'%(dir_num, file_num)
            assert check_same('output/'+file_name , 'output_json/'+file_name)
            assert check_same('output/'+truth_name , 'output_json/'+truth_name)
예제 #3
0
def test_demo9():
    """Check that demo9 makes the same image using demo9.py and demo9.yaml.
    """
    # For this one, we'll use the json file instead, partly just to get coverage of the
    # JSON parsing functionality, but also because the changes to the base config
    # are pretty minor, so we can effect them with the new_params option.
    import demo9
    print('Running demo9.py')
    demo9.main([])
    logger = logging.getLogger('galsim')
    logger.setLevel(logging.WARNING)
    config = galsim.config.ReadConfig('json/demo9.json', logger=logger)[0]
    print('Running demo9.json')
    new_params = { 'output.skip' : { 'type' : 'List', 'items' : [0,0,0,0,0,1] } }
    galsim.config.Process(config, logger=logger, new_params=new_params, njobs=3, job=1,
                          except_abort=True)
    galsim.config.Process(config, logger=logger, new_params=new_params, njobs=3, job=2,
                          except_abort=True)
    galsim.config.Process(config, logger=logger, new_params=new_params, njobs=3, job=3,
                          except_abort=True)
    new_params = { 'output.noclobber' : True }
    galsim.config.Process(config, logger=logger, new_params=new_params, except_abort=True)
    for dir_num in range(1,5):
        for file_num in range(5):
            file_name = 'nfw%d/cluster%04d.fits'%(dir_num, file_num)
            truth_name = 'nfw%d/truth%04d.dat'%(dir_num, file_num)
            assert check_same('output/'+file_name , 'output_json/'+file_name)
            assert check_same('output/'+truth_name , 'output_json/'+truth_name)