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

31 lines
735 B
Python

import math
import numpy as np
import matplotlib.pyplot as plt
import struct
import csv
import sys
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()