Created
April 17, 2022 17:10
-
-
Save nikitamounier/222351993a169a8ef86bc51673f5e1e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "Code_Weight.ipynb", | |
"provenance": [], | |
"collapsed_sections": [] | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"# Rocket motors: importing the files" | |
], | |
"metadata": { | |
"id": "4kBHLpDHnrRn" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"import csv \n", | |
"with open(\"RocketPy_Motors.csv\", \"r\") as rfile:\n", | |
" fdict = list(csv.DictReader(rfile, delimiter = \",\"))" | |
], | |
"metadata": { | |
"id": "6GKHfnI3SbYw" | |
}, | |
"execution_count": 5, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"#mise en evidence des cles\n", | |
"\n", | |
"cles = []\n", | |
"for val in fdict[0].keys():\n", | |
" cles.append(val)\n", | |
"\n", | |
"print(f\"Il y a {len(cles)} cles disponibles.\")\n", | |
"\n", | |
"for i in range(len(cles)):\n", | |
" print(f\"La clé numéro {i+1} est '{cles[i]}'\")\n" | |
], | |
"metadata": { | |
"id": "0P4LZW9wWWOa", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "f9119141-145b-4a86-ca0d-5d65b71c6b43" | |
}, | |
"execution_count": 6, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Il y a 22 cles disponibles.\n", | |
"La clé numéro 1 est 'Manufacturer'\n", | |
"La clé numéro 2 est 'CAR Designation'\n", | |
"La clé numéro 3 est 'Common Name'\n", | |
"La clé numéro 4 est 'Motor Type'\n", | |
"La clé numéro 5 est 'Diameter'\n", | |
"La clé numéro 6 est 'Length'\n", | |
"La clé numéro 7 est 'Total Weight'\n", | |
"La clé numéro 8 est 'Prop. Weight'\n", | |
"La clé numéro 9 est 'Avg. Thrust'\n", | |
"La clé numéro 10 est 'Initial Thrust'\n", | |
"La clé numéro 11 est 'Max. Thrust'\n", | |
"La clé numéro 12 est 'Total Impulse'\n", | |
"La clé numéro 13 est 'Burn Time'\n", | |
"La clé numéro 14 est 'Isp'\n", | |
"La clé numéro 15 est 'Motor Case'\n", | |
"La clé numéro 16 est 'Propellant'\n", | |
"La clé numéro 17 est 'Cert. Org.'\n", | |
"La clé numéro 18 est 'Cert. Date'\n", | |
"La clé numéro 19 est 'Cert. Designation'\n", | |
"La clé numéro 20 est 'Availability'\n", | |
"La clé numéro 21 est 'HazMat Shipping'\n", | |
"La clé numéro 22 est 'CSFM Approved'\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"# Rocket motors: weight and impulsion\n" | |
], | |
"metadata": { | |
"id": "ACp7nSHFRfQ9" | |
} | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"---\n", | |
"Commençons a trier nos moteurs par ceux qui sont le plus écologiques... Comme par exemple, ceux qui sont **hybrides**.\n", | |
"\n", | |
"---" | |
], | |
"metadata": { | |
"id": "muAV4mAhihKk" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"fhybrid = [fusee[\"Common Name\"] for fusee in fdict if fusee[\"Motor Type\"] == \"hybrid\"]\n", | |
"print(fhybrid)" | |
], | |
"metadata": { | |
"id": "BssrCtakHPwm", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "3c6a853d-43ff-4b42-e620-6e6e9bf40204" | |
}, | |
"execution_count": 7, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"['J115']\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"---\n", | |
"Le poids est un aspect important de la performance mais aussi du coût monétaire et environnemental de la fusée. Cherchons donc les moteurs avec le **plus petit poids**.\n", | |
"\n", | |
"---" | |
], | |
"metadata": { | |
"id": "EvjEgNaeiZSp" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"#creation d'un dictionnaire contenant les poids des moteurs. on utilise le nom fusee pour designer les moteurs dans le code\n", | |
"fpoids = [{\"Common Name\": fusee[\"Common Name\"], \"Total Weight\": fusee[\"Total Weight\"]} for fusee in fdict]\n", | |
"print(fpoids)" | |
], | |
"metadata": { | |
"id": "NQXZ5ME6JCUb", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "9a56b604-20f7-410f-abe2-c8dac760982d" | |
}, | |
"execution_count": 8, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"[{'Common Name': 'J360', 'Total Weight': '709 g'}, {'Common Name': 'M3100', 'Total Weight': '5,018 g'}, {'Common Name': 'M2505', 'Total Weight': '6,250 g'}, {'Common Name': 'M1670', 'Total Weight': '5231.00 g'}, {'Common Name': 'M1540', 'Total Weight': '5,906 g'}, {'Common Name': 'M1400', 'Total Weight': '5,302 g'}, {'Common Name': 'M1300', 'Total Weight': '5,657 g'}, {'Common Name': 'J115', 'Total Weight': '1,282 g'}]\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"\n", | |
"Maintenant que nous avons tous les poids des fusées, nous pouvons les classer par ordre décroissant a travers un tri par selection, par exemple. " | |
], | |
"metadata": { | |
"id": "o3qyS7Xy0uu0" | |
} | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"Tout d'abord, il nous faut transformer le poids, qui est sous forme de caracteres, en numéros, pour qu'on le puisse trier.\n" | |
], | |
"metadata": { | |
"id": "42i7Tr5v4pde" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"#Ce petit programme releve les codes ASCII des numéros, qu'on aura besoin pour notre fonction str_en_num\n", | |
"\n", | |
"Lnum = [str(num) for num in range(10)] #les codes ASCII ne marchent que pour des type string, d'ou la conversion en string du type des numéros\n", | |
"Lnum.append(\".\") #on rajoute le code ASCII du point pour que notre fonction inclut aussi les nombres décimaux\n", | |
"ord_num = []\n", | |
"\n", | |
"for num in Lnum:\n", | |
" print(f\"Le code ASCII associé au numero/symbole {num} est {ord(num)}\") \n", | |
" ord_num.append(ord(num)) \n", | |
"\n", | |
"\n", | |
"def str_en_num(mot):\n", | |
" \"\"\"prend en argument une chaîne de caracteres et renvoie l'équivalent numérique, en ne gardant que les chiffres et le point pour les nombre décimaux\"\"\"\n", | |
" mot2 = ''\n", | |
" for carac in mot:\n", | |
" if ord(carac) in ord_num: #teste si le caractere est soit un numéro, soit un point (utilisé pour les chiffres décimaux), en utilisant le format ASCII\n", | |
" mot2 += carac #si cela est le cas, alors on fusionne ce caractere a un mot ne contenant que les chiffres et symboles\n", | |
" return float(mot2) #on convertit ce mot en float a la fin du programme\n", | |
"\n", | |
"print(str_en_num(\"5.601! g\"))" | |
], | |
"metadata": { | |
"id": "kCx1u53ZvPoi", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "122c2adc-84db-49a0-8e90-54a424e8a4be" | |
}, | |
"execution_count": 9, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Le code ASCII associé au numero/symbole 0 est 48\n", | |
"Le code ASCII associé au numero/symbole 1 est 49\n", | |
"Le code ASCII associé au numero/symbole 2 est 50\n", | |
"Le code ASCII associé au numero/symbole 3 est 51\n", | |
"Le code ASCII associé au numero/symbole 4 est 52\n", | |
"Le code ASCII associé au numero/symbole 5 est 53\n", | |
"Le code ASCII associé au numero/symbole 6 est 54\n", | |
"Le code ASCII associé au numero/symbole 7 est 55\n", | |
"Le code ASCII associé au numero/symbole 8 est 56\n", | |
"Le code ASCII associé au numero/symbole 9 est 57\n", | |
"Le code ASCII associé au numero/symbole . est 46\n", | |
"5.601\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"\n", | |
"C'est fait!\n", | |
"Commençons a trier nos données..." | |
], | |
"metadata": { | |
"id": "Eq3PGOcU5HFU" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"def tri_selection(dico, cle):\n", | |
" \"\"\"trie un dictionnaire en fonction d'une clé demandée, sachant que cette derniere contient des valeurs numériques\"\"\"\n", | |
" for i in range(0,len(dico)):\n", | |
" imin = i\n", | |
" for j in range(i+1,len(dico)): #on commence a i pour augmenter en efficacité (a chaque tour le programme fera moins de comparaisons)\n", | |
" if str_en_num(dico[j][cle]) < str_en_num(dico[imin][cle]):\n", | |
" imin = j #on retrouve le minimum\n", | |
" dico.insert(i,dico[imin]) #on l'insere a la position i, c'est a dire a la fin de la partie triée\n", | |
" del dico[imin+1] #on enleve le double, qui se retoruve maintenant un indice plus vers la droie car on a rajouté un element au dico\n", | |
"\n", | |
" return dico" | |
], | |
"metadata": { | |
"id": "tRxrAKe909ky" | |
}, | |
"execution_count": 10, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"fpoids_sorted = tri_selection(fpoids, \"Total Weight\")\n", | |
"for dico in fpoids_sorted:\n", | |
" print(dico)" | |
], | |
"metadata": { | |
"id": "jVqqAVA_tNdr", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "c256dc38-2aa2-438b-d486-c03df2662e00" | |
}, | |
"execution_count": 11, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"{'Common Name': 'J360', 'Total Weight': '709 g'}\n", | |
"{'Common Name': 'J115', 'Total Weight': '1,282 g'}\n", | |
"{'Common Name': 'M3100', 'Total Weight': '5,018 g'}\n", | |
"{'Common Name': 'M1670', 'Total Weight': '5231.00 g'}\n", | |
"{'Common Name': 'M1400', 'Total Weight': '5,302 g'}\n", | |
"{'Common Name': 'M1300', 'Total Weight': '5,657 g'}\n", | |
"{'Common Name': 'M1540', 'Total Weight': '5,906 g'}\n", | |
"{'Common Name': 'M2505', 'Total Weight': '6,250 g'}\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"print(f\"Le moteur le plus lourd est le moteur {fpoids_sorted[-1]['Common Name']}, avec un poids total de {fpoids_sorted[-1]['Total Weight']}.\")\n", | |
"print(f\"D'autre part, les deux moteurs les plus lourds sont: le moteur {fpoids_sorted[0]['Common Name']}, avec un poids total de {fpoids_sorted[0]['Total Weight']}\")\n", | |
"print(f\"Enfin, le poids du moteur hybride {fhybrid[0]} vaut {fpoids_sorted[1]['Total Weight']}.\")" | |
], | |
"metadata": { | |
"id": "k6St6XWnG0ok", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "606f2bb0-632f-4b56-d054-5d70fe887e8d" | |
}, | |
"execution_count": 12, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Le moteur le plus lourd est le moteur M2505, avec un poids total de 6,250 g.\n", | |
"D'autre part, les deux moteurs les plus lourds sont: le moteur J360, avec un poids total de 709 g\n", | |
"Enfin, le poids du moteur hybride J115 vaut 1,282 g.\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"---\n", | |
"Ainsi, jusqu'a present, nous pouvons remarquer deux moteurs de fusées differents qui sont soit tres, soit tres peu ecologiques:\n", | |
"\n", | |
"* Le moteur J115, hybride et tres leger\n", | |
"* Le moteur M2505, le plus lourd de tous\n", | |
"\n", | |
"---" | |
], | |
"metadata": { | |
"id": "nQKYwoZIqmyZ" | |
} | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"---\n", | |
"Intéressons nous maintenant a la **projection totale du moteur**\n", | |
"\n", | |
"---" | |
], | |
"metadata": { | |
"id": "y9h_kmmHtXlR" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"fimpulse = [{\"Common Name\": fusee[\"Common Name\"], \"Total Impulse\": fusee[\"Total Impulse\"]} for fusee in fdict]\n", | |
"print(fimpulse)\n" | |
], | |
"metadata": { | |
"id": "LZqVVPEMqKGY", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "f9692224-2c68-4728-cfad-902e716c1b19" | |
}, | |
"execution_count": 13, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"[{'Common Name': 'J360', 'Total Impulse': '826.0 Ns'}, {'Common Name': 'M3100', 'Total Impulse': '6,117.8 Ns'}, {'Common Name': 'M2505', 'Total Impulse': '7,450.0 Ns'}, {'Common Name': 'M1670', 'Total Impulse': '6041.70 Ns'}, {'Common Name': 'M1540', 'Total Impulse': '6,819.4 Ns'}, {'Common Name': 'M1400', 'Total Impulse': '6,251.0 Ns'}, {'Common Name': 'M1300', 'Total Impulse': '6,738.2 Ns'}, {'Common Name': 'J115', 'Total Impulse': '673.7 Ns'}]\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"fimpulse_sorted = tri_selection(fimpulse, \"Total Impulse\")\n", | |
"for dico in fimpulse_sorted:\n", | |
" print(dico)" | |
], | |
"metadata": { | |
"id": "C7GvEItSqU5X", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "586b6ab8-e163-4d48-98c0-f748477a8c24" | |
}, | |
"execution_count": 14, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"{'Common Name': 'J115', 'Total Impulse': '673.7 Ns'}\n", | |
"{'Common Name': 'J360', 'Total Impulse': '826.0 Ns'}\n", | |
"{'Common Name': 'M1670', 'Total Impulse': '6041.70 Ns'}\n", | |
"{'Common Name': 'M3100', 'Total Impulse': '6,117.8 Ns'}\n", | |
"{'Common Name': 'M1400', 'Total Impulse': '6,251.0 Ns'}\n", | |
"{'Common Name': 'M1300', 'Total Impulse': '6,738.2 Ns'}\n", | |
"{'Common Name': 'M1540', 'Total Impulse': '6,819.4 Ns'}\n", | |
"{'Common Name': 'M2505', 'Total Impulse': '7,450.0 Ns'}\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"---\n", | |
"Nous pouvons remarquer que les moteurs avec la plus grande propulsion sont aussi ceux avec la plus grande masse. Il serait donc intéressant de représenter l'impulsion totale d'un moteur en fonction de son poids!\n", | |
"\n", | |
"---" | |
], | |
"metadata": { | |
"id": "rxoFsjN2trek" | |
} | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"Tout d'abord, il nous faut que les valeurs du poids soient triées, et que celles de l'impulsion correspondent au même moteur. " | |
], | |
"metadata": { | |
"id": "NkP0h0OPGJPX" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"p_i_moteur = [{\"Common Name\": fuseepoids[\"Common Name\"], \"Total Weight\": fuseepoids[\"Total Weight\"], \"Total Impulse\": fuseeimpulse[\"Total Impulse\"]}\n", | |
" for fuseepoids in fpoids_sorted for fuseeimpulse in fimpulse if fuseepoids[\"Common Name\"] == fuseeimpulse[\"Common Name\"]]\n", | |
"#on cree un dictionnaire contenant les moteurs triés par l'ordre croissant du poids et contenant aussi l'impulsion totale respective a chaque moteur\n", | |
"\n", | |
"\n", | |
"print(p_i_moteur)" | |
], | |
"metadata": { | |
"id": "RqFDyI42ENDV", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "1092904b-5b64-4f0f-c3fe-6b448e9d2df1" | |
}, | |
"execution_count": 15, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"[{'Common Name': 'J360', 'Total Weight': '709 g', 'Total Impulse': '826.0 Ns'}, {'Common Name': 'J115', 'Total Weight': '1,282 g', 'Total Impulse': '673.7 Ns'}, {'Common Name': 'M3100', 'Total Weight': '5,018 g', 'Total Impulse': '6,117.8 Ns'}, {'Common Name': 'M1670', 'Total Weight': '5231.00 g', 'Total Impulse': '6041.70 Ns'}, {'Common Name': 'M1400', 'Total Weight': '5,302 g', 'Total Impulse': '6,251.0 Ns'}, {'Common Name': 'M1300', 'Total Weight': '5,657 g', 'Total Impulse': '6,738.2 Ns'}, {'Common Name': 'M1540', 'Total Weight': '5,906 g', 'Total Impulse': '6,819.4 Ns'}, {'Common Name': 'M2505', 'Total Weight': '6,250 g', 'Total Impulse': '7,450.0 Ns'}]\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"Maintenant, nous pouvons representer le poids et l'impulsion de moteurs sans souci de valeurs. " | |
], | |
"metadata": { | |
"id": "ZHhCLzUtJja4" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"import plotly.express as px\n", | |
"\n", | |
"poidsmoteur = [str_en_num(fusee[\"Total Weight\"]) for fusee in p_i_moteur]\n", | |
"impulsionmoteur = [str_en_num(fusee[\"Total Impulse\"]) for fusee in p_i_moteur]\n", | |
"#création de listes contenant les valeurs du tableau\n", | |
"\n", | |
"\n", | |
"fig = px.line(x=poidsmoteur, y=impulsionmoteur, title = \"Impulsion totale d'un moteur en fonction de son poids\", width = 500)\n", | |
"fig.update_xaxes(title=\"Poids total du moteur (g)\")\n", | |
"fig.update_yaxes(title=\"Impulsion totale du moteur (N)\")\n", | |
"\n", | |
"fig.show()" | |
], | |
"metadata": { | |
"id": "QhcYlVp4DHle", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 542 | |
}, | |
"outputId": "a483904f-4190-4d91-8ccd-0c097d8f2d24" | |
}, | |
"execution_count": 16, | |
"outputs": [ | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"<html>\n", | |
"<head><meta charset=\"utf-8\" /></head>\n", | |
"<body>\n", | |
" <div> <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script> <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n", | |
" <script src=\"https://cdn.plot.ly/plotly-2.8.3.min.js\"></script> <div id=\"a76f5307-6b8c-439f-807f-d224b132f74a\" class=\"plotly-graph-div\" style=\"height:525px; width:500px;\"></div> <script type=\"text/javascript\"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"a76f5307-6b8c-439f-807f-d224b132f74a\")) { Plotly.newPlot( \"a76f5307-6b8c-439f-807f-d224b132f74a\", [{\"hovertemplate\":\"x=%{x}<br>y=%{y}<extra></extra>\",\"legendgroup\":\"\",\"line\":{\"color\":\"#636efa\",\"dash\":\"solid\"},\"marker\":{\"symbol\":\"circle\"},\"mode\":\"lines\",\"name\":\"\",\"orientation\":\"v\",\"showlegend\":false,\"x\":[709.0,1282.0,5018.0,5231.0,5302.0,5657.0,5906.0,6250.0],\"xaxis\":\"x\",\"y\":[826.0,673.7,6117.8,6041.7,6251.0,6738.2,6819.4,7450.0],\"yaxis\":\"y\",\"type\":\"scatter\"}], {\"template\":{\"data\":{\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattermapbox\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolar\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolargl\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"#EBF0F8\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"#C8D4E3\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"colorscale\":{\"diverging\":[[0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"colorway\":[\"#636efa\",\"#EF553B\",\"#00cc96\",\"#ab63fa\",\"#FFA15A\",\"#19d3f3\",\"#FF6692\",\"#B6E880\",\"#FF97FF\",\"#FECB52\"],\"font\":{\"color\":\"#2a3f5f\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"#E5ECF6\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"mapbox\":{\"style\":\"light\"},\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"#E5ECF6\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"line\":{\"color\":\"#2a3f5f\"}},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"title\":{\"x\":0.05},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2}}},\"xaxis\":{\"anchor\":\"y\",\"domain\":[0.0,1.0],\"title\":{\"text\":\"Poids total du moteur (g)\"}},\"yaxis\":{\"anchor\":\"x\",\"domain\":[0.0,1.0],\"title\":{\"text\":\"Impulsion totale du moteur (N)\"}},\"legend\":{\"tracegroupgap\":0},\"title\":{\"text\":\"Impulsion totale d'un moteur en fonction de son poids\"},\"width\":500}, {\"responsive\": true} ).then(function(){\n", | |
" \n", | |
"var gd = document.getElementById('a76f5307-6b8c-439f-807f-d224b132f74a');\n", | |
"var x = new MutationObserver(function (mutations, observer) {{\n", | |
" var display = window.getComputedStyle(gd).display;\n", | |
" if (!display || display === 'none') {{\n", | |
" console.log([gd, 'removed!']);\n", | |
" Plotly.purge(gd);\n", | |
" observer.disconnect();\n", | |
" }}\n", | |
"}});\n", | |
"\n", | |
"// Listen for the removal of the full notebook cells\n", | |
"var notebookContainer = gd.closest('#notebook-container');\n", | |
"if (notebookContainer) {{\n", | |
" x.observe(notebookContainer, {childList: true});\n", | |
"}}\n", | |
"\n", | |
"// Listen for the clearing of the current output cell\n", | |
"var outputEl = gd.closest('.output');\n", | |
"if (outputEl) {{\n", | |
" x.observe(outputEl, {childList: true});\n", | |
"}}\n", | |
"\n", | |
" }) }; </script> </div>\n", | |
"</body>\n", | |
"</html>" | |
] | |
}, | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"Representation alternative avec le module plotly, tres similaire a matplotlib.pyplot:" | |
], | |
"metadata": { | |
"id": "P7otS0MQJ-Tu" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"import plotly.express as px\n", | |
"\n", | |
"fig = px.line(x=poidsmoteur, y=impulsionmoteur, title=\"Impulsion totale d'un moteur en fonction de son poids\", width=500, )\n", | |
"fig.update_xaxes(title=\"Poids total du moteur en g\")\n", | |
"fig.update_yaxes(title=\"Impulsion totale du moteur en Ns\")\n", | |
"fig.show()" | |
], | |
"metadata": { | |
"id": "b79DmrjDJq0G", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 542 | |
}, | |
"outputId": "2a5936b1-b87f-4ac0-90ef-340fdf41bdd8" | |
}, | |
"execution_count": 17, | |
"outputs": [ | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"<html>\n", | |
"<head><meta charset=\"utf-8\" /></head>\n", | |
"<body>\n", | |
" <div> <script src=\"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG\"></script><script type=\"text/javascript\">if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}</script> <script type=\"text/javascript\">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>\n", | |
" <script src=\"https://cdn.plot.ly/plotly-2.8.3.min.js\"></script> <div id=\"6f324688-f7e1-46c9-877d-65d2ede43c20\" class=\"plotly-graph-div\" style=\"height:525px; width:500px;\"></div> <script type=\"text/javascript\"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"6f324688-f7e1-46c9-877d-65d2ede43c20\")) { Plotly.newPlot( \"6f324688-f7e1-46c9-877d-65d2ede43c20\", [{\"hovertemplate\":\"x=%{x}<br>y=%{y}<extra></extra>\",\"legendgroup\":\"\",\"line\":{\"color\":\"#636efa\",\"dash\":\"solid\"},\"marker\":{\"symbol\":\"circle\"},\"mode\":\"lines\",\"name\":\"\",\"orientation\":\"v\",\"showlegend\":false,\"x\":[709.0,1282.0,5018.0,5231.0,5302.0,5657.0,5906.0,6250.0],\"xaxis\":\"x\",\"y\":[826.0,673.7,6117.8,6041.7,6251.0,6738.2,6819.4,7450.0],\"yaxis\":\"y\",\"type\":\"scatter\"}], {\"template\":{\"data\":{\"bar\":[{\"error_x\":{\"color\":\"#2a3f5f\"},\"error_y\":{\"color\":\"#2a3f5f\"},\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"bar\"}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"#E5ECF6\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"barpolar\"}],\"carpet\":[{\"aaxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"baxis\":{\"endlinecolor\":\"#2a3f5f\",\"gridcolor\":\"white\",\"linecolor\":\"white\",\"minorgridcolor\":\"white\",\"startlinecolor\":\"#2a3f5f\"},\"type\":\"carpet\"}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"choropleth\"}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"contour\"}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"contourcarpet\"}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmap\"}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"heatmapgl\"}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"type\":\"histogram\"}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2d\"}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"histogram2dcontour\"}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"type\":\"mesh3d\"}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"parcoords\"}],\"pie\":[{\"automargin\":true,\"type\":\"pie\"}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter\"}],\"scatter3d\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatter3d\"}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattercarpet\"}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergeo\"}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattergl\"}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scattermapbox\"}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolar\"}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterpolargl\"}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"type\":\"scatterternary\"}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"type\":\"surface\"}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"#EBF0F8\"},\"line\":{\"color\":\"white\"}},\"header\":{\"fill\":{\"color\":\"#C8D4E3\"},\"line\":{\"color\":\"white\"}},\"type\":\"table\"}]},\"layout\":{\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"autotypenumbers\":\"strict\",\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0,\"ticks\":\"\"}},\"colorscale\":{\"diverging\":[[0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"colorway\":[\"#636efa\",\"#EF553B\",\"#00cc96\",\"#ab63fa\",\"#FFA15A\",\"#19d3f3\",\"#FF6692\",\"#B6E880\",\"#FF97FF\",\"#FECB52\"],\"font\":{\"color\":\"#2a3f5f\"},\"geo\":{\"bgcolor\":\"white\",\"lakecolor\":\"white\",\"landcolor\":\"#E5ECF6\",\"showlakes\":true,\"showland\":true,\"subunitcolor\":\"white\"},\"hoverlabel\":{\"align\":\"left\"},\"hovermode\":\"closest\",\"mapbox\":{\"style\":\"light\"},\"paper_bgcolor\":\"white\",\"plot_bgcolor\":\"#E5ECF6\",\"polar\":{\"angularaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"radialaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"yaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"},\"zaxis\":{\"backgroundcolor\":\"#E5ECF6\",\"gridcolor\":\"white\",\"gridwidth\":2,\"linecolor\":\"white\",\"showbackground\":true,\"ticks\":\"\",\"zerolinecolor\":\"white\"}},\"shapedefaults\":{\"line\":{\"color\":\"#2a3f5f\"}},\"ternary\":{\"aaxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"baxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"},\"bgcolor\":\"#E5ECF6\",\"caxis\":{\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\"}},\"title\":{\"x\":0.05},\"xaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2},\"yaxis\":{\"automargin\":true,\"gridcolor\":\"white\",\"linecolor\":\"white\",\"ticks\":\"\",\"title\":{\"standoff\":15},\"zerolinecolor\":\"white\",\"zerolinewidth\":2}}},\"xaxis\":{\"anchor\":\"y\",\"domain\":[0.0,1.0],\"title\":{\"text\":\"Poids total du moteur en g\"}},\"yaxis\":{\"anchor\":\"x\",\"domain\":[0.0,1.0],\"title\":{\"text\":\"Impulsion totale du moteur en Ns\"}},\"legend\":{\"tracegroupgap\":0},\"title\":{\"text\":\"Impulsion totale d'un moteur en fonction de son poids\"},\"width\":500}, {\"responsive\": true} ).then(function(){\n", | |
" \n", | |
"var gd = document.getElementById('6f324688-f7e1-46c9-877d-65d2ede43c20');\n", | |
"var x = new MutationObserver(function (mutations, observer) {{\n", | |
" var display = window.getComputedStyle(gd).display;\n", | |
" if (!display || display === 'none') {{\n", | |
" console.log([gd, 'removed!']);\n", | |
" Plotly.purge(gd);\n", | |
" observer.disconnect();\n", | |
" }}\n", | |
"}});\n", | |
"\n", | |
"// Listen for the removal of the full notebook cells\n", | |
"var notebookContainer = gd.closest('#notebook-container');\n", | |
"if (notebookContainer) {{\n", | |
" x.observe(notebookContainer, {childList: true});\n", | |
"}}\n", | |
"\n", | |
"// Listen for the clearing of the current output cell\n", | |
"var outputEl = gd.closest('.output');\n", | |
"if (outputEl) {{\n", | |
" x.observe(outputEl, {childList: true});\n", | |
"}}\n", | |
"\n", | |
" }) }; </script> </div>\n", | |
"</body>\n", | |
"</html>" | |
] | |
}, | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"Comme nous le voyons, le poids et la propulsion son presque proportionnels; il est donc plus difficile d'obtenir des moteurs plus écologiques et moins coûteux qui soient tout de même efficaces en essayant de réduire le poids. Intéressons-nous a la fusée qui, avec le poids le plus petit, aurait une impulsion maximale. " | |
], | |
"metadata": { | |
"id": "Ze50tY7MJKbr" | |
} | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"rapp_p_i = []\n", | |
"\n", | |
"#création d'un dictionnaire contenant les rapports des intensités par les poids\n", | |
"\n", | |
"for i in range(len(fdict)):\n", | |
" rapport = round(str_en_num(fdict[i][\"Total Impulse\"]) / str_en_num(fdict[i][\"Total Weight\"]), 5) #on divise l'impulsion par le poids; plus le rapport sera elevé, plus l'impulsion est grande pour un poids plus petit, et donc plus le moteur sera économique\n", | |
" dico = {\"Common Name\": fdict[i][\"Common Name\"], \"Rapport Impulsion-Poids\": rapport}\n", | |
" rapp_p_i.append(dico)\n" | |
], | |
"metadata": { | |
"id": "CNe6Nc5cduSM" | |
}, | |
"execution_count": 18, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"#manipulation des donnés\n", | |
"rmax = 0\n", | |
"moteurmax = \"\"\n", | |
"rmin = rapp_p_i[0][\"Rapport Impulsion-Poids\"]\n", | |
"moteurmin = \"\"\n", | |
"\n", | |
"for dico in rapp_p_i:\n", | |
" rapport = dico[\"Rapport Impulsion-Poids\"]\n", | |
" nom_moteur = dico[\"Common Name\"]\n", | |
" \n", | |
" if rapport > rmax : #recherche d'un maximum\n", | |
" rmax = rapport #on associe le nouveau maximum a notre variable\n", | |
" moteurmax = nom_moteur #on retient le nom du moteur avec la difference la plus grande\n", | |
" elif rapport == rmax:\n", | |
" moteurmax +=\", \"+nom_moteur #s'il y a plusieurs moteurs avec la même différence, alors on retient les deux\n", | |
" \n", | |
" if rapport < rmin : \n", | |
" rmin = rapport\n", | |
" moteurmin = nom_moteur\n", | |
" elif rapport == rmin: #s'il y a plusieurs moteurs avec la même différence, alors on retient les deux\n", | |
" if dico == rapp_p_i[0]: #or, comme on a choisi la premiere différence comme exemple, alors inévitablement cette églité sera vraie pour le premier moteur. \n", | |
" moteurmin = nom_moteur #il nous faut donc nous assurer que pour ce cas particulier, nous ne 'rajoutons' pas un moteur\n", | |
" continue \n", | |
" moteurmin +=\" \"+nom_moteur #ajout potentiel du deuxieme moteur avec la meme valeur du rapport\n", | |
"\n", | |
"\n", | |
"print(f\"Le moteur le plus écologique et efficace est le moteur {moteurmax}, avec un rapport entre son impulsion et son poids de {rmax}.\")\n", | |
"print(f\"Le moteur le moins écologique et efficace est le moteur {moteurmin}, avec une différence entre son impulsion et son poids de {rmin}.\")\n" | |
], | |
"metadata": { | |
"id": "37bIiYELJrWt", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "bd215ebe-98eb-4cb6-afd4-95e55e0c004c" | |
}, | |
"execution_count": 19, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Le moteur le plus écologique et efficace est le moteur M3100, avec un rapport entre son impulsion et son poids de 1.21917.\n", | |
"Le moteur le moins écologique et efficace est le moteur J115, avec une différence entre son impulsion et son poids de 0.52551.\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"for dico in fdict:\n", | |
" if dico[\"Common Name\"] == \"M3100\":\n", | |
" print(dico)" | |
], | |
"metadata": { | |
"id": "N5cgI3a3jxI3", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "ccd1ad6e-c8fa-4baa-d3da-5f69483d9e78" | |
}, | |
"execution_count": 20, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"OrderedDict([('Manufacturer', 'Cesaroni Technology'), ('CAR Designation', '6118M3100-P'), ('Common Name', 'M3100'), ('Motor Type', 'reload'), ('Diameter', '75 mm'), ('Length', '757 mm'), ('Total Weight', '5,018 g'), ('Prop. Weight', '2,903 g'), ('Avg. Thrust', '3,075.0 N'), ('Initial Thrust', '3,306.8 N'), ('Max. Thrust', '3,709.2 N'), ('Total Impulse', '6,117.8 Ns'), ('Burn Time', '2.0 s'), ('Isp', '215 s'), ('Motor Case', 'Pro75-5G'), ('Propellant', 'White Thunder'), ('Cert. Org.', 'CAR'), ('Cert. Date', 'October 24, 2009'), ('Cert. Designation', ''), ('Availability', 'regular'), ('HazMat Shipping', 'HazMat'), ('CSFM Approved', 'approved')])\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"source": [ | |
"Ainsi, nous pouvons retenir trois moteurs:\n", | |
"\n", | |
"* Le moteur **J115**; hybride et léger, il est donc le plus écologique et utlise un minimum de ressources naturelles. Or, avec le dernier code, on remarque qu'il est le moins performant; d'ici la difficulté de créer des moteurs moins dangereux pour l'environnement qui aillent le plus loin possible.\n", | |
"* Le moteur **M2505**; le plus lourd, mais comme on a remarqué que plus le moteur est lourd, plus son implusion est grande, il est le moteur le plus efficace de tous.\n", | |
"* Le moteur **M3100**, un entre-deux; même s'il n'est ni hybride ni léger, il a une impulsion maximale pour un poids minimal. Il est donc a la fois efficace et économe. \n" | |
], | |
"metadata": { | |
"id": "A54YUI5kkjcB" | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Manufacturer | CAR Designation | Common Name | Motor Type | Diameter | Length | Total Weight | Prop. Weight | Avg. Thrust | Initial Thrust | Max. Thrust | Total Impulse | Burn Time | Isp | Motor Case | Propellant | Cert. Org. | Cert. Date | Cert. Designation | Availability | HazMat Shipping | CSFM Approved | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Cesaroni Technology | J360 | J360 | reload | 38 mm | 419 mm | 709 g | 413 g | 360.0 N | 554.6 N | 828.0 N | 826.0 Ns | 1.9 s | 204 s | Pro38-6G | TRA | J435 (29%) | OOP | HazMat | ||||
Cesaroni Technology | 6118M3100-P | M3100 | reload | 75 mm | 757 mm | 5,018 g | 2,903 g | 3,075.0 N | 3,306.8 N | 3,709.2 N | 6,117.8 Ns | 2.0 s | 215 s | Pro75-5G | White Thunder | CAR | October 24, 2009 | regular | HazMat | approved | ||
Cesaroni Technology | 7450M2505-P | M2505 | reload | 98 mm | 579 mm | 6,250 g | 3,339 g | 2,491.0 N | 2,330.2 N | 2,952.6 N | 7,450.0 Ns | 3.0 s | Pro98-3G | White Thunder | CAR | May 9, 2002 | M2505-P | regular | HazMat | |||
Cesaroni Technology | 6026M1670-P | M1670 | reload | 75 mm | 757 mm | 5231.00 g | 2956.10 g | 1667.80 N (375.25 lb) | 2232.10 N | 6041.70 Ns | 3.63 s | 208.41 s | Blue Streak | CAR | HazMat | approved | ||||||
Cesaroni Technology | 6819M1540-P | M1540 | reload | 75 mm | 757 mm | 5,906 g | 3,624 g | 1,537.0 N | 1,945.6 N | 2,328.8 N | 6,819.4 Ns | 4.4 s | Pro75-5G | Imax | CAR | 6819-M1540-IM-P | regular | HazMat | approved | |||
Cesaroni Technology | 6251M1400-P | M1400 | reload | 75 mm | 757 mm | 5,302 g | 2,992 g | 1,398.0 N | 1,820.6N | 2,291.8N | 6,251.0 Ns | 4.5 s | 213 s | Pro75-5G | Classic | CAR | December 16, 2003 | M1400-P-U | regular | HazMat | approved | |
Cesaroni Technology | 6438M1300-P | M1300 | reload | 75 mm | 757 mm | 5,657 g | 3,437 g | 1,303.9 N | 2,492.9 N | 2,826.9 N | 6,738.2 Ns | 4.9 s | 191 s | Pro75-5G | Imax/Dual Thrust | CAR | 6438-M1300-IM/DT-P | regular | HazMat | approved | ||
Hypertek | 440CC076J-J115 | J115 | hybrid | 54 mm | 614 mm | 1,282 g | 416 g | 115.0 N | 201.2 N | 673.7 Ns | 5.9 s | TRA | regular | exempt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment