1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
import os
import numpy as np
import matplotlib.pyplot as plt
import glob
import os.path
def tri1(lines):
tab=[]
for chn in lines:
tab.append(chn.split('\t'))
return(tab)
def change(nl,nc,tab):
A = A=np.arange(2,nc-1)
for lst in tab[1:nl]:
for i in A:
lst[i]=float(lst[i])
print(lst)
return(lst)
def affec(nl,tab):
b1X=np.zeros(nl-1)
b1Y=np.zeros(nl-1)
b1Z=np.zeros(nl-1)
AA=np.arange(1,nl)
for k in AA:
b1X[k-1]=tab[k][2]
b1Y[k-1]=tab[k][3]
b1Y[k-1]=tab[k][4]
print("bonjour")
return(b1X)
def tri(rep):
os.chdir(rep)
for file in glob.glob("*.txt"):
test123 =open(file,"r")
lignes = test123.readlines()
tes1 = tri1(lignes)
modif = change(3,32,tes1)
trifinale = affec(3,tes1)
test123.close()
return(tes1)
ter = tri("/media/tonny/TOSHIBA EXT/test_pour_stage/premier_test")
print(ter)
print("\n") |