示例#1
0
 def oCountry(self):
     country1 = self.cmbcntry1.currentText()
     country2 = self.cmbcntry2.currentText()
     if country1=="Choose Any Country" or country2=="Choose Any Country":
         QMessageBox.warning(self,"Message from OLYSIS","Please select any values from combo boxes.",QMessageBox.Ok)
     else:
         Graphs.cmpOCntryGraph(self, country1, country2)
示例#2
0
 def oSports(self):
     sport1 = self.cmbsprts1.currentText()
     sport2 = self.cmbsprts2.currentText()
     if sport1=="Choose Any Sport" or sport2=="Choose Any Sport":
         QMessageBox.warning(self,"Message from OLYSIS","Please select any values from combo boxes.",QMessageBox.Ok)
     else:
         Graphs.cmpOSprtGraph(self, sport1, sport2)
示例#3
0
def average_analysis(temperatures,
                     chem_pot_range,
                     prop_array,
                     prop_name,
                     Wm_array,
                     _accuracy,
                     options,
                     temp_depend=False):
    """
  Performs average analysis on a selected property
  
  """

    # Calculates the average values
    success, error, avg_array = calc_average_value(temperatures,
                                                   chem_pot_range,
                                                   prop_array,
                                                   prop_name,
                                                   Wm_array,
                                                   _accuracy,
                                                   options,
                                                   temp_depend=temp_depend)

    if not success:
        return success, error

    # Plots the average values
    Graphs.avg_values(temperatures, chem_pot_range, avg_array, prop_name,
                      _accuracy, options)

    return success, error
示例#4
0
def floyd_warshall_test():
    d = [[inf, 10, 5, 7, inf, inf], [inf, inf, inf, inf, 10, 1],
         [inf, inf, inf, inf, 3, inf], [inf, inf, inf, inf, inf, 1],
         [inf, inf, inf, inf, inf, inf], [inf, inf, inf, inf, inf, inf]]
    Graphs.floyd_warshall_algorithm(d)
    assert d[0][1] == 10 and d[0][2] == 5 and d[0][3] == 7 and d[0][
        4] == 8 and d[0][5] == 8, "Incorrect solution"
示例#5
0
def finastro_sim():
    # Add stock data
    ticker_group = 'FinAstro'
    tickers = ['LON:FTSE100']
    df_tickers = da.create_df_from_tickers(tickers)

    # Add Ephemeris data
    df_eph = create_ephemeris_df()
    df_eph = df_eph[(df_eph.index > '2001-01-01')
                    & (df_eph.index < '2019-09-30')]
    df = df_eph.join(df_tickers, how='inner')

    # Generate long/short tickers i.e. signals
    df = Strategy.create_long_short_tickers(tickers, df, ticker_group)

    # Run backtest
    portfolio = Portfolio(df)
    Backtest.run(df, portfolio)
    Performance.metrics(portfolio, ticker_group)

    # Outputs
    pd.options.display.float_format = '{:20,.2f}'.format
    portfolio.orders_df.to_csv(cp.files['orders'])
    portfolio.trades_df.to_csv(cp.files['trades'])
    portfolio.df.to_csv(cp.files['backtest'])

    portfolio.metrics_df.to_csv(cp.files['metrics'])
    print(portfolio.metrics_df)
    Graphs.equity_curve(df=portfolio.df)
示例#6
0
 def mSports(self):
     sport = self.cmbsprts.currentText()
     year1 = self.cmbyear1.currentText()
     year2 = self.cmbyear2.currentText()
     if sport=="Choose Any Sports" or year1=="Choose Any Year" or year2=="Choose Another Year":
         QMessageBox.warning(self,"Message from OLYSIS","Please select any values from combo boxes.",QMessageBox.Ok)
     else:
         Graphs.cmpMSprtGraph(self,sport,year1,year2)
示例#7
0
 def mGender(self):
     gender = self.cmbgnder.currentText()
     year1 = self.cmbyear1.currentText()
     year2 = self.cmbyear2.currentText()
     if gender == "Choose Any Gender" or year1 == "Choose Any Year" or year2 == "Choose Another Year":
         QMessageBox.warning(self,"Message from OLYSIS","Please select any values from combo boxes.",QMessageBox.Ok)
     else:
         Graphs.cmpMGndrGraph(self,gender,year1,year2)
示例#8
0
 def mCountry(self):
     country = self.cmbcntry.currentText()
     year1=self.cmbyear1.currentText()
     year2 = self.cmbyear2.currentText()
     if country=="Choose Any Country" or year1=="Choose Any Year" or year2=="Choose Another Year":
         QMessageBox.warning(self,"Message from OLYSIS","Please select any values from combo boxes.",QMessageBox.Ok)
     else:
         Graphs.cmpMCntryGraph(self,country,year1,year2)
示例#9
0
def bfs_test():
    graph = []
    graph.append([2])
    graph.append([2])
    graph.append([0, 1])
    p = [-1 for i in range(len(graph))]
    Graphs.bfs(graph, p, 0)
    assert p[0] == -1 and p[1] == 2 and p[2] == 0, "Incorrect solution"
示例#10
0
 def mCntrywise(self):
     country = self.cmbcntry.currentText()
     medal = self.cmbmdl.currentText()
     if country == "Choose Any Country" or medal == "Choose Any Medal":
         QMessageBox.warning(self, 'Message from OLYSIS',
                             "Please select any value from combo boxes.",
                             QMessageBox.Ok)
     else:
         Graphs.showMCntryMGraph(self, country, medal)
示例#11
0
 def mGnderwise(self):
     gender = self.cmbgnder.currentText()
     medal = self.cmbmdl.currentText()
     if gender == "Choose Any Gender" or medal == "Choose Any Medal":
         QMessageBox.warning(self, 'Message from OLYSIS',
                             "Please select any value from combo boxes.",
                             QMessageBox.Ok)
     else:
         Graphs.showMGndrMGraph(self, gender, medal)
示例#12
0
 def mSprtswise(self):
     sport = self.cmbsprts.currentText()
     medal = self.cmbmdl.currentText()
     if sport == "Choose Any Sport" or medal == "Choose Any Medal":
         QMessageBox.warning(self, 'Message from OLYSIS',
                             "Please select any value from combo boxes.",
                             QMessageBox.Ok)
     else:
         Graphs.showMSprtMGraph(self, sport, medal)
示例#13
0
def play(player):
    """
    Handles the game turns. This function should be invoked after init(), connect() and share_graphs().
    :param player: The player object.
    :return:
    """
    srv_req = player.receive()
    is_over = False
    game_result = None
    if srv_req == RPSNetwork.TURN_NEED:

        # Asks for rock, paper or scissor.
        choice = ask_for_graph(player)
        my_g = player.get_graph(choice)

        # A isomorphic copy of the chosen graph will be sent to the opponent.
        my_iso_g, iso = my_g.isomorphic_copy()
        dmp = pickle.dumps(my_iso_g)
        player.send(dmp)

        # Receives the opponents chosen graph.
        op_g = oppon_turn(player)

        # Send the isomorphism
        player.send(pickle.dumps(iso))

        # Check if the game is over and determine the winner.
        game_result = finish_turn(player, choice, op_g)

    elif srv_req == RPSNetwork.TURN_SEND:

        # Receives the opponents chosen graph.
        op_g = oppon_turn(player)

        # Asks for rock, paper or scissor.
        choice = ask_for_graph(player)
        my_g = player.get_graph(choice)
        dmp = pickle.dumps(my_g)
        player.send(dmp)

        # Receives the opponents isomorphism
        op_iso = oppon_turn(player)

        # Calculates the opponents graph back.
        inv_func = Graphs.inv_permut_function(op_iso)
        op_edges = Graphs.apply_isomorphism(op_g.edges, inv_func)
        op_g = Graphs.Graph(op_edges)

        # Check if the game is over and determine the winner.
        game_result = finish_turn(player, choice, op_g)

    if game_result != RES_DRAW:
        is_over = True

    player.send(str(game_result))

    return is_over
示例#14
0
def dfs_test():
    graph = []
    graph.append([2, 1])
    graph.append([2])
    graph.append([0, 1])
    p = [-1 for i in range(len(graph))]
    color = [0] * len(graph)
    timers = [[0 for j in range(2)] for i in range((len(graph)))]
    timer = [0]
    Graphs.dfs(graph, 0, p, color, timers, timer)
    assert p[0] == -1 and p[1] == 2 and p[2] == 0, "Incorrect solution"
示例#15
0
def djikstra_sparse_test():
    graph = []
    graph.append([(1, 10), (2, 5), (3, 7)])
    graph.append([(0, 10), (4, 10), (5, 1)])
    graph.append([(0, 5), (4, 1), (5, 15)])
    graph.append([(0, 7), (4, 10)])
    graph.append([(1, 10), (2, 1)])
    graph.append([(1, 1), (2, 15)])
    p = [-1 for i in range(len(graph))]
    d = [inf] * len(graph)
    Graphs.djikstra_sparse(graph, 0, p, d)
    assert p[0] == -1 and p[1] == 0 and p[2] == 0 and p[3] == 0 and p[
        4] == 2 and p[5] == 1, "Incorrect solution"
示例#16
0
def bellman_ford_shortest_path_test():
    graph = []
    graph.append([(0, 1, 10), (0, 2, 5), (0, 3, 7)])
    graph.append([(1, 0, 10), (1, 4, 10), (1, 5, 1)])
    graph.append([(2, 0, 5), (2, 4, 1), (2, 5, 15)])
    graph.append([(3, 0, 7), (3, 4, 10)])
    graph.append([(4, 1, 10), (4, 2, 1)])
    graph.append([(5, 1, 1), (5, 2, 15)])
    p = [-1 for i in range(len(graph))]
    d = [inf] * len(graph)
    Graphs.bellman_ford_shortest_path(graph, 0, p, d)
    assert p[0] == -1 and p[1] == 0 and p[2] == 0 and p[3] == 0 and p[
        4] == 2 and p[5] == 1, "Incorrect solution"
示例#17
0
def distribution_analysis(chem_pot_multi, names, temperatures, chem_pot_range,
                          min_energies, delta_E_sums, experiment_cnts,
                          permutations, omega_c_arr, _accuracy, options):
    """
  Performs the distribution analysis: evaluates Wm and plots it against m and mu.
  
  """

    log(__name__, "Distribution analysis", options.verbose, indent=2)

    success = True
    error = ""

    # Preparing Wm probabilities
    Wm_array = prepare_Wm(chem_pot_multi, temperatures, chem_pot_range,
                          min_energies, delta_E_sums, experiment_cnts,
                          permutations, _accuracy, options)

    # Writing Wm into a file
    success, error = IO.write_Wm(temperatures, chem_pot_range, chem_pot_multi,
                                 Wm_array)

    if not success:
        return success, error, Wm_array

    # Plotting the Wm probabilities 3D plots
    Graphs.wm_contour(temperatures, names, chem_pot_range, chem_pot_multi,
                      Wm_array, _accuracy, options)

    # Performing analysis with respect to the distribution function (average m is the standard analysis)
    # average m
    average_analysis(temperatures,
                     chem_pot_range,
                     chem_pot_multi,
                     "m",
                     Wm_array,
                     _accuracy,
                     options,
                     temp_depend=False)

    # average gamma
    average_analysis(temperatures,
                     chem_pot_range,
                     omega_c_arr,
                     "\gamma^{c}",
                     Wm_array,
                     _accuracy,
                     options,
                     temp_depend=True)

    return success, error, Wm_array
示例#18
0
 def showPotential(self, data):
     if self.norun:
         return
     if not self.isGraphing("DRAWPOT"):
         return
     dv1 = Graphs.DrawPotential(data)
     self._sendplot(dv1)
示例#19
0
	def showVelocity(self, data, fvm=None, plottype=None):
		if not self.isGraphing():
			return
		dv1 = Graphs.DrawVelocity(data, fvm=fvm)
		if plottype is not None:
			dv1.plottype = plottype
		self._sendplot(dv1)
示例#20
0
 def load_graph(self, dmp):
     """
     Receives a graphs and appends it at self.graphs.
     :param dmp: A pickle dump that contains the edge list of a graph.
     """
     edges = pickle.loads(dmp)
     self.graphs.append(Graphs.Graph(edges))
示例#21
0
 def showMultiTrajectories(self,
                           name,
                           data,
                           itt,
                           t0,
                           dt,
                           defaultplot,
                           graphoptions=None,
                           title=None,
                           early=None):
     if self.norun:
         return
     if not self.isGraphing(name):
         return
     if early is not None:
         self.graphBeforeEndOfFF(name, early)
     dv1 = Graphs.DrawMultipleTrajectories(name,
                                           data,
                                           itt,
                                           t0,
                                           dt,
                                           defaultplot,
                                           graphoptions=graphoptions,
                                           title=title)
     self._sendplot(dv1)
示例#22
0
def barabasiAlbert(n, d):
    """Generates an undirected Barabasi-Albert  random graph.
    A Barabasi-Albert (A.K.A. preferential atachment) random
    graph starts with a clique of d nodes, then adds nodes 
    sequentially. Each new node is connected to d existing,
    chosen with probability proportional to the existing node's
    degree.

    en.wikipedia.org/wiki/Barab%C3%A1si%E2%80%93Albert_model

    n: number of nodes
    d: degree of each new node
    """
    nodes = range(n)
    edges = set()
    degrees = np.zeros(n)
    for node in nodes:
        degrees[node] += 1
        new_edges = set()
        while degrees[node] <= d and degrees[node] <= node:
            neighbor = list(multinomial(1, degrees / degrees.sum())).index(1)
            e = (node, neighbor)
            if (e in new_edges) or (e[0] == e[1]):
                continue
            new_edges.add(e)
            degrees[neighbor] += 1
            degrees[node] += 1
        edges.update(new_edges)
    return Graphs.UndirectedGraph(nodes, edges)
示例#23
0
def ReadGraphFromFile( fileName ):

    print "Name of the file: ", fileName
    first_header_line = True

    for line in open(fileName):
        print line
        edge = line.split()

        if first_header_line:
            first_header_line = False
            maxSize = int(edge[0])
            graphFromFile = Graphs.Graph(maxSize+1)
        else:
            vertex = int(edge[0])
            for next_vertex in edge:
                adjacent_vertex = next_vertex.split(',')
                #debug_var = (adjacent_vertex[0])
                if int(adjacent_vertex[0]) != vertex:
                    # Note, althought this graph isn't directed, each vertex has an adjacency list,
                    # so to prevent duplicates we call insert edge with directed = True to prevent
                    # that function from doing it both ways.

                    graphFromFile.InsertEdge(vertex, int(adjacent_vertex[0]), True, int(adjacent_vertex[1]) )

    return graphFromFile, maxSize
示例#24
0
def coolGraph(n=22, cluster_n=4, p1=.9, p2=0.8):
    #generates a cool graph. There are n nodes, and there
    #are cluster_n number of clusters. The size of each cluster
    #is n/(cluster_n - 1). There is one clusters' worth of nodes that
    #are reserved to be bridge style nodes. Within clusters there is
    #a high probability of connection, and every node also has a small
    #probability of connecting with a connector node.
    print n
    print cluster_n
    cluster_size = int(n / cluster_n)
    edges = []
    clusters = [[]] * (cluster_n)
    connectors = range(n)[(cluster_size * cluster_n - 1):n]
    for i in range(0, cluster_size * cluster_n):
        clusters[i % cluster_size].append(i)

        for j in range(i, cluster_size * cluster_n):
            if i != j and i % cluster_size == j % cluster_size:
                if uniform(0, 1) < p1:
                    edges.append((i, j))

    for connector in connectors:
        for cluster in clusters:
            if uniform(0, 1) < p2:
                edges.append((i, choice(cluster)))

    return Graphs.UndirectedGraph(range(n), edges)
def tryChromeWithWebsite(chrome_name, chrome, website_name, website):
    """Run chrome with website

    Args:
        chrome: path to chrome binary. Ex: out/Default/chrome
        website: website url

    Returns:
        Summary of object created and their normalized size
    """
    out_log_file = "./" + website_name + "_" + chrome_name + ".csv"
    print out_log_file
    with open(out_log_file, "w") as fwrite:
        chrome_sp = sp.Popen([chrome, website], stdout=fwrite, preexec_fn=os.setsid)
        time.sleep(25)
        try:
            # os.killpg(os.getpgid(chrome_sp.pid), signal.SIGTERM)
            chrome_sp.terminate()
            # chrome_sp.send_signal(-9)
        except OSError:

            # can't kill a dead proc
            pass
        print chrome_sp.wait()
        # fwrite.close()
    return Graphs.read_individual_csv(out_log_file, out_log_file + ".png")
示例#26
0
def OddCore(G):
    """
    Subgraph of vertices and edges that participate in odd cycles.
    Aka, the union of nonbipartite biconnected components.
    """
    return Graphs.union(*[C for C in BiconnectedComponents(G)
                          if not isBipartite(C)])
示例#27
0
def createTimeline(players, date1, date2):
    drinks = []
    dates = []
    startdate = datetime.strptime(date1, "%m/%d/%y")
    enddate = datetime.strptime(date2, "%m/%d/%y")

    for player in data["Players"]:
        # Checks if the current player is an active player.
        if (player["name"] in players):
            for i in range((enddate - startdate).days + 1):
                date = (startdate + timedelta(days=i)).strftime("%#m/%#d/%y")
                dates.append(date)
                drinks.append(
                    calculateDrinks(player["Scores"], dates[i], dates[i]))
            Graphs.plotTimeline(dates, drinks, player["id"])
            dates.clear()
            drinks.clear()
示例#28
0
def randomEdgeDirections(graph):
    edges = []
    for src, dst in set(map(lambda e: tuple(sorted(e)), graph.allEdges())):
        if uniform(0, 1) < 0.5:
            edges.append((src, dst))
        else:
            edges.append((dst, src))
    return Graphs.DirectedGraph(graph.nodes, edges)
示例#29
0
	def showPhi(self, time, phi, dta, dt, plottype=None):
		if not self.isGraphing():
			return
		if len(phi) > 0:
			dv1 = Graphs.DrawPhi([np.array(time), phi, dta], dt)
			if plottype != None:
				dv1.plottype = plottype
			self._sendplot(dv1)
示例#30
0
    def graph(self):
        i = self.liste.currentItem()
        t = 0
        exchange1, null, ticker1 = i.text().split()

        #open the Graphs window
        self.window = QtWidgets.QMainWindow()
        self.ui = Graphs.Ui_Dialog()
        self.ui.setupUi(self.window, exchange1, ticker1)
        self.window.show()
示例#31
0
def main():

    trainingFiles, testFiles = getYELPFiles()
    print 'importing ~230,000 reviews...'
    reviewsList = importJSONFiles([trainingFiles[REVIEW]])[0]
    print 'import finished'

    # construct list "y" of scores
    scoreVector = np.asmatrix([review['votes']['useful'] for review in reviewsList]).T

    # GENERATE GRAPH
    #################################
    Graphs.helpfulDist(reviewsList)
    #################################

    # CONCURRENT REGRESSION CONFIGURATIONS
    ###############################################################################################
    pid1 = os.fork()
    if pid1 == 0:
        weightVector, RMSLE = regSentences(reviewsList, scoreVector)       # RMSLE = 0.6447
        exit(RMSLE)

    pid2 = os.fork()
    if pid2 == 0:
        weightVector, RMSLE = regLines(reviewsList, scoreVector)           # RMSLE = 0.6382
        exit(RMSLE)

    pid3 = os.fork()
    if pid3 == 0:
        weightVector, RMSLE = regLinesSqrLines(reviewsList, scoreVector)   # RMSLE = 0.6371
        exit(RMSLE)

    pid4 = os.fork()
    if pid4 == 0:
        weightVector, RMSLE = regLinesLogLines(reviewsList, scoreVector)   # RMSLE = 0.6365
        exit(RMSLE)

    pid5 = os.fork()
    if pid5 == 0:
        weightVector, RMSLE = regLinesSentences(reviewsList, scoreVector)  # RMSLE = 0.6320
        exit(RMSLE)

    pid6 = os.fork()
    if pid6 == 0:
        weightVector, RMSLE = regUserScores(reviewsList, scoreVector, trainingFiles)  # RMSLE = 0.5330
        exit(RMSLE)
    weightVector, RMSLE = regUserScores(reviewsList, scoreVector, trainingFiles)  # RMSLE = 0.5330

    pid7 = os.fork()
    if pid7 == 0:
        weightVector, RMSLE = regLogLinesLogSentences(reviewsList, scoreVector)  # RMSLE = 0.6340
        exit(RMSLE)

    RMSLE1 = os.waitpid(pid1,0)
    RMSLE2 = os.waitpid(pid2,0)
    RMSLE3 = os.waitpid(pid3,0)
    RMSLE4 = os.waitpid(pid4,0)
    RMSLE5 = os.waitpid(pid5,0)
    RMSLE6 = os.waitpid(pid6,0)
    RMSLE7 = os.waitpid(pid7,0)
    ###############################################################################################



    # REGRESSION (with testing) ON ADJECTIVES AND ADVERBS  RMSLE = 0.6329
    #################################################################################
    # CONCURRENT training  (set desired number of training reviews to use inside the method)
    weightVector, RMSLE = concurrentFeatureExtractor(reviewsList, scoreVector)

    # SEQUENTIAL training  (set desired number of training reviews to use inside the method)
    weightVector, RMSLE = regLinesAdjAdv(reviewsList, scoreVector)

    # concurrent testing
    TestSet.testConcAdjAdv(testFiles, weightVector)
    #################################################################################



    # 2 other possible test configurations
    #################################################################
    weightVector, RMSLE = regLinesSentences(reviewsList, scoreVector)
    TestSet.testLinesSentences(testFiles, weightVector)
    #################################################################




    # NAIVE BAYES
    ####################################################
    NaiveBayes.probScoreGivenCategories(trainingFiles)
    ####################################################

    print '\nGot to the end, Terminating...'
示例#32
0
    def __init__(self):
        global ARM_ADDRESS, SENSOR_ADDRESS, DRIVE_ADDRESS, SENSOR_READ_ADDRESSES
        global SENSORS, ser, pser 

        QMainWindow.__init__(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowTitle("application main window")
        self.resize(1000, 1000)

        # --- Menu --- #
        self.file_menu = QMenu('&File', self)
        self.file_menu.addAction('&Quit', self.fileQuit,
                                 Qt.CTRL + Qt.Key_Q)
        self.menuBar().addMenu(self.file_menu)

        # --- Widgets --- #
        self.tabs = QTabWidget()
        self.graph_widget = QWidget()
        self.map_widget = QWidget()
        self.topview_widget = QWidget()

        # Combo box for selecting which graphs to view
        self.graph_chooser_top = QComboBox(self.graph_widget)
        self.graph_chooser_top.addItems(['Gas Sensor', 'Moisture Sensor'])
        self.graph_chooser_bottom = QComboBox(self.graph_widget)
        self.graph_chooser_bottom.addItems(['Gas Sensor', 'Moisture Sensor'])

        # Dynamic canvases to hold graphs
        dc1 = Graphs.dynamic_graph_canvas(Graphs.dynamic_graph_canvas.\
            gas_sensor, parent=self.graph_widget, width=5, height=4, dpi=100)
        dc2 = Graphs.dynamic_graph_canvas(Graphs.dynamic_graph_canvas.\
            moisture_sensor, parent=self.graph_widget, width=5, height=4, dpi=100)

        # Make map widget
        if GPSGui.marble_imported:                    # see import statement at top for reason
            UTIAS = Marble.GeoDataCoordinates(-79.466083, 43.782247, 0, Marble.GeoDataCoordinates.Degree)
            gps_map = GPSGui.GPSMapWidget(UTIAS,'UTIASTest.osm','/dev/ttyUSB0','/dev/ttyUSB1')
        
        # Start joystick
        try:                      # so that it can still run without joystick connected
            self.joystick_thread = QThread()
            self.j = Joystick.Joystick(ARM_ADDRESS, DRIVE_ADDRESS, ser, pser)
            self.j.moveToThread(self.joystick_thread)

            self.connect(self.joystick_thread, SIGNAL("started()"), self.j.start_joystick)
            self.connect(self.joystick_thread, SIGNAL("finished()"), self.j.end_joystick)

            self.joystick_thread.start()
        except:
            print "Failed to start joystick: joystick probably not plugged in"

        # start sensor getter
        try:
            self.sensor_getter_thread = QThread()
            self.sg = SensorGetter.SensorGetter(SENSOR_READ_ADDRESSES, SENSORS, ser, pser)
            sef.sg.moveToThread(self.sensor_getter_thread)

            self.connect(self.sensor_getter_thread, SIGNAL("started()"), self.j.start_sg)
            self.connect(self.sensor_getter_thread, SIGNAL("finished()"), self.j.end_sg)

            self.sensor_getter_thread.start()
        except:
            print "Failed to start sensor getter"


        # Coloured wheels widget
        rov = RoverTopview.RoverTopview()

        # Box layout for graph_widget, holds 2 graph canvases and combo box
        l = QHBoxLayout()
        v1 = QVBoxLayout()
        v2 = QVBoxLayout()
        v1.addWidget(dc1)
        v1.addWidget(self.graph_chooser_top)
        v2.addWidget(dc2)
        v2.addWidget(self.graph_chooser_bottom)
        l.addLayout(v1)
        l.addLayout(v2)
        self.graph_widget.setLayout(l)

        # Horizontal box layout for map_widget, holds label with map image
        l2 = QHBoxLayout()
        if GPSGui.marble_imported:    # see import for reason
            l2.addWidget(gps_map)
        self.map_widget.setLayout(l2)

        # Layout for topview_widget
        l3 = QHBoxLayout()
        l3.addWidget(rov)
        self.topview_widget.setLayout(l3)

        # Combo box event
        self.graph_chooser_top.activated[str].connect(dc1.graph_change_handler)
        self.graph_chooser_bottom.activated[str].connect(dc2.graph_change_handler)

        # Create tabs
        self.tabs.addTab(self.graph_widget, 'Graphs')
        self.tabs.addTab(self.map_widget, 'Map')
        self.tabs.addTab(self.topview_widget, 'Top View')

        self.tabs.setWindowTitle('RSX Rover Control')
        self.tabs.show()