Exemplo n.º 1
0
def test_demo2():
    """Check that demo2 makes the same image using demo2.py and demo2.yaml.
    """
    import demo2
    print('Running demo2.py')
    demo2.main([])
    logger = logging.getLogger('galsim')
    logger.setLevel(logging.WARNING)
    config = galsim.config.ReadConfig('demo2.yaml', file_type='yaml', logger=logger)[0]
    print('Running demo2.yaml')
    galsim.config.Process(config, logger=logger, except_abort=True)
    assert check_same('output/demo2.fits', 'output_yaml/demo2.fits')
Exemplo n.º 2
0
def test_demo2():
    """Check that demo2 makes the same image using demo2.py and demo2.yaml.
    """
    import demo2
    print('Running demo2.py')
    demo2.main([])
    logger = logging.getLogger('galsim')
    logger.setLevel(logging.WARNING)
    config = galsim.config.ReadConfig('demo2.yaml', file_type='yaml', logger=logger)[0]
    print('Running demo2.yaml')
    galsim.config.Process(config, logger=logger, except_abort=True)
    assert check_same('output/demo2.fits', 'output_yaml/demo2.fits')
Exemplo n.º 3
0
def test_demo2():
    """Check that demo2 makes the same image using demo2.py and demo2.yaml.
    """
    import demo2

    print("Running demo2.py")
    demo2.main([])
    logging.basicConfig(format="%(message)s", level=logging.INFO, stream=sys.stdout)
    logger = logging.getLogger("galsim")
    config = galsim.config.ReadConfig("demo2.yaml", logger=logger)[0]
    print("Running demo2.yaml")
    galsim.config.Process(config, logger=logger)
    assert check_same("output/demo2.fits", "output_yaml/demo2.fits")
Exemplo n.º 4
0
def test_demo2():
    """Check that demo2 makes the same image using demo2.py and demo2.yaml.
    """
    import demo2
    print('Running demo2.py')
    demo2.main([])
    logging.basicConfig(format="%(message)s",
                        level=logging.INFO,
                        stream=sys.stdout)
    logger = logging.getLogger('galsim')
    config = galsim.config.ReadConfig('demo2.yaml', logger=logger)[0]
    print('Running demo2.yaml')
    galsim.config.Process(config, logger=logger)
    assert check_same('output/demo2.fits', 'output_yaml/demo2.fits')
    keypoints = keypoints.astype(np.float64)

    sent = 0
    if len(keypoints.shape) > 0:
        rightHand = keypoints[
            0,
            4]  # right hand = [x horizontal value between 0 and 639, z vertical value between 0 and 479, confidence between 0 and 1]
        rightShoulder = keypoints[0, 2]
        rightElbow = keypoints[0, 3]
        if (rightHand[2] > 0.5) and (rightElbow[2] > 0.3) and (rightShoulder[2]
                                                               > 0.3):

            # HMR
            model, joints3d, joints = demo2.main(color_image,
                                                 keypoints,
                                                 config2,
                                                 model=model,
                                                 vis=False)
            hmrRightWrist = joints3d[0, 6]
            hmrRightElbow = joints3d[0, 7]
            hmrRightShoulder = joints3d[0, 8]
            hmrLeftShoulder = joints3d[0, 9]
            hmrLeftElbow = joints3d[0, 10]
            hmrLeftWrist = joints3d[0, 11]

            if hmrRightShoulder[0] > hmrLeftShoulder[0]:
                print("backwards")
            else:
                armPixelLength3D = arm_length(hmrRightWrist, hmrRightElbow,
                                              hmrRightShoulder)
                armPixelLength = arm_length(rightHand[:-1], rightElbow[:-1],