Commit e790ea56 authored by Antoine Cully's avatar Antoine Cully
Browse files

[ci skip] Add minimal matplotlib script to display aggredated observations

parent 9ffa6599
......@@ -97,3 +97,9 @@ Running the executable also created a folder with a name composed of YOUCOMPUTER
The file ``samples.dat`` contains the coordinates of the samples that have been evaluated during each iteration, while the file ``aggregated_observations.dat`` contains the corresponding observed values.
If you want to display the different observations in a graph, you can the python script ``print_aggregated_observations.py``.
For instance, from the root of limbo you can run ::
python src/tutorials/print_aggregated_observations.py YOUCOMPUTERHOSTNAME-DATE-HOUR-PID/aggregated_observations.dat
# this will load numpy for us
import matplotlib.pyplot as plt
import numpy as np
import sys
if(len(sys.argv)<2):
print("ERROR : Please provide path to the aggregated_observations.dat file.")
quit()
# Load and process data
data = np.loadtxt(sys.argv[1],skiprows=1)
x = data[:,0]
y = data[:,1]
min_y=np.min(y)
max_y=np.max(y)
rand_init_x = x[x==-1]
rand_init_y = y[x==-1]
y = y[x!=-1]
x = x[x!=-1]
# set vertical limit
plt.ylim(min_y-0.1*np.abs(max_y-min_y), max_y+0.1*np.abs(max_y-min_y))
# plot random initilization and observations
rand_init = plt.plot(rand_init_x, rand_init_y,'g^', label='Random Initialization')
observations = plt.plot(x, y,'bo',label = 'observations')
plt.xlabel('Iterations')
plt.ylabel('Observations')
plt.title('Limbo')
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
plt.show()
Supports Markdown
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