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 54 55 56 57 58 59
| import matplotlib.pyplot as plt ; import numpy as n
#### Coordonnées des points en fonction du temps ####
fic = open("Mouvement_NH.csv",'r') #
donnee=fic.readlines() #
x=[] ; y=[] ; dt = 10*86400 # 10 jours entre 2 points#
for point in donnee : #
point=point.split() # chaque point est un triplet#
if point[0][0].isnumeric(): #
x.append(float(point[1].replace(',','.'))) #
y.append(float(point[2].replace(',','.'))) #
######################################################
### Calcul de vx, vy et v pour le vecteur vitesse ###
vx=[] ; vy=[] ; v=[] #
for i in range(1,len(x)-1): #
vx.append((x[i+1]-x[i-1])/(2*dt)) #
vy.append((y[i+1]-y[i-1])/(2*dt)) #
v.append((vx[-1]**2+vy[-1]**2)**0.5) #
######################################################
## Calcul de ax et ay pour le vecteur accélération ##
ax=[] ; ay=[] ; a=[] #
for i in range(1,len(vx)-1): #
ax.append((vx[i+1]-vx[i-1])/(2*dt)) #
ay.append((vy[i+1]-vy[i-1])/(2*dt)) #
a.append((ax[-1]**2+ay[-1]**2)**0.5) #
######################################################
######## Tracé des champs de vecteurs: #############
vec_v=plt.quiver(x[1:-1],y[1:-1],vx,vy,color="green")#
plt.quiverkey(vec_v,X=0.7, Y=1.05, U=5e4,label='V') #
#
vec_a=plt.quiver(x[2:-2],y[2:-2],ax,ay,color="blue") #
plt.quiverkey(vec_a,X=0.2, Y=1.05, U=1e-2,label='a') #
#
plt.plot(x,y,"ro") ; plt.axis('equal') #
plt.show() #
######################################################
########### Traitement statistique ###########
v = n.array(v) ; a = n.array(a) # données sous numpy #
v_moy=n.mean(v) ; a_moy = n.mean(a) # Moyennes #
k=a_moy*149e9/v_moy**2 #
#### Calcul des incertitudes U sur a, v et k : ######
U_v=n.std(v,ddof=1)/(len(vx)**0.5) #
U_a=n.std(a,ddof=1)/(len(a)**0.5) #
U_k = (k*((2*U_v/v_moy)**2+(U_a/a_moy)**2)**0.5) #
#### Affichage des résultats statistiques : #######
plt.text(-0.5e11,0,
"V = ("+str(int(v_moy/1e2)/10) +chr(177)
+str(int(U_v/1e2)/10)+")km/s\n"+
"a = ("+ str(int(a_moy*1e5)/1e2)+chr(177)
+str(int(U_a*1e5)/1e2)+')mm/s²\n'+
"k = ("+ str(int(k*100)/100)+chr(177)
+str(int(U_k*100)/100)+")") |