Ejemplo n.º 1
0
def plot_autopilot(Data):

    Title = [
        'Speed', 'Active Speed', 'Delta', 'Regime', 'Yaw Rate',
        'Comparison btw autopilot and drix speed'
    ]

    if not Data.autopilot:
        L = No_Data_Found_plots(Title)
        Red_line = True

    else:
        fig0 = normal_plot(Data.autopilot['Speed'], Title[0])
        fig1 = normal_plot(Data.autopilot['ActiveSpeed'], Title[1])
        fig2 = normal_plot(Data.autopilot['Delta'], Title[2])
        fig3 = normal_plot(Data.autopilot['Regime'], Title[3])
        fig4 = normal_plot(Data.autopilot['yawRate'], Title[4])
        fig5 = several_plot(Data.autopilot['speed_autopilot'],
                            Title[5],
                            list_y=['y_gps', 'y_autopilot'],
                            label_y=['Gps speed', 'Autopilot speed'])

        L = [fig0, fig1, fig2, fig3, fig4, fig5]
        Red_line = False

    # Fig = merge_plots(L,'Autopilot Data',red_line = Red_line)
    # plotly.offline.plot(Fig, filename = Data.ihm_path + '/autopilot/Bilan_autopilot3000.html', auto_open=False)

    IHM.html_page_creation(Data, 'Autopilot Data', L,
                           '/autopilot/Bilan_autopilot3000.html')
Ejemplo n.º 2
0
def plot_trimmer_status(Data):

    Title = [
        'Primary Powersupply Consumption (A)',
        'Secondary Powersupply Consumption (A)', 'Motor Temperature (deg)',
        'PCB Temperature (deg)', 'Relative Humidity (%)'
    ]

    if not Data.gpu_state:
        L = No_Data_Found_plots(Title)
        Red_line = True

    else:
        fig0 = normal_plot(
            Data.trimmer_status['primary_powersupply_consumption_A'], Title[0])
        fig1 = normal_plot(
            Data.trimmer_status['secondary_powersupply_consumption_A'],
            Title[1])
        fig2 = normal_plot(Data.trimmer_status['motor_temperature_degC'],
                           Title[2])
        fig3 = normal_plot(Data.trimmer_status['pcb_temperature_degC'],
                           Title[3])
        fig4 = normal_plot(Data.trimmer_status['relative_humidity_percent'],
                           Title[4])

        L = [fig0, fig1, fig2, fig3, fig4]
        Red_line = False

    # Fig = merge_plots(L,'Trimmer Status', red_line = Red_line)
    # plotly.offline.plot(Fig, filename = Data.ihm_path + '/trimmer_status/Bilan_trimmer_status3000.html', auto_open=False)

    IHM.html_page_creation(Data, 'Trimmer status', L,
                           '/trimmer_status/Bilan_trimmer_status3000.html')
Ejemplo n.º 3
0
def plot_gpu_state(Data):

    Title = [
        'GPU Temperature (deg)', 'GPU Utilization (deg)',
        'GPU memory utilization (%)', 'GPU Total Memory (GB)',
        'GPU Power Consumption (W)', 'GPU Power Consumption (W)'
    ]

    if not Data.gpu_state:
        L = No_Data_Found_plots(Title)
        Red_line = True

    else:

        fig0 = normal_plot(Data.gpu_state['temperature_deg_c'], Title[0])
        fig1 = normal_plot(Data.gpu_state['gpu_utilization_percent'], Title[1])
        fig2 = normal_plot(Data.gpu_state['mem_utilization_percent'], Title[2])
        fig3 = normal_plot(Data.gpu_state['total_mem_GB'], Title[3])
        fig4 = normal_plot(Data.gpu_state['power_consumption_W'], Title[4])
        fig5 = normal_plot(Data.gpu_state['power_consumption_W'], Title[5])

        L = [fig0, fig1, fig2, fig3, fig4, fig5]
        Red_line = False

    # Fig = merge_plots(L,'Gpu State', red_line = Red_line)
    # plotly.offline.plot(Fig, filename = Data.ihm_path + '/gpu_state/Bilan_gpu_state3000.html', auto_open=False)

    IHM.html_page_creation(Data, 'Gpu State', L,
                           '/gpu_state/Bilan_gpu_state3000.html')
Ejemplo n.º 4
0
def placement_pion(grille, joueur, num_ligne, num_colonne):
    ''' Cette fonction place le pion du joueur passé en paramètre dans la
        case dont le numéro de ligne et de colonne sont eux aussi passés en
        paramètre. La gravité et l'affichage de la grille dans la console sont
        appliqués si le module gravite a été complété.  '''
    cl = case_libre_la_plus_basse(grille, num_colonne)
    if cl is not None: num_ligne, num_colonne = cl
    grille[num_ligne][num_colonne] = joueur
    affichage_console(grille)
    IHM.collage_du_pion(joueur, num_ligne, num_colonne)
Ejemplo n.º 5
0
def plot_iridium_status(Data):

    Title = [
        'Iridium link state', 'Signal strength', 'Registration status',
        'MO = mobile originated = outgoing messages from modem to sattelites (GSS), mo_status_code',
        'last_mo_msg_sequence_number',
        'MT = Mobile Terminated = incoming messages from modem to sattelites (GSS), mt_status_code',
        'Mobile Terminated Message Sequence Number is assigned by the GSS when forwarding a message to the ISU',
        'length in bytes of the mobile terminated SBD message received from the GSS, mt_length',
        'MT queued is a count of mobile terminated SBD messages waiting at the GSS to be transferred to the ISU (modem), mt_length',
        'cmd_queue', 'Failed transaction (%)'
    ]

    if not Data.iridium_status:
        L = No_Data_Found_plots(Title)
        Red_line = True

    else:
        fig0 = Binary_plot(Data.iridium_status['is_iridium_link_ok'],
                           Title[0],
                           default_value=True)
        fig1 = normal_plot(Data.iridium_status['signal_strength'], Title[1])
        fig2 = normal_plot(Data.iridium_status['registration_status'],
                           Title[2],
                           y_axis={
                               "detached": 0,
                               "not registered": 1,
                               "registered": 2,
                               "registration denied": 3
                           })
        fig3 = normal_plot(Data.iridium_status['mo_status_code'], Title[3])
        fig4 = normal_plot(Data.iridium_status['last_mo_msg_sequence_number'],
                           Title[4])
        fig5 = normal_plot(Data.iridium_status['mt_status_code'], Title[5])
        fig6 = normal_plot(Data.iridium_status['mt_msg_sequence_number'],
                           Title[6])
        fig7 = normal_plot(Data.iridium_status['mt_length'], Title[7])
        fig8 = normal_plot(Data.iridium_status['gss_queued_msgs'], Title[8])
        fig9 = normal_plot(Data.iridium_status['cmd_queue'], Title[9])
        fig10 = normal_plot(Data.iridium_status['failed_transaction_percent'],
                            Title[10])

        L = [fig0, fig1, fig2, fig3, fig4, fig5, fig6, fig7, fig8, fig9, fig10]
        Red_line = False

    # Fig = merge_plots(L,'Iridium Status',red_line = Red_line)
    # plotly.offline.plot(Fig, filename = Data.ihm_path + '/iridium/Bilan_iridium_status3000.html', auto_open=False)

    IHM.html_page_creation(Data, 'Iridium Status', L,
                           '/iridium/Bilan_iridium_status3000.html')
Ejemplo n.º 6
0
def plot_diagnostics(Data):

    L = []
    Diags = Data.diagnostics

    for k in list(Diags.keys()):

        L.append(normal_plot(Data.diagnostics[k], k))

    # Fig = merge_plots(L,'Diagnostics Data',Height = 200)
    # plotly.offline.plot(Fig, filename = Data.ihm_path + '/diagnostics/Bilan_diagnostics3000.html', auto_open=False)

    IHM.html_page_creation(Data, 'Diagnostics Data', L,
                           '/diagnostics/Bilan_diagnostics3000.html')
Ejemplo n.º 7
0
def main():
    listColumns = []
    with open('panorama-des-festivals.csv', encoding="utf8") as csv_file:
        csv_reader = csv.DictReader(csv_file, delimiter=';')
        for row in csv_reader:
            listColumns.append(Manifestation(row['Nom de la manifestation'],
                                             row['Code postal'],
                                             row['Site web'],
                                             row['Commune principale'],
                                             [
                                                 row['Date de début'],
                                                 row['Date de fin']
                                             ],
                                             Domaines(row['Domaine'],
                                                      row['Complément domaine'])))
        csv_file.close()
    root = Tk()
    window = IHM(listColumns, root)
    window.init_window()
Ejemplo n.º 8
0
def plot_phins(Data):

    Title = ['Heading (deg)', 'Pitch (deg)', 'Roll (deg)']

    if not Data.phins:
        L = No_Data_Found_plots(Title)
        Red_line = True

    else:
        fig0 = normal_plot(Data.phins['headingDeg'], Title[0])
        fig1 = normal_plot(Data.phins['pitchDeg'], Title[1])
        fig2 = normal_plot(Data.phins['rollDeg'], Title[2])

        L = [fig0, fig1, fig2]
        Red_line = False

    Fig = merge_plots(L, 'Phins Data', Height=350, red_line=Red_line)

    # Fig.update_layout(hovermode='y unified')
    # plotly.offline.plot(Fig, filename = Data.ihm_path + '/phins/Bilan_phins3000.html', auto_open=False)

    IHM.html_phins(Data, 'Drix status', L, '/phins/Bilan_phins3000.html')
Ejemplo n.º 9
0
def plot_rc_command(Data):

    Title = ['Reception Mode']

    if not Data.rc_command:
        L = No_Data_Found_plots(Title)
        Fig = L[0]

    else:
        Fig = normal_plot(Data.rc_command['reception_mode'],
                          Title[0],
                          y_axis={
                              "UNKNOWN": 0,
                              "HF": 1,
                              "WIFI": 2,
                              "WIFI_VIRTUAL": 3
                          })

    # plotly.offline.plot(Fig, filename = Data.ihm_path + '/rc_command/Bilan_rc_command3000.html', auto_open=False)

    IHM.html_page_creation(Data, 'RC Command', [Fig],
                           '/rc_command/Bilan_rc_command3000.html')
            df = df.assign(Time=list_t)

        return (df)


if __name__ == '__main__':

    date_d = "01-02-2021-09-00-00"
    date_f = "01-02-2021-15-00-00"

    path_zip = '../../data.tar.xz'

    Data = recup_data(path_zip, date_d, date_f)

    IHM.generate_ihm3000(Data)

    print("Done")

# embedable_chart = plotly.offline.plot(fig, include_plotlyjs=False, output_type='div')

# self.gps_encoder = ['dist', 'gps', 'speed']
# self.autopilot_encoder = ['ActiveSpeed', 'Delta', 'Regime', 'Speed', 'speed_autopilot', 'yawRate']
# self.drix_status_encoder = ['emergency_mode', 'drix_mode', 'reboot_requested', 'drix_clutch', 'remoteControlLost', 'gasolineLevel_percent', 'keel_state', 'rudderAngle_deg', 'thruster_RPM', 'shutdown_requested']
# self.gpu_state_encoder = ['total_mem_GB', 'power_consumption_W', 'gpu_utilization_percent', 'mem_utilization_percent', 'temperature_deg_c']
# self.iridium_encoder = ['is_iridium_link_ok', 'mt_length', 'cmd_queue', 'mt_status_code', 'signal_strength', 'last_mo_msg_sequence_number', 'gss_queued_msgs', 'failed_transaction_percent', 'mo_status_code', 'mt_msg_sequence_number', 'registration_status']
# self.phins_encoder = ['phins']
# self.rc_command_encoder = ['reception_mode']
# self.telemetry_encoder = ['engineon_hours_h', 'current_backup_battery_A', 'is_fans_on', 'is_oil_pressure_alarm_on', 'electronics_water_ingress', 'consumed_current_backup_battery_Ah', 'is_foghorn_on', 'backup_battery_voltage_V', 'is_water_in_fuel_on', 'electronics_fire_on_board', 'engine_battery_voltage_V', 'engine_water_ingress', 'percent_main_battery', 'time_left_main_battery_mins', 'is_navigation_lights_on',
# 'engine_temperature_deg', 'percent_backup_battery', 'main_battery_voltage_V', 'time_left_backup_battery_mins', 'is_drix_started', 'electronics_temperature_deg', 'electronics_hygrometry_percent', 'current_main_battery_A', 'engine_hygrometry_percent', 'engine_water_temperature_deg', 'consumed_current_main_battery_Ah', 'engine_fire_on_board', 'is_water_temperature_alarm_on', 'oil_pressure_Bar']
# self.trimmer_status_encoder = ['power_consumption_A', 'relative_humidity_percent', 'motor_temperature_degC', 'pcb_temperature_degC']
Ejemplo n.º 11
0
import csv
from IHM import *


interface = IHM(Tk())
interface.mainloop()
interface.destroy()
Ejemplo n.º 12
0
import pygame, sys
import model
import IHM
#======================================================================
pygame.init()

pygame.display.set_caption("My Connect-4 Game!")

platoJeu = model.Plateau(2)  #Data of the Game

gameState = 0
closeGame = False
while not closeGame:
    IHM.showScreen(
        platoJeu,
        gameState)  #Blit the elements on screen (depending on the state)
    #===================== EVENT Loop ===================================
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            closeGame = True
        elif event.type == pygame.MOUSEBUTTONDOWN:
            #==== State 0 : Title Screen
            if gameState == 0:
                if IHM.CheckRectCollide(platoJeu, gameState, "play"):
                    gameState = 1  #Capacities Screen
                elif IHM.CheckRectCollide(platoJeu, gameState, "stop"):
                    closeGame = True  #Exit the While Loop
            #==== State 1 : Select the capacities
            elif gameState == 1:
                if IHM.CheckRectCollide(platoJeu, gameState, "capInvLine"):
                    platoJeu.ChangeCap("capInvLine")
Ejemplo n.º 13
0
def plot_telemetry(Data):

    Title = [
        'Drix is started', 'Navigation lights', 'Foghorn', "Fans",
        'Water temperature alarm', 'Oil pressure alarm', 'Water in fuel',
        'Electronics water ingress', 'Electronics fire on board',
        'Engine Water Ingress', 'Engine fire on board', 'Oil Pressure (Bar)',
        'Engine water temperature (deg)', 'Engine on hours',
        'Main battery voltage (V)', 'Backup battery voltage (V)',
        'Engine Battery Voltage (V)', 'Main battery (%)', 'Backup battery (%)',
        'Consumed current main battery (Ah)',
        'Consumed current backup battery (Ah)', 'Current Main Battery (A)',
        'Current Backup Battery (A)', 'Time Left Main Battery (mins)',
        'Time Left Backup Battery (mins)', 'Electronics Temperature (deg)',
        'Electronics Hygrometry (%)', 'Electronics Hygrometry (%)',
        'Engine Hygrometry (%)'
    ]

    if not Data.telemetry:
        L = No_Data_Found_plots(Title)
        Red_line = True

    else:
        print('-------------------')
        print("Data.telemetry : ", Data.telemetry.keys())
        print('-------------------')

        fig0 = Binary_plot(Data.telemetry['is_drix_started'],
                           Title[0],
                           default_value=True)
        fig1 = Binary_plot(Data.telemetry['is_navigation_lights_on'],
                           Title[1],
                           default_value=False)
        fig2 = Binary_plot(Data.telemetry['is_foghorn_on'],
                           Title[2],
                           default_value=False)
        fig3 = Binary_plot(Data.telemetry['is_fans_on'],
                           Title[3],
                           default_value=True)
        fig4 = Binary_plot(Data.telemetry['is_water_temperature_alarm_on'],
                           Title[4],
                           default_value=False)
        fig5 = Binary_plot(Data.telemetry['is_oil_pressure_alarm_on'],
                           Title[5],
                           default_value=False)
        fig6 = Binary_plot(Data.telemetry['is_water_in_fuel_on'],
                           Title[6],
                           default_value=False)
        fig7 = Binary_plot(Data.telemetry['electronics_water_ingress'],
                           Title[7],
                           default_value=False)
        fig8 = Binary_plot(Data.telemetry['electronics_fire_on_board'],
                           Title[8],
                           default_value=False)
        fig9 = Binary_plot(Data.telemetry['engine_water_ingress'],
                           Title[9],
                           default_value=False)
        fig10 = Binary_plot(Data.telemetry['engine_fire_on_board'],
                            Title[10],
                            default_value=False)

        fig11 = normal_plot(Data.telemetry['oil_pressure_Bar'], Title[11])
        fig12 = normal_plot(Data.telemetry['engine_water_temperature_deg'],
                            Title[12])
        fig13 = normal_plot(Data.telemetry['engineon_hours_h'], Title[13])
        fig14 = normal_plot(Data.telemetry['main_battery_voltage_V'],
                            Title[14])
        fig15 = normal_plot(Data.telemetry['backup_battery_voltage_V'],
                            Title[15])
        fig16 = normal_plot(Data.telemetry['engine_battery_voltage_V'],
                            Title[16])
        fig17 = normal_plot(Data.telemetry['percent_main_battery'], Title[17])
        fig18 = normal_plot(Data.telemetry['percent_backup_battery'],
                            Title[18])

        fig19 = normal_plot(Data.telemetry['consumed_current_main_battery_Ah'],
                            Title[19])
        fig20 = normal_plot(
            Data.telemetry['consumed_current_backup_battery_Ah'], Title[20])
        fig21 = normal_plot(Data.telemetry['current_main_battery_A'],
                            Title[21])
        fig22 = normal_plot(Data.telemetry['current_backup_battery_A'],
                            Title[22])
        fig23 = normal_plot(Data.telemetry['time_left_main_battery_mins'],
                            Title[23])
        fig24 = normal_plot(Data.telemetry['time_left_backup_battery_mins'],
                            Title[24])
        fig25 = normal_plot(Data.telemetry['electronics_temperature_deg'],
                            Title[25])
        fig26 = normal_plot(Data.telemetry['electronics_hygrometry_percent'],
                            Title[26])
        fig27 = normal_plot(Data.telemetry['engine_temperature_deg'],
                            Title[27])
        fig28 = normal_plot(Data.telemetry['engine_hygrometry_percent'],
                            Title[28])

        L = [
            fig0, fig1, fig2, fig3, fig4, fig5, fig6, fig7, fig8, fig9, fig10,
            fig11, fig12, fig13, fig14, fig15, fig16, fig17, fig18, fig19,
            fig20, fig21, fig22, fig23, fig24, fig25, fig26, fig27, fig28
        ]
        Red_line = False

    # Fig = merge_plots(L,'Telemetry Data', red_line = Red_line)
    # plotly.offline.plot(Fig, filename = Data.ihm_path + '/telemetry/Bilan_telemetry3000.html', auto_open=False)

    IHM.html_page_creation(Data, 'Telemetry', L,
                           '/telemetry/Bilan_telemetry3000.html')
Ejemplo n.º 14
0
def nouvelle_partie():
    ''' Cette fonction renvoie une grille vide et le joueur de départ.
        Elle déclenche aussi l'affichage du plateau vide sur l'IHM.    '''
    IHM.affichage_plateau_vide()
    return [[0] * 7 for _ in range(6)], 1
Ejemplo n.º 15
0

def placement_pion(grille, joueur, num_ligne, num_colonne):
    ''' Cette fonction place le pion du joueur passé en paramètre dans la
        case dont le numéro de ligne et de colonne sont eux aussi passés en
        paramètre. La gravité et l'affichage de la grille dans la console sont
        appliqués si le module gravite a été complété.  '''
    cl = case_libre_la_plus_basse(grille, num_colonne)
    if cl is not None: num_ligne, num_colonne = cl
    grille[num_ligne][num_colonne] = joueur
    affichage_console(grille)
    IHM.collage_du_pion(joueur, num_ligne, num_colonne)


# On affiche la fenêtre d'interface graphique du jeu
IHM.chargement_jeu()
continuer_jeu = True
# On démarre une nouvelle partie
grille, joueur = nouvelle_partie()
# Tant que le jeu continue ...
while continuer_jeu == True:
    # Pour chaque évènement, sur la fenêtre d'interface graphiqe
    for event in IHM.pygame.event.get():
        # Si cet évènement est un clic sur la croix rouge, on stoppe le jeu
        if event.type == IHM.pygame.locals.QUIT:
            continuer_jeu = False
        # Si cet évènement est un clic gauche, on vérifie la zone cliquée
        if event.type == IHM.pygame.locals.MOUSEBUTTONDOWN and event.button == 1:
            pion_x, pion_y = event.pos[0], event.pos[1]
            # Si la zone cliquée est "Nouvelle partie", on démarre une partie partie
            if 0 <= pion_x <= 349 and 600 <= pion_y <= 700:
Ejemplo n.º 16
0
def main(stdscr):
	
	menu=menu_accueil

	#turn off cursor blinking
	curses.curs_set(0)

	#color scheme for selected row
	curses.init_pair(1,curses.COLOR_BLACK, curses.COLOR_WHITE)

	#specify the current selected row
	current_row = 0

	#print the menu
	IHM.print_menu(stdscr, current_row, menu)
	

	#create_command_db()
	#check_command_db()
	#create_command_tb()
	#check_command_tb()



	while 1:
		key=stdscr.getch()

		# 	monte si la flèche du haut est pressée
		if key == curses.KEY_UP and current_row>0:
			current_row -= 1
		
		#	descend si la flèche du bas est pressée
		elif key == curses.KEY_DOWN and current_row < len(menu)-1:
			current_row +=1

		#	sort du menu si la touche echap est pressée
		elif key == 27:
			break

		#	valide le choix si la touche entrée est pressée
		elif key in [10,13]:
			stdscr.clear()
			stdscr.refresh()

			#Pour chaque appui sur un choix on lance la publication d'un msg à l'aide du python mqttperso.py
			if menu[current_row] == "Prise de commande (table1)":

				publish(ipsuperviseur, port, "Commande/Envoi", "table1", 2)

			elif menu[current_row] == "Prise de commande (table2)":

				publish(ipsuperviseur, port, "Commande/Envoi", "table2", 2)

			elif menu[current_row] == "Prise de commande (table3)":

				publish(ipsuperviseur, port, "Commande/Envoi", "table3", 2)

			elif menu[current_row] == "Prise de commande (bar)":

				publish(ipsuperviseur, port, "Commande/Envoi", "bar", 2)

			elif menu[current_row] == "Prise de commande (recharge)":

				publish(ipsuperviseur, port, "Commande/Envoi", "recharge", 2)
		
		IHM.print_menu(stdscr, current_row, menu)
Ejemplo n.º 17
0
def plot_gps(Data):

    dic_color = {
        'IdleBoot': 'blue',
        'Idle': 'cyan',
        'goto': 'magenta',
        'follow_me': "#636efa",
        'box-in': "#00cc96",
        "path_following": "#66AA00",
        "dds": "darkred",
        "gaps": "turquoise",
        "backseat": "blueviolet",
        "control_calibration": "teal",
        "auv_following": "seagreen",
        "hovering": "sienna",
        "auto_survey": "grey"
    }

    # - - - - - GNSS position graph - - - - - -

    df1 = Data.gps['gps']

    list_hover_data1 = [
        'time', 'action_type_str', 'list_dist_mship', 'list_dist',
        'fix_quality'
    ]
    title1 = "Gnss positions"

    fig1 = px.scatter(df1,
                      x='l_long',
                      y='l_lat',
                      hover_data=list_hover_data1,
                      color="action_type_str",
                      title=title1,
                      color_discrete_map=dic_color,
                      labels={
                          "l_long": "Longitude (rad)",
                          "l_lat": "Latitude (rad)",
                          "fix_quality": "GPS quality",
                          "action_type_str": "action type",
                          "list_dist_mship": "Dist Drix/ship",
                          'list_dist': 'Travelled distance',
                          'time': 'Time',
                          "color": 'Mission type'
                      })
    fig1.update_yaxes(scaleanchor="x", scaleratio=1)

    # - - - - - Distance travelled graph - - - - - -

    df2 = Data.gps['dist']

    title2 = 'Distance evolution'

    fig2 = px.line(df2,
                   x="Time",
                   y="y",
                   title=title2,
                   labels={
                       "y": "Travelled distance (km)",
                       'time': 'Time'
                   })
    fig2.update_layout(hovermode="y")

    # - - - - - Speed Bar chart - - - - - -

    df3 = Data.gps['speed']

    title3 = 'Speed history'

    fig3 = px.bar(df3,
                  y='y_speed',
                  x='list_index',
                  hover_data=['action_type_str', 'list_knots'],
                  color='action_type_str',
                  color_discrete_map=dic_color,
                  title=title3,
                  labels={
                      "y_speed": "Drix speed (m/s)",
                      "list_knots": "Drix speed (knot)",
                      "action_type_str": "Action type",
                      'list_index': 'Time'
                  })

    fig3.update_layout(xaxis=dict(
        tickmode='array', tickvals=df3['list_index'], ticktext=df3['time']))

    # - - - - - Mission Distance Bar graph - - - - - -

    title4 = 'Mission Distance history'

    fig4 = px.bar(df3,
                  y='y_dist',
                  x='list_index',
                  hover_data=['action_type_str', 'y_speed'],
                  color='action_type_str',
                  color_discrete_map=dic_color,
                  title=title4,
                  labels={
                      "y_dist": "Mission distance (kms)",
                      "y_speed": "Drix speed (m/s)",
                      "action_type_str": "Action type",
                      'list_index': 'Time'
                  })

    fig4.update_layout(xaxis=dict(
        tickmode='array', tickvals=df3['list_index'], ticktext=df3['time']))

    # - - - - - Distance Pie chart - - - - - -

    title5 = "Mission distance"

    df4 = Data.gps['pie_chart']

    fig5 = px.pie(df4,
                  values='L_dist',
                  names='Name',
                  color='Name',
                  color_discrete_map=dic_color,
                  title=title5,
                  labels={
                      "L_dist": "Mission distance (kms)",
                      "Name": "Action type"
                  })

    plotly.offline.plot(fig5,
                        filename=Data.ihm_path + '/gps/pie3000.html',
                        auto_open=False)

    # - - - - - Global Plot - - - - - -

    Fig = make_subplots(rows=4,
                        cols=1,
                        shared_xaxes=False,
                        subplot_titles=[title1, title2, title3, title4],
                        row_width=[0.8, 0.8, 0.8, 1.5])

    for f in fig1["data"]:
        Fig.add_trace(f, row=1, col=1)

    for f in fig2["data"]:
        Fig.add_trace(f, row=2, col=1)

    for f in fig3["data"]:
        Fig.add_trace(f, row=3, col=1)

    for f in fig4["data"]:
        Fig.add_trace(f, row=4, col=1)

    # - - - - -

    names = set()
    Fig.for_each_trace(lambda trace: trace.update(showlegend=False)
                       if (trace.name in names) else names.add(trace.name))

    # - - - - -

    Fig.update_layout(height=1400, width=1400, title_text="GPS Data")
    Fig.update_layout(legend_traceorder="reversed")
    Fig.update_layout(showlegend=True)
    Fig.layout.legend.itemsizing = 'constant'

    # - - -

    Fig.update_layout(yaxis1=dict(title="Latitude (rad)"))
    Fig.update_layout(xaxis1=dict(title="Longitude (rad)"))

    Fig.update_layout(yaxis2=dict(title="Travelled distance (km)"))
    Fig.update_layout(xaxis2=dict(title="Time"))

    Fig.update_layout(yaxis3=dict(title="Travelled distance (km)"))
    Fig.update_layout(xaxis3=dict(tickangle=45,
                                  tickmode='array',
                                  tickvals=df3['list_index'],
                                  ticktext=df3['time']),
                      uniformtext_minsize=8,
                      uniformtext_mode='hide',
                      title='Time')

    Fig.update_layout(yaxis4=dict(title="Drix speed (m/s)"))
    Fig.update_layout(xaxis4=dict(tickangle=45,
                                  tickmode='array',
                                  tickvals=df3['list_index'],
                                  ticktext=df3['time']),
                      uniformtext_minsize=8,
                      uniformtext_mode='hide',
                      title='Time')

    # - - - - -

    # fig1.show()
    # fig2.show()
    # fig3.show()
    # fig4.show()
    # Fig.show()
    # fig5.show()

    # - - - - -

    # plotly.offline.plot(Fig, filename= Data.ihm_path + '/gps/Bilan_gps3000.html', auto_open=False)

    IHM.html_gps(Data, 'GPS Data', [Fig, fig5], '/gps/Bilan_gps3000.html')
Ejemplo n.º 18
0
            date_fin = data['fields'].get('date_de_fin', "")
            commune = data['fields'].get('commune_principale', "")
            domaine = data['fields'].get('domaine', "")
            manifestation = m.Manifestation(nom_manif, code_postal, site_web, date_debut, date_fin, commune, domaine)
            # On fais une liste des options pour les comboBox
            if(not domaine in liste_domaines):
                liste_domaines.append(domaine)
            if(not commune in liste_communes):
                liste_communes.append(commune)
            if(not date_debut in liste_date_debut):
                liste_date_debut.append(date_debut)
            if(not date_fin in liste_date_fin):
                liste_date_fin.append(date_fin)
            liste.append(manifestation)
    
    racine = tk.Tk()
    racine.title("Projet Arnaud Lieveaux")
	
    # On tri les liste
    liste_domaines.sort()
    liste_communes.sort()
    liste_date_debut.sort()
    liste_date_fin.sort()
    # On ajoute une option pour le retour en arrière d'un choix
    liste_domaines.insert(0, "Aucun")
    liste_communes.insert(0, "Aucune")
    liste_date_debut.insert(0, "Aucune")
    liste_date_fin.insert(0, "Aucune")
    
    app = ihm.IHM(liste, liste_domaines, liste_communes, liste_date_debut, liste_date_fin, racine)
    racine.mainloop()
Ejemplo n.º 19
0
def plot_drix_status(Data):

    Title = [
        'Thruster RPM', 'rudderAngle_deg', 'Gasoline Level (%)',
        'Emergency mode', 'Remote Control Lost RPM', 'Shutdown requested',
        'Reboot requested', 'Drix Mode', 'Drix Clutch', 'Keel state'
    ]

    if not Data.drix_status:
        L = No_Data_Found_plots(Title)
        Red_line = True

    else:

        fig0 = normal_plot(Data.drix_status['thruster_RPM'], Title[0])
        fig1 = normal_plot(Data.drix_status['rudderAngle_deg'], Title[1])
        fig2 = normal_plot(Data.drix_status['gasolineLevel_percent'], Title[2])

        fig3 = Binary_plot(Data.drix_status['emergency_mode'],
                           Title[3],
                           default_value=False)
        fig4 = Binary_plot(Data.drix_status['remoteControlLost'],
                           Title[4],
                           default_value=False)
        fig5 = Binary_plot(Data.drix_status['shutdown_requested'],
                           Title[5],
                           default_value=False)
        fig6 = Binary_plot(Data.drix_status['reboot_requested'],
                           Title[6],
                           default_value=False)

        fig7 = normal_plot(Data.drix_status['drix_mode'],
                           Title[7],
                           y_axis={
                               "DOCKING": 0,
                               "MANUAL": 1,
                               "AUTO": 2
                           })
        fig8 = normal_plot(Data.drix_status['drix_clutch'],
                           Title[8],
                           y_axis={
                               "FORWARD": 0,
                               "NEUTRAL": 1,
                               "BACKWARD": 2,
                               "ERROR": 4
                           })
        fig9 = normal_plot(Data.drix_status['keel_state'],
                           Title[9],
                           y_axis={
                               "DOWN": 0,
                               "MIDDLE": 1,
                               "UP": 2,
                               "ERROR": 4,
                               "GOING UP ERROR": 5,
                               "GOING DOWN ERROR": 6,
                               "UP AND DOWN ERROR": 7
                           })

        L = [fig0, fig1, fig2, fig3, fig4, fig5, fig6, fig7, fig8, fig9]
        Red_line = False

    IHM.html_page_creation(Data, 'Drix status', L,
                           '/drix_status/Bilan_drix_status3000.html')