def avoirTempsDeSortieMoyen(config, nombre): resultats = [] for _ in range(nombre): afficheur = Afficheur() recuperation = RecuperationDeDonnees( config, temps_maximal=15, action_mise_a_jour_secondaire=afficheur.dessinerEspaceEtAttendre) recuperation.lancer() if resultats == []: resultats = recuperation.temps_de_sortie else: for k in range(len(recuperation.temps_de_sortie)): resultats[k] += recuperation.temps_de_sortie[k] for k in range(len(resultats)): resultats[k] /= nombre return resultats
def recupererMoyenne(configuration) : afficheur = Afficheur() recuperation = RecuperationDeDonnees( configuration, arreter_apres_temps=True, temps_maximal=15, action_mise_a_jour_secondaire=afficheur.dessinerEspaceEtAttendre) recuperation.lancer() traitement = TraitementDeDonnees(recuperation.temps_de_sortie) return traitement.avoirDebitMoyen()
def genererResultatDeNSimulation(configuration, n, temps_maximal_simulation=15): for _ in range(n): recuperation = RecuperationDeDonnees( configuration, arreter_apres_temps=True, temps_maximal=temps_maximal_simulation, arreter_apres_sortie=True) recuperation.lancer() yield recuperation
def avoirRecuperation(nom_configuration, mise_a_jour): configuration = convertirJsonPython(nom_configuration) return RecuperationDeDonnees(configuration, arreter_apres_temps=True, temps_maximal=15, action_mise_a_jour_secondaire=mise_a_jour)
from traitement import RecuperationDeDonnees from convertir_json_python import convertirJsonPython from Lagrange import avoirFonctionInterpolatriceParIntervalle, enleverValeursProches import matplotlib.pyplot as plt import numpy as np from affichage import Afficheur affichage = Afficheur() recuperation = RecuperationDeDonnees( convertirJsonPython('./configuration_MPSI2.json'), temps_maximal=10, action_mise_a_jour_secondaire=affichage.dessinerEspaceEtAttendre) recuperation.lancer() intermediaire_X = list(np.linspace(-10, 0, num=100)) + recuperation.temps_de_sortie intermediaire_Y = [0] * 100 + list( range(len(recuperation.temps_de_sortie) + 1)) nouveau_temps_sortie_X, nouveau_temps_sortie_Y = enleverValeursProches( intermediaire_X, intermediaire_Y, 0.05) fonction_interpolatrice = avoirFonctionInterpolatriceParIntervalle( nouveau_temps_sortie_X, nouveau_temps_sortie_Y, 10) print(fonction_interpolatrice(5)) X = np.linspace(0, recuperation.temps_de_sortie[-1], num=500) Y = list(map(fonction_interpolatrice, X))
import sys sys.path.append('..') from convertir_json_python import convertirJsonPython from traitement import RecuperationDeDonnees, TraitementDeDonnees from affichage import Afficheur from personne import Personne import test_point_suivre Personne.TEST_DIRECTION = test_point_suivre.TestGradientLargeurQuatreDirections afficheur = Afficheur(debug=False) configuration = convertirJsonPython('../FichiersConfiguration/MPSTAR.json') recuperation = RecuperationDeDonnees( configuration, arreter_apres_temps=True, temps_maximal=15, action_mise_a_jour_secondaire=afficheur.dessinerEspaceEtAttendre) recuperation.lancer()
import sys sys.path.append('..') from convertir_json_python import convertirJsonPython from traitement import RecuperationDeDonnees, TraitementDeDonnees from affichage import Afficheur configuration = convertirJsonPython( '../FichiersConfiguration/salle_efficacite.json') recuperation = RecuperationDeDonnees(configuration, arreter_apres_temps=False) recuperation.lancer()
import sys sys.path.append('..') from convertir_json_python import convertirJsonPython from traitement import RecuperationDeDonnees from affichage import afficherChampVectorielle import test_point_suivre from personne import Personne Personne.TEST_DIRECTION = test_point_suivre.TestChampVecteurQuatreDirections configuration = convertirJsonPython('../FichiersConfiguration/MPSTAR.json') recuperation = RecuperationDeDonnees(configuration, arreter_apres_temps=True, temps_maximal=15) premier_champ = next(iter(test_point_suivre.TestChampVecteur.champs.values())) afficherChampVectorielle(premier_champ)
import sys sys.path.append('..') from convertir_json_python import convertirJsonPython from traitement import RecuperationDeDonnees, TraitementDeDonnees from affichage import Afficheur, TraceurTrajectoire from base import EnsembleRappelleRenvoyantCommande afficheur = Afficheur() traceur_trajectoire = TraceurTrajectoire() mise_a_jour = EnsembleRappelleRenvoyantCommande() mise_a_jour.ajouter(afficheur.dessinerEspaceEtAttendre) mise_a_jour.ajouter(traceur_trajectoire.mettreAJourTrajectoires) configuration = convertirJsonPython( '../FichiersConfiguration/MPSTAR_trois_personne.json') recuperation = RecuperationDeDonnees(configuration, arreter_apres_temps=True, temps_maximal=15, action_mise_a_jour_secondaire=mise_a_jour) recuperation.lancer() traceur_trajectoire.afficherTrajectoires()