def getCurrent(self):
        # checks if to position is in range
        if self.position > len(self.secondaries):
            self.position = len(self.secondaries)
        if self.position < 0:
            self.position = 0

        # returns distribution at position
        if self.position == 0:
            return extract_distribution(self.getFilename(), self.getPath(), extra_info=True)
        else:
            return extract_distribution(self.secondaries[self.position-1].getFilename(), self.getPath(), extra_info=True)
Ejemplo n.º 2
0
    def getCurrent(self):
        # checks if to position is in range
        if self.position > len(self.secondaries):
            self.position = len(self.secondaries)
        if self.position < 0:
            self.position = 0

        # returns distribution at position
        if self.position == 0:
            return extract_distribution(self.getFilename(),
                                        self.getPath(),
                                        extra_info=True)
        else:
            return extract_distribution(self.secondaries[self.position -
                                                         1].getFilename(),
                                        self.getPath(),
                                        extra_info=True)
Ejemplo n.º 3
0
         xAxisVals = range(size)
         print " using default: ",xAxisVals
        
         
 
     dist_factory = Cumulative.build()
     normal = dist_factory.create_dist(size, start, end)
     old_dist = normal.dist
     graph = Bar_Graph(normal.dist,title='',X_AXIS_VALS=xAxisVals)    # graph of the sample
 
 
 else:
     filename = raw_input("\nFileName >> ").strip()
     if filename[-5:] != ".dist":
         filename = filename + ".dist"
     load_dist, extra_info = extract_distribution(filename, extra_info=True)
     title = ''
     size = len(load_dist)
     xAxisVals = range(size)
     for info in extra_info:
         try:
             exec(info)
         except Exception, val:
             print "Invalid Extra Info: " + str(val)
     old_dist = load_dist
     normal = Distribution(load_dist)
     graph = Bar_Graph(load_dist,title=title,X_AXIS_VALS=xAxisVals)    # graph of the sample
     
 
 # initialization
 display.set_caption("Graphs and Modifies Normal distributions")
Ejemplo n.º 4
0
                    xAxisVals.append(val)
            else:
                xAxisVals = range(size)
                print " using default: ", xAxisVals

            dist_factory = Cumulative.build()
            normal = dist_factory.create_dist(size, start, end)
            old_dist = normal.dist
            graph = Bar_Graph(normal.dist, title='',
                              X_AXIS_VALS=xAxisVals)  # graph of the sample

        else:
            filename = raw_input("\nFileName >> ").strip()
            if filename[-5:] != ".dist":
                filename = filename + ".dist"
            load_dist, extra_info = extract_distribution(filename,
                                                         extra_info=True)
            title = ''
            size = len(load_dist)
            xAxisVals = range(size)
            for info in extra_info:
                try:
                    exec(info)
                except Exception, val:
                    print "Invalid Extra Info: " + str(val)
            old_dist = load_dist
            normal = Distribution(load_dist)
            graph = Bar_Graph(load_dist, title=title,
                              X_AXIS_VALS=xAxisVals)  # graph of the sample

        # initialization
        display.set_caption("Graphs and Modifies Normal distributions")
                    elif st == "delay":
                        DELAY_ALLOWED = not DELAY_ALLOWED
                        print "\nDELAY_ALLOWED = " + str(DELAY_ALLOWED)

                    # undoes las change
                    elif st == "undo":
                        graph.clear()
                        graph.update_values(old_dist)
                        graph.draw(graph.old_x, graph.old_y)

                    # loads a distribution
                    elif st == "load":
                        filename = raw_input("\nFileName >> ").strip()
                        #if directory not in filename:
                        #    filename = directory + filename                        
                        new_dist = extract_distribution(filename)
                        graph.clear()
                        graph.update_values(new_dist)
                        graph.draw(graph.old_x, graph.old_y)
                        
                    # clears distribution
                    elif st == "restart":
                        graph.clear()
                        normal = dist_factory.create_dist(size)
                        graph.draw(graph.old_x, graph.old_y)

                    # writes distribution to file
                    elif st == "save":
                        filename = raw_input("\nFileName >> ").strip()
                        if filename == "":
                            filename = "output.txt"
Ejemplo n.º 6
0
                    elif st == "delay":
                        DELAY_ALLOWED = not DELAY_ALLOWED
                        print "\nDELAY_ALLOWED = " + str(DELAY_ALLOWED)

                    # undoes las change
                    elif st == "undo":
                        graph.clear()
                        graph.update_values(old_dist)
                        graph.draw(graph.old_x, graph.old_y)

                    # loads a distribution
                    elif st == "load":
                        filename = raw_input("\nFileName >> ").strip()
                        #if directory not in filename:
                        #    filename = directory + filename
                        new_dist = extract_distribution(filename)
                        graph.clear()
                        graph.update_values(new_dist)
                        graph.draw(graph.old_x, graph.old_y)

                    # clears distribution
                    elif st == "restart":
                        graph.clear()
                        normal = dist_factory.create_dist(size)
                        graph.draw(graph.old_x, graph.old_y)

                    # writes distribution to file
                    elif st == "save":
                        filename = raw_input("\nFileName >> ").strip()
                        if filename == "":
                            filename = "output.txt"