Commit 7355556a authored by Hugo LEVY-FALK's avatar Hugo LEVY-FALK

Séparation data/scripts/résultats

parent 0eb2389e
"""
=========================
Simple animation examples
=========================
This example contains two animations. The first is a random walk plot. The
second is an image animation.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
def update_line(num, data, line):
line.set_data(data[..., :num])
return line,
fig1 = plt.figure()
data = np.random.rand(2, 25)
l, = plt.plot([], [], 'r-')
plt.xlim(0, 1)
plt.ylim(0, 1)
plt.xlabel('x')
plt.title('test')
line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l),
interval=50, blit=True)
# To save the animation, use the command: line_ani.save('lines.mp4')
fig2 = plt.figure()
x = np.arange(-9, 10)
y = np.arange(-9, 10).reshape(-1, 1)
base = np.hypot(x, y)
ims = []
for add in np.arange(15):
ims.append((plt.pcolor(x, y, base + add, norm=plt.Normalize(0, 30)),))
im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000,
blit=True)
# To save this second animation with some metadata, use the following command:
# im_ani.save('im.mp4', metadata={'artist':'Guido'})
plt.show()
......@@ -2,7 +2,7 @@ using Statistics
using CSV
file_measure = "walk.csv"
file_measure = joinpath(@__DIR__, "data", "walk.csv")
measure = CSV.read(file_measure, header=false) |> Matrix{Float64}
......@@ -15,5 +15,5 @@ print("Delta moyen :\t\t")
print(Statistics.mean(deltas))
println(" s")
print("Écart type :\t\t")
print((Statistics.std(deltas)))
print(Statistics.std(deltas))
println(" s");
......@@ -6,7 +6,6 @@ import time
import click
#import rospy
@click.command()
@click.option('--output', default="output.csv", help='Number of greetings.')
......
......@@ -2,8 +2,8 @@ using Plots
using CSV
pyplot()
file_measure = "linear_x2.csv"
file_input = "input_linear_x2.csv"
file_measure = joinpath(@__DIR__, "data", "linear_x2.csv")
file_input = joinpath(@__DIR__, "data", "input_linear_x2.csv")
measure = CSV.read(file_measure, header=false) |> Matrix{Float64};
command = CSV.read(file_input, header=false) |> Matrix{Float64};
......@@ -22,14 +22,16 @@ end
plot(
measure[init_measure:end-end_measure,1],
measure[init_measure:end-end_measure,2],
title="plop",
size=(1000, 600)
title="Réponse indicielle de la boucle interne",
reuse=false,
size=(1000, 600),
label="mesure"
)
s = sum([x * (measure[init_command + i,1] - measure[init_command + i-1,1]) for (i,x) in enumerate(measure[init_measure:end-end_measure,2])]) / (measure[end-end_measure,1] - measure[init_measure,1])
plot!([measure[init_measure,1], measure[end-end_measure,1]], [s, s])
plot!(
command[init_command:end,1],
command[init_command:end,2]
command[init_command:end,2],
label="commande"
)
savefig(joinpath(@__DIR__, "results", "internal_tuns.eps"))
show()
This diff is collapsed.
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: matplotlib version 2.2.4, http://matplotlib.org/
%%CreationDate: Sun Jun 2 14:33:03 2019
%%CreationDate: Sun Jun 2 18:28:49 2019
%%Orientation: portrait
%%BoundingBox: -54 180 666 612
%%EndComments
......
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: matplotlib version 2.2.4, http://matplotlib.org/
%%CreationDate: Sun Jun 2 14:33:02 2019
%%CreationDate: Sun Jun 2 18:28:49 2019
%%Orientation: portrait
%%BoundingBox: -54 180 666 612
%%EndComments
......
......@@ -5,11 +5,12 @@ using CSV
pyplot()
# Parameters
filename = "walk.csv" # input file
filename = joinpath(@__DIR__, "data", "walk.csv") # input file
h = 1/22 # sample time
orders = [
(title="quadratique", order=2, sizes=5:2:11),
(title="cubique", order=3, sizes=5:2:11)
(title="cubique", order=3, sizes=5:2:11),
(title="big_quadra", order=2, sizes=11:10:51)
]
......@@ -62,6 +63,6 @@ for order in orders
subplot=2
)
end
savefig(string("mesure_vitesse_", order.title, ".eps"))
savefig(joinpath(@__DIR__, "results", string("mesure_vitesse_", order.title, ".eps")))
end
show()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment