Esempio n. 1
0
File: __init__.py Progetto: cako/epi
    def run(self):
        """ Effectively runs the program through the terminal. """
        print """
Choose one of the options:\n
    (1) Enter your own points,\n
or choose one of the examples below:\n
    (2) Batman (64 points);
    (3) Nike (13 points);
    (4) Mickey (16 points);
    (5) Pizza Without a Slice (8 points);
    (6) Square (8 points);
    (7) Random points (number of points between 10 and 100).
Enter any key to exit.
"""
        choice = raw_input("> ")
        if choice == str(1):
            print """
Please input your coordinates in the following format:
[x_1 + y_1j, x_2 + y_2j, ... ,x_n + y_nj]
Where the Cartesian coordinates of the points are (x_i,y_i) for 1≤i≤n.
Note that the imaginary unit 1j, so the coordinate (1,1) would be written 1+1j,
but the coordinate (3,2) would be written 3+2j.\n
Standard mathematical notation follows that of the library cmath.
Visit http://docs.python.org/library/cmath.htm for more information.
Note that this feature is still experimental and may not work properly.\n
"""
            pts = self.input_from_terminal()
            title = raw_input('Figure title: ')
        elif choice == str(2):
            title = 'Batman'
            pts = epi_examples.BATMAN_LIST
        elif choice == str(3):
            title = 'Nike'
            pts = epi_examples.NIKE_LIST
        elif choice == str(4):
            title = 'Mickey'
            pts = epi_examples.MICKEY_LIST
        elif choice == str(5):
            title = 'Pizza without a slice'
            pts = epi_examples.PIZZA_LIST
        elif choice == str(6):
            title = 'Square'
            pts = epi_examples.SQUARE_LIST
        elif choice == str(7):
            title = 'Random'
            pts = epi_examples.random_list()
        else:
            exit(0)

        figura = Figura(pts, title)
        figura.plot()
        print "\nWould you like to display f(z) (y/n)? "
        if(raw_input("> ") == 'y'):
            print figura.symbol_f()
        
        print "\nWould you like calculate another orbit (y/n)?"
        if(raw_input("> ") == 'y'):
            return 0
        else:
            return -1
Esempio n. 2
0
    def run(self):
        """ Effectively runs the program through the terminal. """
        print """
Choose one of the options:\n
    (1) Enter your own points,\n
or choose one of the examples below:\n
    (2) Batman (64 points);
    (3) Nike (13 points);
    (4) Mickey (16 points);
    (5) Pizza Without a Slice (8 points);
    (6) Square (8 points);
    (7) Random points (number of points between 10 and 100).
Enter any key to exit.
"""
        choice = raw_input("> ")
        if choice == str(1):
            print """
Please input your coordinates in the following format:
[x_1 + y_1j, x_2 + y_2j, ... ,x_n + y_nj]
Where the Cartesian coordinates of the points are (x_i,y_i) for 1≤i≤n.
Note that the imaginary unit 1j, so the coordinate (1,1) would be written 1+1j,
but the coordinate (3,2) would be written 3+2j.\n
Standard mathematical notation follows that of the library cmath.
Visit http://docs.python.org/library/cmath.htm for more information.
Note that this feature is still experimental and may not work properly.\n
"""
            pts = self.input_from_terminal()
            title = raw_input('Figure title: ')
        elif choice == str(2):
            title = 'Batman'
            pts = epi_examples.BATMAN_LIST
        elif choice == str(3):
            title = 'Nike'
            pts = epi_examples.NIKE_LIST
        elif choice == str(4):
            title = 'Mickey'
            pts = epi_examples.MICKEY_LIST
        elif choice == str(5):
            title = 'Pizza without a slice'
            pts = epi_examples.PIZZA_LIST
        elif choice == str(6):
            title = 'Square'
            pts = epi_examples.SQUARE_LIST
        elif choice == str(7):
            title = 'Random'
            pts = epi_examples.random_list()
        else:
            exit(0)

        figura = Figura(pts, title)
        figura.plot()
        print "\nWould you like to display f(z) (y/n)? "
        if (raw_input("> ") == 'y'):
            print figura.symbol_f()

        print "\nWould you like calculate another orbit (y/n)?"
        if (raw_input("> ") == 'y'):
            return 0
        else:
            return -1
Esempio n. 3
0
    def run(self):
        """ Effectively runs the program through the terminal. """
        print """
Choose one of the options:\n
    (1a) Enter your own points from the terminal,\n
    (1b) Enter your own points from a file,\n
or choose one of the examples below:\n
    (2) Batman (64 points);
    (3) Nike (13 points);
    (4) Mickey (16 points);
    (5) Pizza Without a Slice (8 points);
    (6) Square (8 points);
    (7) Random points (number of points between 10 and 100).
Enter any key to exit.
"""
        choice = raw_input("> ")
        if choice == '1a':
            print """
Please input your coordinates in the following format:
[x_1 + y_1j, x_2 + y_2j, ... ,x_n + y_nj]
Where the Cartesian coordinates of the points are (x_i,y_i) for 1≤i≤n.
Note that the imaginary unit 1j, so the coordinate (1,1) would be written 1+1j,
but the coordinate (3,2) would be written 3+2j.\n
"""
            pts = input_from_terminal()
            title = raw_input('Figure title: ')
        elif choice == '1b':
            print """ Your file must be formatted with the first column as the
x axis, and the second column as the y axis. Each line represents a point.\n
"""
            pts = input_from_file(raw_input('File name: '))
            title = raw_input('Figure title: ')
        elif choice == str(2):
            title = 'Batman'
            pts = epi_examples.BATMAN_LIST
        elif choice == str(3):
            title = 'Nike'
            pts = epi_examples.NIKE_LIST
        elif choice == str(4):
            title = 'Mickey'
            pts = epi_examples.MICKEY_LIST
        elif choice == str(5):
            title = 'Pizza without a slice'
            pts = epi_examples.PIZZA_LIST
        elif choice == str(6):
            title = 'Square'
            pts = epi_examples.SQUARE_LIST
        elif choice == str(7):
            title = 'Random'
            pts = epi_examples.random_list()
        else:
            exit(0)

        figura = Figura(pts, title)
        figura.plot()
        print "\nWould you like to display f(z) (y/n)? "
        if (raw_input("> ") == 'y'):
            print figura.symbol_f()

        print "\nWould you like calculate another orbit (y/n)?"
        if (raw_input("> ") == 'y'):
            return 0
        else:
            return -1
Esempio n. 4
0
    def run(self):
        """ Effectively runs the program through the terminal. """
        print """
Choose one of the options:\n
    (1a) Enter your own points from the terminal,\n
    (1b) Enter your own points from a file,\n
or choose one of the examples below:\n
    (2) Batman (64 points);
    (3) Nike (13 points);
    (4) Mickey (16 points);
    (5) Pizza Without a Slice (8 points);
    (6) Square (8 points);
    (7) Random points (number of points between 10 and 100).
Enter any key to exit.
"""
        choice = raw_input("> ")
        if choice == '1a':
            print """
Please input your coordinates in the following format:
[x_1 + y_1j, x_2 + y_2j, ... ,x_n + y_nj]
Where the Cartesian coordinates of the points are (x_i,y_i) for 1≤i≤n.
Note that the imaginary unit 1j, so the coordinate (1,1) would be written 1+1j,
but the coordinate (3,2) would be written 3+2j.\n
"""
            pts = input_from_terminal()
            title = raw_input('Figure title: ')
        elif choice == '1b':
            print """ Your file must be formatted with the first column as the
x axis, and the second column as the y axis. Each line represents a point.\n
"""
            pts = input_from_file(raw_input('File name: '))
            title = raw_input('Figure title: ')
        elif choice == str(2):
            title = 'Batman'
            pts = epi_examples.BATMAN_LIST
        elif choice == str(3):
            title = 'Nike'
            pts = epi_examples.NIKE_LIST
        elif choice == str(4):
            title = 'Mickey'
            pts = epi_examples.MICKEY_LIST
        elif choice == str(5):
            title = 'Pizza without a slice'
            pts = epi_examples.PIZZA_LIST
        elif choice == str(6):
            title = 'Square'
            pts = epi_examples.SQUARE_LIST
        elif choice == str(7):
            title = 'Random'
            pts = epi_examples.random_list()
        else:
            exit(0)

        figura = Figura(pts, title)
        figura.plot()
        print "\nWould you like to display f(z) (y/n)? "
        if(raw_input("> ") == 'y'):
            print figura.symbol_f()
        
        print "\nWould you like calculate another orbit (y/n)?"
        if(raw_input("> ") == 'y'):
            return 0
        else:
            return -1