import math import numpy as np import matplotlib.pyplot as plt import csv taille = 100000 freq = 250 periode = 1 / freq temps = periode * taille resultat = np.zeros([taille,8]) j = 0 # opening the CSV file with open('rawData.csv', mode ='r') as file: # reading the CSV file csvFile = csv.reader(file, delimiter=",") # displaying the contents of the CSV file for lines in csvFile: line = np.zeros(8) for i in range(8): line[i] = lines[i+1] resultat[j] = line j+=1 if(j == taille) : break #print(resultat.shape) resultat*=resultat for i in range(8): aire = 0 flag = False for j in range(taille-1): aire += (resultat[j,i]+resultat[j+1,i]) / 2 * periode if(aire!=0 and flag == False): flag = True print(i , j , resultat[j,i] , resultat[j+1,i], aire) res = aire/temps print("power c°" + str(i+1) + " : " + str(res))