def example_movie(save_movie=True):
    # note: this example is done in pixel units.

    # set image directory path
    image_directory = 'images'
    
    # get x/y limits (from image)
    img = flyanim.get_nth_image_from_directory(0, image_directory)
    xlim = [0, img.shape[1]]
    ylim = [0, img.shape[0]]
    
    # load data
    timestamps,x,y,orientation,eccentricity = get_data()
    
    # check to make sure we have same number of images as data points
    images = flyanim.get_image_file_list(image_directory)
    print 'n images: ', len(images)
    print 'n data pts: ', len(x)
    assert(len(images)==len(x))
            
    # optional parameters
    color = 'none'
    edgecolor = 'red'
    ghost_tail = 20
    nskip = 0
    wedge_radius = 25
    imagecolormap = 'gray'
    
    flipimgx = False # flips image along x
    flipimgy = False # flips image along y
    flip = False # flips orientation 180 deg
    
    # save example movie?
    if save_movie is False:
        save = False
        save_movie_path = ''
    else:
        save = True
        save_movie_path = 'tmp/'
        if not os.path.isdir(save_movie_path):
            os.mkdir(save_movie_path)
            
    # play the movie!
    flyanim.play_movie(x, y, color=color, images=image_directory, orientation=orientation, save=save, save_movie_path=save_movie_path, nskip=nskip, ghost_tail=ghost_tail, wedge_radius=wedge_radius, xlim=xlim, ylim=ylim, imagecolormap=imagecolormap, edgecolor=edgecolor, flipimgx=flipimgx, flipimgy=flipimgy, flip=flip)
def example_movie(save_movie=False):
    t = np.linspace(0, 2*np.pi, 200)
    
    # fly 1
    x1 = 0.5*np.cos(t) + 0.5
    y1 = 0.1*np.sin(t)
    orientation1 = t
    color1 = t
    
    # fly 2
    x2 = 0.3*np.sin(t) + 0.5
    y2 = 0.3*np.cos(t)
    orientation2 = None
    color2 = "black"
    
    # flies
    x = [x1, x2]
    y = [y1, y2]
    orientation = [orientation1, orientation2]
    color = [color1, color2]
    
    # optional parameters
    colormap = 'jet'
    colornorm = [0, 2*np.pi]
    ghost_tail = 20
    nskip = 1
    xlim = [0, 1]
    ylim = [-.5, .5]
    wedge_radius = 0.05
    circle_radius = 0.01
    edgecolor = 'black'
    
    if save_movie is False:
        save = False
        save_movie_path = ''
    else:
        save = True
        save_movie_path = 'tmp/'
        
        if not os.path.isdir(save_movie_path):
            os.mkdir(save_movie_path)
            
    flyanim.play_movie(x, y, color, orientation=orientation, save=save, save_movie_path=save_movie_path, nskip=nskip, artists=[[], [], []], colornorm=colornorm, colormap=colormap, ghost_tail=ghost_tail, xlim=xlim, ylim=ylim, wedge_radius=wedge_radius, circle_radius=circle_radius, edgecolor=edgecolor)