How to use the aotools.functions.pupil.circle function in aotools

To help you get started, we’ve selected a few aotools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AOtools / aotools / test / testCircle.py View on Github external
c2 = pupil.circle(2, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(1, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(1, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(0, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(0, 6)[1:-1, 1:-1]
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(1, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(1, 6)[1:-1, 1:-1]
        #c2[3,2] = 3.0 # to test the testing
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(2, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(2, 6)[1:-1, 1:-1]
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )


        log.info("Raise TypeError if inputs not of correct type")
github AOtools / aotools / test / testCircle.py View on Github external
c1 = pupil.circle(1, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(1, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(0, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(0, 6)[1:-1, 1:-1]
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(1, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(1, 6)[1:-1, 1:-1]
        #c2[3,2] = 3.0 # to test the testing
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(2, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(2, 6)[1:-1, 1:-1]
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )


        log.info("Raise TypeError if inputs not of correct type")

        # For testing by hand and observing the result:
        if False:
            import pylab; pylab.ion()
github AOtools / aotools / test / testCircle.py View on Github external
ce = numpy.array([[ 0.,  0.,  0.,  0.,  0.],
                          [ 0.,  0.,  1.,  0.,  0.],
                          [ 0.,  1.,  1.,  1.,  0.],
                          [ 0.,  0.,  1.,  0.,  0.],
                          [ 0.,  0.,  0.,  0.,  0.]])
        c = pupil.circle(1, 5)
        self.assertEqual( c.tolist(), ce.tolist() )
        self.assertTrue( (c == ce).all() )

        #  circle.circle(2, 5)
        ce = numpy.array([[ 0.,  0.,  1.,  0.,  0.],
                          [ 0.,  1.,  1.,  1.,  0.],
                          [ 1.,  1.,  1.,  1.,  1.],
                          [ 0.,  1.,  1.,  1.,  0.],
                          [ 0.,  0.,  1.,  0.,  0.]])
        c = pupil.circle(2, 5)
        self.assertEqual( c.tolist(), ce.tolist() )
        self.assertTrue( (c == ce).all() )

        #  circle.circle(0, 6)
        ce = numpy.array([[ 0.,  0.,  0.,  0.,  0.,  0.],
                          [ 0.,  0.,  0.,  0.,  0.,  0.],
                          [ 0.,  0.,  0.,  0.,  0.,  0.],
                          [ 0.,  0.,  0.,  0.,  0.,  0.],
                          [ 0.,  0.,  0.,  0.,  0.,  0.],
                          [ 0.,  0.,  0.,  0.,  0.,  0.]])
        c = pupil.circle(0, 6)
        self.assertEqual( c.tolist(), ce.tolist() )
        self.assertTrue( (c == ce).all() )

        #  circle.circle(1, 6)
        ce = numpy.array([[ 0.,  0.,  0.,  0.,  0.,  0.],
github AOtools / aotools / test / testCircle.py View on Github external
[0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0],
             [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0],
             [0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0],
             [0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],
             [0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]])
        c = pupil.circle(15.5, 31) - pupil.circle(3.7, 31)
        self.assertEqual( c.tolist(), ce.tolist() )
        self.assertTrue( (c == ce).all() )

        log.info("Create circles with (2,6,(0.5,0.5)), (1,5,(0.5,0.5)), etc.")
        c1 = pupil.circle(2, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(2, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(1, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(1, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(0, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(0, 6)[1:-1, 1:-1]
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(1, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(1, 6)[1:-1, 1:-1]
github AOtools / aotools / test / testCircle.py View on Github external
[1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1],
             [1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1],
             [1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1],
             [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],
             [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],
             [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],
             [0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0],
             [0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0],
             [0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0],
             [0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0],
             [0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0],
             [0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0],
             [0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0],
             [0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],
             [0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]])
        c = pupil.circle(15.5, 31) - pupil.circle(3.7, 31)
        self.assertEqual( c.tolist(), ce.tolist() )
        self.assertTrue( (c == ce).all() )

        log.info("Create circles with (2,6,(0.5,0.5)), (1,5,(0.5,0.5)), etc.")
        c1 = pupil.circle(2, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(2, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(1, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(1, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(0, 5)
github AOtools / aotools / test / testCircle.py View on Github external
[ 0.,  0.,  1.,  1.,  0.,  0.],
                          [ 0.,  0.,  1.,  1.,  0.,  0.],
                          [ 0.,  0.,  0.,  0.,  0.,  0.],
                          [ 0.,  0.,  0.,  0.,  0.,  0.]])
        c = pupil.circle(1, 6)
        self.assertEqual( c.tolist(), ce.tolist() )
        self.assertTrue( (c == ce).all() )

        #  circle.circle(2, 6)
        ce = numpy.array([[ 0.,  0.,  0.,  0.,  0.,  0.],
                          [ 0.,  0.,  1.,  1.,  0.,  0.],
                          [ 0.,  1.,  1.,  1.,  1.,  0.],
                          [ 0.,  1.,  1.,  1.,  1.,  0.],
                          [ 0.,  0.,  1.,  1.,  0.,  0.],
                          [ 0.,  0.,  0.,  0.,  0.,  0.]])
        c = pupil.circle(2, 6)
        self.assertEqual( c.tolist(), ce.tolist() )
        self.assertTrue( (c == ce).all() )

        #  circle.circle(3, 6)
        ce = numpy.array([[ 0.,  1.,  1.,  1.,  1.,  0.],
                          [ 1.,  1.,  1.,  1.,  1.,  1.],
                          [ 1.,  1.,  1.,  1.,  1.,  1.],
                          [ 1.,  1.,  1.,  1.,  1.,  1.],
                          [ 1.,  1.,  1.,  1.,  1.,  1.],
                          [ 0.,  1.,  1.,  1.,  1.,  0.]])
        c = pupil.circle(3, 6)
        self.assertEqual( c.tolist(), ce.tolist() )
        self.assertTrue( (c == ce).all() )


        # This is a crucial test since this is used in the dragon config file:
github AOtools / aotools / test / testCircle.py View on Github external
[0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0],
             [0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0],
             [0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0],
             [0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0]])
        c = pupil.circle(15.5, 31) - pupil.circle(3.7, 31)
        self.assertEqual( c.tolist(), ce.tolist() )
        self.assertTrue( (c == ce).all() )

        log.info("Create circles with (2,6,(0.5,0.5)), (1,5,(0.5,0.5)), etc.")
        c1 = pupil.circle(2, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(2, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(1, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(1, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 6, (0.5,0.5))[1:,1:]
        c2 = pupil.circle(0, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(0, 6)[1:-1, 1:-1]
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(1, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(1, 6)[1:-1, 1:-1]
        #c2[3,2] = 3.0 # to test the testing
github AOtools / aotools / test / testCircle.py View on Github external
c2 = pupil.circle(0, 5)
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(0, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(0, 6)[1:-1, 1:-1]
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(1, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(1, 6)[1:-1, 1:-1]
        #c2[3,2] = 3.0 # to test the testing
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )

        c1 = pupil.circle(2, 5, (0.5, 0.5))[1:, 1:]
        c2 = pupil.circle(2, 6)[1:-1, 1:-1]
        self.assertEqual( c1.tolist(), c2.tolist() )
        self.assertTrue( (c1 == c2).all() )


        log.info("Raise TypeError if inputs not of correct type")

        # For testing by hand and observing the result:
        if False:
            import pylab; pylab.ion()

            c = pupil.circle(2, 5, (0.5, 0.5))
            pylab.imshow(c, interpolation="nearest")

            c1 = pupil.circle(1, 5)
            #pylab.imshow(c-c1, interpolation="nearest")