Example #1
0
def jikkou(user_ID, test, stag, scate):
    ext = 0

    if (apitushin(user_ID, code) == None):
        print('録画の取得を行います。')
        if (movie(user_ID, code) == None):
            print('取れるサムネが存在しません。')
            ext = 1
        else:
            OpenCV_image, title, tag, profile, category = movie(user_ID, code)
    else:
        OpenCV_image, title, tag, profile, category = apitushin(user_ID, code)

    if (ext == 0):
        print('放送タイトル')
        print(title)
        print('\n設定タグ')
        print(tag)
        print('\nユーザプロフィール')
        print(profile)
        print('\n放送カテゴリ')
        print(category)

        if (test == 1):
            OpenCV_image = Image.open(sample + 'sample3.jpg')
            OpenCV_image = np.asarray(OpenCV_image)
            title = ''
            profile = ''
            tag = stag
            category = scate

        ima = cv.cvtColor(OpenCV_image, cv.COLOR_RGB2BGR)
        cv.imwrite('./output/' + user_ID + '_' + scate + '_' + 'create.png',
                   ima)

        image = comset(OpenCV_image, title, tag, profile, category)

        height, width = image.shape[:-1]
        yokomask = np.full((height, int(height / 6), 3), (0, 0, 0),
                           dtype=np.uint8)
        tatemask = np.full((int(height / 6), width + int(height / 6) * 2, 3),
                           (0, 0, 0),
                           dtype=np.uint8)
        #tate
        tmpImg1 = cv.hconcat([yokomask, image])
        tmpImg2 = cv.hconcat([tmpImg1, yokomask])
        #yoko
        tmpImg3 = cv.vconcat([tatemask, tmpImg2])
        iosImg = cv.vconcat([tmpImg3, tatemask])

        ima = cv.cvtColor(iosImg, cv.COLOR_RGB2BGR)
        cv.imwrite(
            './output/' + user_ID + '_' + scate + '_' + 'after_last.png', ima)
Example #2
0
    def get_movie_by_title(self, title, filter=None):
        '''
        Args:
            title - Title of the movie
            filter - streaming or dvd
        '''

        res = self.service.get_movie_by_title(title, filter=filter)

        if not res:
            return {}

        m_details = self.service.get_title(res.get('id'), category="format_availability")
        m = movie(str(res.get('title')), 'Netflix')

        # Check for formats
        if m_details.get('delivery_formats'):
            f = m_details.get('delivery_formats')
            if f.get('DVD'):
                m.dvd = True
                m.price_dvd = 'subscription'
            if f.get('instant'):
                m.stream = True
                m.price_stream = 'subscription'

        # return the movie dict
        return m
Example #3
0
    def get_movie_by_title(self, title):
        '''
        Args:
            title - Title of the movie
        '''

        search_term = cgi.escape(title)
        client = gdata.youtube.service.YouTubeService()
        query = gdata.youtube.service.YouTubeVideoQuery()
        query.prettyprint = True
        query.key = self.DEVELOPER_KEY
        query.v = self.YOUTUBE_API_VERSION
        query.vq = search_term
        query.max_results = '2'
        feed = client.YouTubeQuery(query)

        m = movie('', 'Youtube')

        for entry in feed.entry:
            m.movie = entry.title.text
            m.stream = 'True'
            m.price_stream = 0
            break

        if not m.movie:
            return {}

        return m
Example #4
0
    def get_movie_by_title(self, title, filter=None):
        '''
        '''
        country = 'US'
        media = 'movie'
        entity = 'movie'
        limit = 1

        payload = {'term': title,
                   'country': country,
                   'media': media,
                   'entity': entity,
                   'limit': limit
                  }
        r = requests.get(self.base_url, params=payload)
        results = json.loads(r.text.strip())
        results = results.get('results')[0]
        m = {}

        if results.get('trackName') == title:
            m = movie(str(results.get('trackName')), 'iTunes')
            m.stream = True
            m.price_stream = results.get('trackPrice')

        return m
Example #5
0
 def addMovie(self, name, releaseYear, genres):
     if self.movieDict[name]:
         print("Exception: movie already exist")
         return
     self.movieDict[name] = movie(name, releaseYear)
     self.yearwiseMovieDict[releaseYear].add(name)
     for genre in genres:
         self.genrewiseMovieDict[genre].add(name)
Example #6
0
def main():
	"""Getting input and passing to other functions"""
	#title = raw_input('Enter the name of the movie-->  ')
	obj = movie.movie()
	obj.build_db('golmaal')
	choice = input('Enter the index number of the movie you would like to know more about-->  ')
	if choice <0 or choice > (len(obj.similar_movie_list_title))-1:
		print 'invalid choice'
	obj.get_info(choice)
	return 0
Example #7
0
def test_movie():
    assert movie(500, 15, 0.9) == 43
    assert movie(100, 10, 0.95) == 24
    assert movie(0, 10, 0.95) == 2
    assert movie(250, 20, 0.9) == 21
    assert movie(500, 20, 0.9) == 34
    assert movie(2500, 20, 0.9) == 135
Example #8
0
def jikkou(user_ID):
    ext=0

    if(apitushin(user_ID,code) == None):
        print('録画の取得を行います。')
        if(movie(user_ID,code) == None):
            print('取れるサムネが存在しません。')
            ext = 1
        else:
            OpenCV_image,title,tag,profile,category = movie(user_ID,code)
    else:
        OpenCV_image,title,tag,profile,category = apitushin(user_ID,code)

    if(ext == 0):
        print('放送タイトル')
        print(title)
        print('\n設定タグ')
        print(tag)
        print('\nユーザプロフィール')
        print(profile)
        print('\n放送カテゴリ')
        print(category)

        image = comset(OpenCV_image,title,tag,profile,category)

        height,width = image.shape[:-1]
        yokomask = np.full((height, int(height/6) , 3), (0,0,0), dtype=np.uint8)
        tatemask = np.full((int(height/6), width+int(height/6)*2 , 3), (0,0,0), dtype=np.uint8)
        #tate
        tmpImg1 = cv.hconcat([yokomask, image])
        tmpImg2 = cv.hconcat([tmpImg1, yokomask])
        #yoko
        tmpImg3 = cv.vconcat([tatemask, tmpImg2])
        iosImg = cv.vconcat([tmpImg3, tatemask])


        ima = cv.cvtColor(iosImg, cv.COLOR_RGB2BGR)
        cv.imwrite('after_last.png' , ima)
Example #9
0
    def ButtonOnePressed(self, event):
		if self.searchtextbox.GetValue() == "":
			self.textbox.SetValue(constants.ENTER_SOMETHING_VALID)
			return
		self.obj = movie.movie()
		db = self.obj.build_db(self.searchtextbox.GetValue())
		if not db:
			self.textbox.SetValue(constants.COULD_NOT_FIND_MOVIE)
			return
		self.textbox.SetValue(constants.SUMMARY)
		self.textbox.AppendText(db)
		self.button2.Enable()
		self.indextextbox.Enable()
		self.label2.SetLabel('Enter the index')
Example #10
0
 def _readmovie(self, node, supertype):
     movieid = node.getAttribute("id")
     filenode = node.getElementsByTagName("file")[0]
     filename = getText(filenode.childNodes)
     
     rect_str = getText(node.getElementsByTagName('rect')[0].childNodes)
     rect_list = map(lambda x: int(x), rect_str.split(","))
     
     endfuncElems = node.getElementsByTagName("endfunc")
     if len(endfuncElems) > 0:
         endfunc_str = getText(endfuncElems[0].childNodes)
         endfunc = lambda: getattr(supertype, endfunc_str)(self)
     else:
         endfunc = None
         
     m = movie(filename, (rect_list[0], rect_list[1], rect_list[2], rect_list[3]), endfunc=endfunc)
     self._movies[movieid] = m
Example #11
0
#create label in the frame
lbl = Label(frame1, text = "I'm a label!")
lbl.grid()

#create a new frame for button
frame2 = Frame(root)
frame2.grid()

#create a button for the frame
bttn = Button(frame2, text = "I'm a button!")
bttn.grid()

#the configure() method can modify a widget
bttn.configure(text = "I'm still a button!")

#a dictionary-like interface can modify the key of a widget
bttn["text"] = "Always a button"

app = Application(root)

click = Clicker(root)

app = longe(root)

from movie import movie
movie = movie(root)

#kick off the window's event loop
root.mainloop()
Example #12
0
from movie import movie
from stats import stats
import input1

print("Enter the number of rows : ",end="")
n=input1.take_input()

print("Enter the number of columns : ",end="")
m=input1.take_input()

theatre=movie(n,m)

i=1
income=0
booked=0

while i!=0:
	
	print("**********************************")
	print("1. Show the seats")
	print("2. Buy a ticket")
	print("3. Statistics")
	print("4. Show booked Tickets user info")
	print("0. Exit")
	print("**********************************")

	i=input1.take_input()


	if i==1:
		theatre.show_seat()
Example #13
0
def main(args):
    # mpi communicator.
    comm = MPI.COMM_WORLD
    rank = comm.Get_rank()

    # seed.
    workerseed = args.seed + 10000 * comm.Get_rank() if args.seed is not None else None
    if workerseed is not None:
        tc.manual_seed(workerseed % 2 ** 32)
        np.random.seed(workerseed % 2 ** 32)
        random.seed(workerseed % 2 ** 32)

    # logger.
    if rank == 0:
        logger.configure()
    else:
        logger.configure(format_strs=[])

    # env.
    env = make_atari(args.env_name)
    env.seed(workerseed)
    env = Monitor(env, logger.get_dir() and
              os.path.join(logger.get_dir(), str(rank)))
    print(f"frame_stacking: {args.frame_stacking}")
    env = wrap_deepmind(env, frame_stack=args.frame_stacking,
                        clip_rewards=(args.mode =='train'),
                        episode_life=(args.mode =='train'))  # See Mnih et al., 2015 -> Methods -> Training Details.
    env.seed(workerseed)

    # agent.
    agent = CnnPolicy(
        img_channels=env.observation_space.shape[-1],
        num_actions=env.action_space.n,
        kind=args.model_type)

    # optimizer and scheduler.
    max_grad_steps = args.optim_epochs * args.env_steps // (comm.Get_size() * args.optim_batchsize)

    optimizer = tc.optim.Adam(agent.parameters(), lr=args.optim_stepsize, eps=1e-5)
    scheduler = tc.optim.lr_scheduler.OneCycleLR(
        optimizer=optimizer, max_lr=args.optim_stepsize, total_steps=max_grad_steps,
        pct_start=0.0, anneal_strategy='linear', cycle_momentum=False,
        div_factor=1.0)

    # checkpoint.
    if rank == 0:
        try:
            state_dict = tc.load(os.path.join(args.checkpoint_dir, args.model_name, 'model.pth'))
            agent.load_state_dict(state_dict)
            print(f"Continuing from checkpoint found at {os.path.join(args.checkpoint_dir, args.model_name, 'model.pth')}")
        except FileNotFoundError:
            print("Bad checkpoint or none on process 0. Continuing from scratch.")

    # sync.
    with tc.no_grad():
        for p in agent.parameters():
            p_data = p.data.numpy()
            comm.Bcast(p_data, root=0)
            p.data.copy_(tc.tensor(p_data).float())

    # operations.
    if args.mode == 'train':
        learn(env=env, agent=agent, optimizer=optimizer, scheduler=scheduler, comm=comm,
              timesteps_per_actorbatch=args.timesteps_per_actorbatch, max_timesteps=args.env_steps,
              optim_epochs=args.optim_epochs, optim_batchsize=args.optim_batchsize,
              gamma=args.gamma, lam=args.lam, clip_param=args.epsilon, entcoeff=args.ent_coef,
              checkpoint_dir=args.checkpoint_dir, model_name=args.model_name)
        env.close()

    elif args.mode == 'play':
        if comm.Get_rank() == 0:
            play(env=env, agent=agent, args=args)
            env.close()

    elif args.mode == 'movie':
        if comm.Get_rank() == 0:
            movie(env=env, agent=agent, args=args)
            env.close()

    else:
        raise NotImplementedError("Mode of operation not supported!")
Example #14
0
                self.address.add_movie(m1)
            if op == '2':
                for movie in self.address.get_list():
                    print(movie.title)
            if op == "3":
                key = input("어떤 영화를 삭제하시겠습니까?")
                self.address.del_list(key)
            if op == '4':
                for movie in self.address.get_schedule():
                    print(movie.time, movie.title, movie.room)
                    # 시간대별로 정리하고 싶어.
                    # sort로 정리 <- time이라는 형태로 입력값 받기
			if op == '5':
				print('스케쥴 추가')
				time = input("시간 : ")
				room = input("룸 : ")
				title = input("영화제목 : ")
				movie = self.address.get_movie(title)
				
				if movie != None:
					s = schedule(time, room, movie)
					self.scheduler.add_schedule()


    def input_movie(self):                        #입력값 쓸 필요가 없지. input으로 넣을거니까
        inputtitle = input('제목:')
        inputtime = int(input('시간:'))
		inputroom = input('상영관: ')
		
        return movie(inputtitle, dt, inputroom)
import fresh_tomatoes

import webbrowser

# Create an array to store the movies
movies = []

# Generate "Monsters, Inc." movie and add it to movies
monsters_synopsis = "Mike and Sully work at a scream factory, generating  \
                    power from scaring little kids. But when one little  \
                    girl follows Sully back to Monstropolis, he realizes  \
                    that he needs to protect her from his power-hungry boss."
monsters = movie.movie("Monsters, Inc.",
                       "http://vignette4.wikia.nocookie.net/monstersinc" +
                       "movies/images/0/04/MonstersIncposter.jpg",
                       "https://www.youtube.com/watch?\
                       v=Ue_SfrHHBAc", monsters_synopsis)
movies.append(monsters)

# Generate "Mulan" movie and add it to movies
mulan_synopsis = "Family honor is the one most important things in Chinese \
                    culture. So when Mulan fails to honor her family by \
                    becoming a bride, she needs to get a little \
                    untraditional."
mulan = movie.movie("Mulan",
                    "http://ecx.images-amazon.com/images/I/516BH9WH2PL.jpg",
                    "https://www.youtube.com/watch?v=wAbGAkkOgcM",
                    mulan_synopsis)
movies.append(mulan)
Example #16
0
# '''Main class that runs the movie stuff'''
import pageGenerator
import movie
starTrek = movie.movie(
    "Star Trek Into Darkness", "Captain Kirk leads a manhunt to a war-zone. ",
    "http://www.moviedeskback.com/wp-content/uploads/2012/12/Star-Trek-Into-Darkness.jpg",
    "https://www.youtube.com/watch?v=r5gdbUC9mWU")

oblivion = movie.movie(
    "Oblivion", "A veteran assigned to extract Earth's remaining resources.",
    "http://1.bp.blogspot.com/-cMNFRJbgSMQ/UTFMS-TZH7I/AAAAAAAAAJc/_qh0uR6G1Bw/s1600/oblivion+movie.jpg",
    "https://www.youtube.com/watch?time_continue=156&v=XmIIgE7eSak")

inception = movie.movie(
    "Inception",
    "A thief, who steals corporate secrets through the use of dream-sharing technology. ",
    "http://images2.fanpop.com/image/photos/12300000/Inception-Wallpaper-inception-2010-12396931-1440-900.jpg",
    "https://www.youtube.com/watch?v=d3A3-zSOBT4")

interstellar = movie.movie(
    "Interstellar", "A team of explorers travel through a wormhole in space.",
    "https://bfox.files.wordpress.com/2014/11/interstellar-movie.jpg",
    "https://www.youtube.com/watch?v=2LqzF5WauAw")

gravity = movie.movie(
    "Gravity",
    "Two astronauts work together to survive after an accident which leaves them stranded in space.",
    "http://2.bp.blogspot.com/-bDCAq-SUxjc/UfWitIqLKKI/AAAAAAAAADA/4J4z7QN29Z8/s1600/Gravity+poster+(3).jpg",
    "https://www.youtube.com/watch?v=k0ijEEivCbg")

movieList = [starTrek, oblivion, inception, interstellar, gravity]
Example #17
0
import movie
import fresh_tomatoes

toysotry = movie.movie("Toy Story 3", "Toys come to life",
                       "http://goo.gl/ycqhxV",
                       "https://youtu.be/ZZv1vki4ou4")

avatar = movie.movie("Avatar",
                     "human hybrids, called Avatars",
                     "http://goo.gl/B8p0Tb",
                     "https://www.youtube.com/watch?v=5PSNL1qE6VY")

# List to include all movies
list1 = [toysotry, avatar]


fresh_tomatoes.open_movies_page(list1)
Example #18
0
 def test_movie(self):
     self.assertIsNotNone(movie('sistercleaire', jikkou.code))
#print 'Y1'
#surfaces = np.array((surfaces[0], ))
#print 'Y2'
#surfaces = np.array((surfaces[1], ))

print 'subtraction'
surfaces = np.array((surfaces[0] - surfaces[1], ))
print surfaces.shape

print 'interpolation'        
surfaces = np.array([interpolate(surfaces[i], xymultiplier, tmultiplier) for i in range(len(surfaces))])
print surfaces.shape

# setup movie
m = movie(movie_filename, frame_rate=frame_rate)
print m.template

vmin = np.min(surfaces[0])
vmax = np.max(surfaces[0])
    
print 'saving frames', m.tempdir
for ti in range(surfaces.shape[-1]):
    save_array_as_image(m.next_frame(), surfaces[0,:,:,ti], colourmap=colourmap, format='png', vmin=vmin, vmax=vmax)
    
print 'encoding movie', m.filename
encoded = m.encode()

# remove tempdir
del m
        
Example #20
0
 def input_movie(self):                        #입력값 쓸 필요가 없지. input으로 넣을거니까
     inputtitle = input('제목:')
     inputtime = int(input('시간:'))
     return movie(inputtitle, inputtime)
Example #21
0
def run(which=None, time_limit=60):
   """Exhibit quadrilateral mesh plots in 3 movies of a drumhead.
     The drumhead is initially stationary, but has a bump near one
     edge.  Yorick is solving a 2D wave equation to compute the
     evolution of this bump.

     The first movie is a filled mesh plot with color "proportional"
     to the height of the surface of the drum.  A few well chosen
     contour levels (here 3) add a lot to a filled mesh plot.

     The second movie is a "3D" perspective plot of the height of the
     drumhead.  In this movie, the mesh lines are drawn, which is
     slightly confusing since the cells are not all the same shape.

     The second movie is a "3D" shaded plot of the height of the
     drumhead.  Yorick computes surface shading based on the angle
     of each cell from a light source.

     As you watch this, you might reflect on the two dimensionality
     of your retina.  What Yorick lacks by way of 3D graphics is
     really just fancy hidden surface algorithms; the simple
     painter's algorithm used here and in plwf.py is easy to
     implement.

     There are two optional arguments to demo2: the first is the
     number of the movie (1, 2, or 3) you want to watch; the second
     is a time limit on the duration of each movie in seconds (default
     is 60 seconds each)."""
   import movie
   global f, fdot, dt, x, y, level

   # generate a 30-by-30 cell mesh on the [-1,1] square
   x= span(-1, 1, 31, 31)
   y= transpose(x)
   # map the square mesh into a mesh on the unit circle
   # this mesh has more nearly equal area cells than a polar
   # coordinate circle
   scale= maximum(abs(y),abs(x))/(hypot(y,x)+1.e-30)
   x= x*scale
   y= y*scale

   f= exp(-8.*hypot(y+.67,x+.25)**2)*(1.-hypot(y,x)**2)
   f0 = array(f) # get an independent copy
   fdot= 0.0*f[1:-1,1:-1]

   lf= laplacian(f, y,x)
   xdz= x[1:,1:]+x[:-1,1:]-x[1:,:-1]-x[:-1,:-1]
   xzd= x[1:,1:]-x[:-1,1:]+x[1:,:-1]-x[:-1,:-1]
   ydz= y[1:,1:]+y[:-1,1:]-y[1:,:-1]-y[:-1,:-1]
   yzd= y[1:,1:]-y[:-1,1:]+y[1:,:-1]-y[:-1,:-1]
   dt= 0.1875*sqrt(min(min(abs(xdz*yzd - xzd*ydz))))

   window(0, wait=1, style="nobox.gs")
   palette("heat.gp")
   limits(-1, 1, -1, 1)

   # roll the filled mesh movie
   if which==None or which==1:
     fc= (f[1:,1:]+f[:-1,1:]+f[1:,:-1]+f[:-1,:-1]) / 4.
     cmin= cmax= max([max(abs(row)) for row in fc])
     cmin= -cmin
     level= cmax/4.
     display_plf(0)
     fixedlimits = limits()
     movie.movie(display_plf, time_limit, lims=fixedlimits, timing=1)
     # Note; movie_timing is a global variable in movie.py
     print movie.movie_timing[3], "frames of filled mesh drumhead completed in",
     print movie.movie_timing[2], "sec" 
     print "Rate for filled mesh is",
     print movie.movie_timing[3]/(movie.movie_timing[0]-movie.movie_timing[4]+1.0e-4), 
     print "frames/(CPU sec),",
     print movie.movie_timing[3]/(movie.movie_timing[2]-movie.movie_timing[4]+1.0e-4),
     print "frames(wall sec)"

   # roll the perspective movie */
   if which==None or which==2:
     f[:,:]= f0
     limits(-1,1,-1,1)
     display_plm(0)
     fixedlimits = limits()
     movie.movie(display_plm, time_limit, lims=fixedlimits, timing=1)
     print movie.movie_timing[3], "frames of wireframe surface drumhead completed in",
     print movie.movie_timing[2], "sec"
     print "Rate for filled mesh is",
     print movie.movie_timing[3]/(movie.movie_timing[0]-movie.movie_timing[4]+1.0e-4), 
     print "frames/(CPU sec),",
     print movie.movie_timing[3]/(movie.movie_timing[2]-movie.movie_timing[4]+1.0e-4),
     print "frames(wall sec)"

   # roll the shaded movie
   if which==None or which==3:
     f[:,:]= f0
     limits(-1,1,-1,1)
     display_pl3(0)
     fixedlimits = limits()
     movie.movie(display_pl3, time_limit, lims=fixedlimits, timing=1)
     print movie.movie_timing[3], "frames of filled surface drumhead completed in",
     print movie.movie_timing[2], "sec"
     print "Rate for filled mesh is",
     print movie.movie_timing[3]/(movie.movie_timing[0]-movie.movie_timing[4]+1.0e-4), 
     print "frames/(CPU sec),",
     print movie.movie_timing[3]/(movie.movie_timing[2]-movie.movie_timing[4]+1.0e-4),
     print "frames(wall sec)"

     fma()
     limits()
Example #22
0
        genre_list = content.p.find('span',
                                    class_='genre').text.strip().split(', ')
        imdb_rating = float(
            content.find('div', class_='ratings-bar').div['data-value'])
        meta_score_container = content.find(
            'div', class_='inline-block ratings-metascore')
        if meta_score_container != None:
            meta_score = int(meta_score_container.span.text.strip())
        else:
            meta_score = None
        synopsis = content.findAll('p', class_="text-muted")[1].text.strip()

        dir_and_cast_text = content.find('p', class_='').text.strip()
        dir_and_cast_text = " ".join(
            dir_and_cast_text.replace('\n', '').split())
        dir_end = dir_and_cast_text.find("|")
        star_index = dir_and_cast_text.find("Stars")
        dir_list = dir_and_cast_text[dir_and_cast_text.find(":") +
                                     1:dir_end].split(", ")
        cast_list = dir_and_cast_text[star_index + 6:].split(", ")

        image_url = movie_container.find(
            'div', class_='lister-item-image float-left').a.img.get(
                "loadlate")[:-22] + "182_CR0,0,182,268_AL__QL50.jpg"
        movie_obj = movie(title, year_of_release, license, run_time,
                          genre_list, imdb_rating, meta_score, synopsis,
                          dir_list, cast_list, image_url)

        movie_collection.insert_one(movie_obj.toDict())
    sleep(0.1)
Example #23
0
def run(which=None, time_limit=60):
    """Exhibit quadrilateral mesh plots in 3 movies of a drumhead.
     The drumhead is initially stationary, but has a bump near one
     edge.  Yorick is solving a 2D wave equation to compute the
     evolution of this bump.

     The first movie is a filled mesh plot with color "proportional"
     to the height of the surface of the drum.  A few well chosen
     contour levels (here 3) add a lot to a filled mesh plot.

     The second movie is a "3D" perspective plot of the height of the
     drumhead.  In this movie, the mesh lines are drawn, which is
     slightly confusing since the cells are not all the same shape.

     The second movie is a "3D" shaded plot of the height of the
     drumhead.  Yorick computes surface shading based on the angle
     of each cell from a light source.

     As you watch this, you might reflect on the two dimensionality
     of your retina.  What Yorick lacks by way of 3D graphics is
     really just fancy hidden surface algorithms; the simple
     painter's algorithm used here and in plwf.py is easy to
     implement.

     There are two optional arguments to demo2: the first is the
     number of the movie (1, 2, or 3) you want to watch; the second
     is a time limit on the duration of each movie in seconds (default
     is 60 seconds each)."""
    import movie
    global f, fdot, dt, x, y, level

    # generate a 30-by-30 cell mesh on the [-1,1] square
    x = gistfuncs.span(-1, 1, 31, 31)
    y = transpose(x)
    # map the square mesh into a mesh on the unit circle
    # this mesh has more nearly equal area cells than a polar
    # coordinate circle
    scale = maximum(abs(y), abs(x)) / (hypot(y, x) + 1.e-30)
    x = x * scale
    y = y * scale

    f = exp(-8. * hypot(y + .67, x + .25)**2) * (1. - hypot(y, x)**2)
    f0 = numpy.array(f)  # get an independent copy
    fdot = 0.0 * f[1:-1, 1:-1]

    lf = laplacian(f, y, x)
    xdz = x[1:, 1:] + x[:-1, 1:] - x[1:, :-1] - x[:-1, :-1]
    xzd = x[1:, 1:] - x[:-1, 1:] + x[1:, :-1] - x[:-1, :-1]
    ydz = y[1:, 1:] + y[:-1, 1:] - y[1:, :-1] - y[:-1, :-1]
    yzd = y[1:, 1:] - y[:-1, 1:] + y[1:, :-1] - y[:-1, :-1]
    dt = 0.1875 * numpy.sqrt(
        numpy.min(numpy.min(numpy.abs(xdz * yzd - xzd * ydz))))

    window(0, wait=1, style="nobox.gs")
    palette("heat.gp")
    limits(-1, 1, -1, 1)

    # roll the filled mesh movie
    if which == None or which == 1:
        fc = (f[1:, 1:] + f[:-1, 1:] + f[1:, :-1] + f[:-1, :-1]) / 4.
        cmin = cmax = max([max(abs(row)) for row in fc])
        cmin = -cmin
        level = cmax / 4.
        display_plf(0)
        fixedlimits = limits()
        movie.movie(display_plf, time_limit, lims=fixedlimits, timing=1)
        # Note; movie_timing is a global variable in movie.py
        print movie.movie_timing[
            3], "frames of filled mesh drumhead completed in",
        print movie.movie_timing[2], "sec"
        print "Rate for filled mesh is",
        print movie.movie_timing[3] / (movie.movie_timing[0] -
                                       movie.movie_timing[4] + 1.0e-4),
        print "frames/(CPU sec),",
        print movie.movie_timing[3] / (movie.movie_timing[2] -
                                       movie.movie_timing[4] + 1.0e-4),
        print "frames(wall sec)"

    # roll the perspective movie */
    if which == None or which == 2:
        f[:, :] = f0
        limits(-1, 1, -1, 1)
        display_plm(0)
        fixedlimits = limits()
        movie.movie(display_plm, time_limit, lims=fixedlimits, timing=1)
        print movie.movie_timing[
            3], "frames of wireframe surface drumhead completed in",
        print movie.movie_timing[2], "sec"
        print "Rate for filled mesh is",
        print movie.movie_timing[3] / (movie.movie_timing[0] -
                                       movie.movie_timing[4] + 1.0e-4),
        print "frames/(CPU sec),",
        print movie.movie_timing[3] / (movie.movie_timing[2] -
                                       movie.movie_timing[4] + 1.0e-4),
        print "frames(wall sec)"

    # roll the shaded movie
    if which == None or which == 3:
        f[:, :] = f0
        limits(-1, 1, -1, 1)
        display_pl3(0)
        fixedlimits = limits()
        movie.movie(display_pl3, time_limit, lims=fixedlimits, timing=1)
        print movie.movie_timing[
            3], "frames of filled surface drumhead completed in",
        print movie.movie_timing[2], "sec"
        print "Rate for filled mesh is",
        print movie.movie_timing[3] / (movie.movie_timing[0] -
                                       movie.movie_timing[4] + 1.0e-4),
        print "frames/(CPU sec),",
        print movie.movie_timing[3] / (movie.movie_timing[2] -
                                       movie.movie_timing[4] + 1.0e-4),
        print "frames(wall sec)"

        fma()
        limits()