Beispiel #1
0
def plotAnimation(maxOrder=5):

    """A test function for animated visualization of a subset of the
    polynomial surfaces specified by maxOrder.
    """
    if not os.path.exists('images'):
        print 'Making directory images.'
        os.makedirs('images')
    
    z = Zernike()
    print 'Plotting first %d orders of Zernike polynomial surfaces.'%(maxOrder+1)
    order = maxOrder+1

    fig = plt.figure()
    plt.ion()

    for j in range(order):
        for k in range(-j,j+1,2):
            z.plotPolynomial(j,k)
            plt.savefig('./images/mode_%d_%d.png'%(j,k))
            plt.draw()
            sleep(.1)
            plt.cla()
            plt.clf()

    plt.ioff()
    plt.close()