diff --git a/Py-Script/courbe.py b/Py-Script/courbe.py index c08fdea..a356fe8 100644 --- a/Py-Script/courbe.py +++ b/Py-Script/courbe.py @@ -1,15 +1,15 @@ from secrets import choice +from xmlrpc.client import boolean import numpy as np import matplotlib.pyplot as plt import csv -import pandas as pd #"C:\Users\quent\OneDrive\Bureau\ENSC\TransD\Framboisier\02400001.TXT" #! /usr/bin/env python3 # -*- coding: UTF-8 -*- def function(): - tab = np.zeros([1,9]) + #tab = np.zeros([1,9]) while True: choice = input("Choisis un fichier csv de 1 à 1862: \n") @@ -17,21 +17,30 @@ def function(): if float(choice) in range(1, 1863): rawdata = '../RawDataFiles/RawData' + choice + '.csv' #Définit le fichier à ouvrir + with open(rawdata, newline='') as csvfile: reader = csv.reader(csvfile, quoting=csv.QUOTE_NONNUMERIC) - for row in reader: - t = np.zeros([1,9]) - t[0] = row - tab = np.append(tab ,t , axis = 0) + x = [row for row in reader] + int_x = np.array(x, int) + column_index = [2,3,4,5,6,7,8,9] + + for col in column_index: + column_values = np.empty(0) + for array in range(len(int_x)): + column_values = np.append(column_values, np.array(int_x[array][col-1])) + plt.plot(column_values) + plt.show() break - + elif choice > '1862' or choice < '1': print("{} n'est pas un nombre valide.\n".format(choice)) - x = tab[:,0] - y = tab[:,1] - print(tab) - return x , y + # x = tab[:,0] + # y = tab[:,1] + # print(tab) + # return x , y + +bool #Fonction d'affichage du graphique def printFig(axe_x , axe_y , title = "new plot" , xlabel = "Temps" , ylabel = "Tension"): @@ -45,7 +54,7 @@ def printFig(axe_x , axe_y , title = "new plot" , xlabel = "Temps" , ylabel = "T #print(x) #print("y = " + str(y)) def final(): - x, y = function() - printFig(x,y) + function() + #printFig() final()