|
|
@ -5,7 +5,7 @@ def lancer(k, date, temp_moy, temp_ref, temp_num_jour): |
|
|
|
donnees_point = [date, temp_moy, temp_ref] |
|
|
|
print(k) |
|
|
|
print(donnees_point) |
|
|
|
print(temp_num_jour) |
|
|
|
#print(temp_num_jour) |
|
|
|
kPlusProches(k, donnees_point, temp_num_jour) |
|
|
|
#estBissextile(an) |
|
|
|
|
|
|
@ -32,18 +32,30 @@ def estBissextile(an): |
|
|
|
else: |
|
|
|
return False |
|
|
|
|
|
|
|
def kPlusProches(k, donnees_point, temp_num_jour): |
|
|
|
def kPlusProches(k,donnees_point,temp_num_jour): |
|
|
|
"""Fonction qui prend en paramètre un tuple correspondant au point à vérifier, |
|
|
|
une liste du jeu de données et la conso électrique. Renvoie une liste triée |
|
|
|
en fonction de la distance dont les éléments sont des tuples.""" |
|
|
|
voisins = [] |
|
|
|
|
|
|
|
if k > len(temp_num_jour): |
|
|
|
k = len(temp_num_jour) |
|
|
|
voisin=[] |
|
|
|
for j in range(k): |
|
|
|
voisin.append([None]) |
|
|
|
|
|
|
|
for i in range(len(temp_num_jour)): |
|
|
|
d = distance(temp_num_jour[i],donnees_point) |
|
|
|
voisins.append((d, i)) |
|
|
|
voisins.sort() |
|
|
|
return [voisins[i][1] for i in range(k)] |
|
|
|
MN = distance(temp_num_jour[i],donnees_point) |
|
|
|
for l in range(k): |
|
|
|
if voisin[l][1] == None or MN<voisin[l][4]: |
|
|
|
# print(voisin) |
|
|
|
# for m in range(k-l): |
|
|
|
# print(voisin) |
|
|
|
# a_placer = voisin[l] |
|
|
|
# print(voisin) |
|
|
|
# voisin[m][1] = [temp_num_jour[i][0], temp_num_jour[i][1], temp_num_jour[i][2], temp_num_jour[i][4], MN] |
|
|
|
# print(voisin) |
|
|
|
# voisin[m+1][1]= a_placer |
|
|
|
# return voisin |
|
|
|
|
|
|
|
def numeroJour(date): |
|
|
|
an_mois_jour = list(date.split("-")) |
|
|
@ -112,37 +124,36 @@ def moyenne_liste(): |
|
|
|
temp_num_jour.append([temp_jour[l-1][0], moy_conso, moy_temp_moy, moy_temp_ref]) |
|
|
|
return temp_num_jour |
|
|
|
|
|
|
|
def distance(temp_jour, donneespoint): |
|
|
|
def distance(temp_num_jour, donneespoint): |
|
|
|
"""Fonction qui dit qu'en prenant des points et ben on peut trouver une distance entre 2 point""" |
|
|
|
x1 = temp_jour[0] |
|
|
|
x1 = temp_num_jour[0] |
|
|
|
x2 = donneespoint[0] |
|
|
|
y1 = temp_jour[1] |
|
|
|
y1 = temp_num_jour[2] |
|
|
|
y2 = donneespoint[1] |
|
|
|
z1 = temp_jour[2] |
|
|
|
z1 = temp_num_jour[3] |
|
|
|
z2 = donneespoint[2] |
|
|
|
dist = ((x1-x2)**2)+((y1-y2)**2)+((z1-z2)**2) |
|
|
|
return dist |
|
|
|
MN = ((x1-x2)**2)+((y1-y2)**2)+((z1-z2)**2) |
|
|
|
return MN |
|
|
|
|
|
|
|
def PuissanceMoyenne(lst, distance): |
|
|
|
def PuissanceMoyenne(lst,distance): |
|
|
|
"""Calcule la moyenne de distances entre les points """ |
|
|
|
lecture("pic-journalier-consommation.csv") |
|
|
|
moy = sum() / len() |
|
|
|
return conso |
|
|
|
|
|
|
|
def recup1(): |
|
|
|
k = 5 |
|
|
|
k = 5 #value1.get() |
|
|
|
return k |
|
|
|
|
|
|
|
def recup2(): |
|
|
|
date = 2016 |
|
|
|
date = value2.get() |
|
|
|
return date |
|
|
|
|
|
|
|
def recup3(): |
|
|
|
temp_moy = 34 |
|
|
|
temp_moy = value3.get() |
|
|
|
return temp_moy |
|
|
|
|
|
|
|
def recup4(): |
|
|
|
temp_ref = 41 |
|
|
|
temp_ref = value4.get() |
|
|
|
return temp_ref |
|
|
|
|
|
|
|
#def calc_conso(): |
|
|
|