parent
6feb26117b
commit
6d55b66029
|
@ -4,6 +4,7 @@ import glob
|
|||
import numpy as np
|
||||
import math
|
||||
|
||||
|
||||
def Import_dessinBitmap(file):
|
||||
array = np.load(file)
|
||||
return array.tolist()
|
||||
|
@ -12,9 +13,9 @@ def Import_dessinBitmap(file):
|
|||
|
||||
def Afficher_Array(y):
|
||||
space = ' ' # <--- Pour modifier les espaces
|
||||
N1=len(y)
|
||||
N1 = len(y)
|
||||
for i in range(N1):
|
||||
N2=len(y[i])
|
||||
N2 = len(y[i])
|
||||
for j in range(N2):
|
||||
if y[i][j]:
|
||||
print(str(y[i][j]), end=space)
|
||||
|
@ -30,7 +31,7 @@ def Dim(Count, Size):
|
|||
def Calcul_dim(y, n=0):
|
||||
L = 2 ** n
|
||||
dim = 1
|
||||
|
||||
|
||||
N1 = len(y)
|
||||
for i in range(0, N1, L):
|
||||
N2 = len(y[i])
|
||||
|
@ -43,12 +44,13 @@ def Calcul_dim(y, n=0):
|
|||
Trouver = True
|
||||
return Dim(dim, N1//L)
|
||||
|
||||
def main(folder=".\\", n=0):
|
||||
|
||||
def Calcul_Dossier(folder=".\\", n=0):
|
||||
npy_list = [f for f in glob.glob(folder + "*.npy")]
|
||||
S=[]
|
||||
S = []
|
||||
|
||||
for i in range(len(npy_list)):
|
||||
file=npy_list[i]
|
||||
file = npy_list[i]
|
||||
y = Import_dessinBitmap(file)
|
||||
dim = Calcul_dim(y, n)
|
||||
print(str(i+1) + "\t" + file + " :\t" + str(dim))
|
||||
|
@ -65,8 +67,22 @@ def main(folder=".\\", n=0):
|
|||
Ecart = math.sqrt((Ecart / N - Moyenne ** 2) * N / (N - 1))
|
||||
print("Moyenne :\t\t" + str(Moyenne))
|
||||
print("Ecart type empirique :\t" + str(Ecart))
|
||||
|
||||
|
||||
return (Moyenne, Ecart)
|
||||
|
||||
|
||||
def main(folder=".", n=0):
|
||||
# folder_list = [f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, d))]
|
||||
folder_list = [f for f in glob.glob(folder + "\\*\\")]
|
||||
|
||||
Resultat = []
|
||||
for dossier in folder_list:
|
||||
print("\t--- " + dossier + " ---")
|
||||
Resultat.append(Calcul_Dossier(dossier))
|
||||
print("")
|
||||
print("")
|
||||
return Resultat
|
||||
|
||||
|
||||
main()
|
||||
input()
|
||||
input()
|
||||
|
|
Loading…
Reference in New Issue