added curves for the 8 captors

This commit is contained in:
theo.canaud 2022-06-22 16:59:17 +02:00
parent 8288df18a0
commit 5f23c7b15e

View file

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