Traitement-signal-plantes/Py-Script/courbe.py

31 lines
735 B
Python
Raw Permalink Normal View History

2022-06-07 16:22:49 +02:00
import math
import numpy as np
import matplotlib.pyplot as plt
import struct
import csv
import sys
2022-06-07 16:22:49 +02:00
2022-06-24 17:17:28 +02:00
def function():
for i in range(1, 10):
rawdata = 'Code-C/RawDataFiles/RawData' + str(i) + '.csv' #Définit le fichier à ouvrir
with open(rawdata, newline='') as csvfile:
reader = csv.reader(csvfile, quoting=csv.QUOTE_NONNUMERIC)
x = [row for row in reader]
int_x = np.array(x, int)
for j in range(1,len(int_x[0])):
aver = average(int_x[:,j])
print("I = " , i ," J = " ,j ," aver = " , aver , '\0')
def average(x):
res = 0
for i in range(len(x)):
res += x[i]
return res / len(x)
function()