2022-06-17 16:21:08 +02:00
|
|
|
from secrets import choice
|
2022-06-17 17:25:14 +02:00
|
|
|
from tracemalloc import stop
|
2022-06-07 16:22:49 +02:00
|
|
|
import numpy as np
|
|
|
|
import matplotlib.pyplot as plt
|
2022-06-13 15:07:02 +02:00
|
|
|
import csv
|
2022-06-07 16:22:49 +02:00
|
|
|
|
|
|
|
#"C:\Users\quent\OneDrive\Bureau\ENSC\TransD\Framboisier\02400001.TXT"
|
|
|
|
#! /usr/bin/env python3
|
|
|
|
# -*- coding: UTF-8 -*-
|
|
|
|
|
2022-06-17 17:25:14 +02:00
|
|
|
def function():
|
|
|
|
tab = np.zeros([1,9])
|
2022-06-07 16:22:49 +02:00
|
|
|
|
2022-06-17 17:25:14 +02:00
|
|
|
#def tab_choix():
|
|
|
|
while True:
|
|
|
|
choice = input("Choisis un fichier csv de 1 à 1862: \n")
|
|
|
|
print("\n")
|
|
|
|
|
|
|
|
if float(choice) in range(1, 1863):
|
|
|
|
rawdata = '../RawDataFiles/RawData' + choice + '.csv'
|
|
|
|
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)
|
|
|
|
break
|
|
|
|
|
|
|
|
elif choice > '1862' or choice < '1':
|
|
|
|
print("{} n'est pas un nombre valide.\n".format(choice))
|
|
|
|
exit()
|
2022-06-17 16:21:08 +02:00
|
|
|
|
2022-06-17 17:25:14 +02:00
|
|
|
x = tab[:,0]
|
|
|
|
y = tab[:,1]
|
|
|
|
print(tab)
|
|
|
|
return x , y
|
2022-06-13 15:07:02 +02:00
|
|
|
|
2022-06-17 16:21:08 +02:00
|
|
|
#Fonction d'affichage du graphique
|
|
|
|
def printFig(axe_x , axe_y , title = "new plot" , xlabel = "Temps" , ylabel = "Tension"):
|
2022-06-15 15:46:40 +02:00
|
|
|
plt.plot(axe_x , axe_y)
|
|
|
|
plt.xlabel(xlabel)
|
|
|
|
plt.ylabel(ylabel)
|
|
|
|
plt.title(title)
|
|
|
|
plt.show()
|
|
|
|
return 0
|
2022-06-13 15:07:02 +02:00
|
|
|
|
2022-06-17 16:21:08 +02:00
|
|
|
#print(x)
|
|
|
|
#print("y = " + str(y))
|
2022-06-17 17:25:14 +02:00
|
|
|
def final():
|
|
|
|
x, y = function()
|
|
|
|
printFig(x,y)
|
|
|
|
|
|
|
|
final()
|