mirror of
https://app-learninglab.inria.fr/moocrr/gitlab/da84ababf0696af51bddad556af86353/mooc-rr.git
synced 2026-06-21 11:35:27 +02:00
Module 2 exo 2
This commit is contained in:
parent
dc8c1bfb1c
commit
f4b6cc80f1
3 changed files with 50 additions and 1 deletions
|
|
@ -4,6 +4,8 @@
|
||||||
#+LANGUAGE: fr
|
#+LANGUAGE: fr
|
||||||
# #+PROPERTY: header-args :eval never-export
|
# #+PROPERTY: header-args :eval never-export
|
||||||
|
|
||||||
|
#+PROPERTY: mkdirp yes
|
||||||
|
|
||||||
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/htmlize.css"/>
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/htmlize.css"/>
|
||||||
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/readtheorg.css"/>
|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/readtheorg.css"/>
|
||||||
#+HTML_HEAD: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
#+HTML_HEAD: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||||
|
|
@ -11,7 +13,7 @@
|
||||||
#+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/lib/js/jquery.stickytableheaders.js"></script>
|
#+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/lib/js/jquery.stickytableheaders.js"></script>
|
||||||
#+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/readtheorg/js/readtheorg.js"></script>
|
#+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/readtheorg/js/readtheorg.js"></script>
|
||||||
|
|
||||||
Import des données
|
* Import des données
|
||||||
#+begin_src python :results output :session :exports both
|
#+begin_src python :results output :session :exports both
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
@ -28,6 +30,7 @@ print(dataSource)
|
||||||
: 19.6 21.7 11.3 15. 14.3 16.8 14. 6.8 8.2 19.9 20.4 14.6 16.4 18.7
|
: 19.6 21.7 11.3 15. 14.3 16.8 14. 6.8 8.2 19.9 20.4 14.6 16.4 18.7
|
||||||
: 16.8 15.8 20.4 15.8 22.4 16.2 20.3 23.4 12.1 15.5 15.4 18.4 15.7 10.2
|
: 16.8 15.8 20.4 15.8 22.4 16.2 20.3 23.4 12.1 15.5 15.4 18.4 15.7 10.2
|
||||||
: 8.9 21. ]
|
: 8.9 21. ]
|
||||||
|
* Partie 1&2
|
||||||
|
|
||||||
La moyenne :
|
La moyenne :
|
||||||
#+begin_src python :results output :session :exports both
|
#+begin_src python :results output :session :exports both
|
||||||
|
|
@ -69,3 +72,49 @@ print(np.std(dataSource, ddof=1))
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
: 4.334094455301447
|
: 4.334094455301447
|
||||||
|
|
||||||
|
* Partie 3
|
||||||
|
|
||||||
|
#+begin_src python :session :results file :var matplot_lib_filename="images/sequence.png" :exports both
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
w = np.arange(0, len(dataSource))
|
||||||
|
fig1 = plt.figure(figsize=(5,5))
|
||||||
|
plt.plot(list(w), list(dataSource), 'b-')
|
||||||
|
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
plt.grid(True)
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.xlim(0,100)
|
||||||
|
plt.ylim(0,25)
|
||||||
|
|
||||||
|
plt.savefig(matplot_lib_filename)
|
||||||
|
matplot_lib_filename
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+RESULTS:
|
||||||
|
[[file:images/sequence.png]]
|
||||||
|
#+begin_src python :session :results file :var matplot_lib_filename="images/hist.png" :exports both
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
# Actual plot
|
||||||
|
fig1 = plt.figure()
|
||||||
|
plt.hist(list(dataSource), edgecolor='k')
|
||||||
|
|
||||||
|
# Parameters
|
||||||
|
plt.grid(True)
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.xlim(0,25)
|
||||||
|
plt.ylim(0,25)
|
||||||
|
|
||||||
|
# Export the picture
|
||||||
|
plt.savefig(matplot_lib_filename)
|
||||||
|
matplot_lib_filename
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+RESULTS:
|
||||||
|
[[file:images/hist.png]]
|
||||||
|
|
|
||||||
BIN
module2/exo2/images/hist.png
Normal file
BIN
module2/exo2/images/hist.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
BIN
module2/exo2/images/sequence.png
Normal file
BIN
module2/exo2/images/sequence.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Loading…
Add table
Reference in a new issue