...
 
Commits (23)
# Journal de bord du Mooc / Mooc's logbook
# Journal de bord du Mooc
FR
- 11/11/2020 : module 1 terminé, prise en main des outils.
- Modules 1 achevé.
- Premières rédactions. Les résumés seront mis dans les fichiers Readme.md inclus dans les répertoires.
- Démarrage du module 2
Espace réservé au journal de bord du Mooc
EN
- 13/11/2020 : présentation de JupyterHub par un collègue et autres outils
- [Ploty](https://plotly.com/)
- [https://cantera.org/](https://cantera.org/)
- 14/11/2020 : réplication de la base en local et suivi par git.
- 19.11.2020 : exercices du module2 sur la solution emacs-org + Python
Quand on exécute un code Python, Emacs crée un buffer *Python* en arrière plan.
On peut y entrer et en particulier vérifier sur quel répertoire on est, par exemple pour la
génération de graphique. Les commandes pour vérifier le répertoire en cours et en changer sont
respectivement `os.getcwd()` et `os.chdir(..)`.
Reserved for the Mooc's logbook
\ No newline at end of file
Module 1
# Module 1 : Cahier de Notes, cahier de laboratoire
Ce module commence par un aperçu historique de la prise de note dans le contexte plus général de l'écriture et des livres. Puis il présente des entretiens avec des chercheurs de plusieurs domaines (mathématique, histoire, sience politique, recherche en laboratoire ...). Ces entretiens montrent le glissement progressif des chercheurs vers des solutions informatiques, qui présentent des intérêts techniques évidents (comme la renumérotation automatique de notes très nombreuses, comme en parle très bien l'historienne). Le module termine par la présentation des solutions informatiques.
L'exercice consiste à écrire un premier fichier dans le format markdown.
Le support du cours est téléchargeable [ici](https://www.fun-mooc.fr/asset-v1:inria+41016+self-paced+type@asset+block/C028AL_slides_module1-fr-gz.pdf)
## Aperçu historique
L'évolution du livre est passée par deux étapes en Occident:
- le *volumen*, qui est rouleau écrit sur papyrus qui se déroule au moment de la lecture (entre deux rouleaux). On en trouve ecore aujourd'hui dans les synagogues pour les rouleaux de la Tora.
- le *codex*, qui descend des tablettes de cire de la période Romaine, assemblées ensemble, puis plus tard remplacées par des feuilles de vélin, puis de papier.
La tradition Juive est née à l'époque des *volumen* et s'attache donc à ce format. Il pousse à lire à haute voix et ne permet pas de prise de note sur un autre support annexe car les deux mains sont prises par les deux rouleaux (celui à enrouler et celui à dérouler). La lecture se fait au rythme de la diction, ce qui est renforcé par la difficulté de déchiffrer un texte dans lequel les mots ne sont pas séparés (et pour l'hébreux, dans lequel les accents indiquant les sons voyelles peuvent ne pas être notés).
Les traditions Chrétiennes, puis musulmannes nées plus tard, ont utilisé le format codes dès leur origine pour leur livres traditionnels.
La séparation des mots, puis des paragraphes (d'abord s'implement indiqués par les lettrines de couleur) n'apparaitra que progressivement au cours des siècles qui suivent. La lecture silencieuse n'apparaitra qu'à la fin de cette lente évolution. Elle remplacera le lien entre la lecture et l'élocution par un lien entre la lecture et la pensée, qui nous semble si naturel aujourd'hui.
## Revu des exemples pratiques de la prise de notes aujourd'hui
À travers les entrertiens et les présentations, les impératifs de la prise de notes sont:
- être techniquement simple et légère, pour que le processus soit naturel et puisse être répétés régulièrement et sans découragements ;
- permettre une relecture simple et rapide ;
- faciliter ensuite les recherches, quand les notes se sont accumulées.
L'utilisation de l'informatique est actuellement un accélérateur de recherche. Dans son entretien, l'historienne compare ses notes écrites au début sur papier avec celles qu'elle prend aujourd'hui sur un ordinateur et avoue qu'honnêtrement, elle revient maintenant très rarement sur celles en papier, plus compliquées à utiliser. On voit donc qu'à terme, le fait de pouvoir retrouver efficacement une note sur un sujet donné est un point crucial.
Par contre, la difficulté est que nos centres d'intérêt ou de recherche peuvent changer. Le classement que l'on pense efficace aujourd'hui, le sera peut être moins demain...
<!-- exemple à donner ou développer -->
## Les solutions informatiques
Plusieurs solutions informatiques sont présentées:
- le langage de balisage [markdown](https://enacit.epfl.ch/cours/markdown-pandoc)
- les logiciels permettant de *marquer* des images.
- Les logiciels de recherche de mots à travers plusieurs fichiers.
- Le logiciel se suivi de réivison *git* et ses applications directes *gitlab* et *github*
### le format markdown
Il insiste en particulier sur le format texte, qui correspond aux fichiers encodés selon un standard de représenation simple, actuellement [utf-8](https://www.utf8-chartable.de/) étant le format plus naturel. Ces formats simples vont faciliter ensuite la recherche par d'autres outils et en particulier les outils cloud, comme dans l'exemple de ces notes.
Pour conserver une présentation agréable à la lecture, le format , est format simple avec balise qui permet d'obtenir les mises en forme dont on peut avoir besoin dans une prise de notes. Ces formats de balise permettent aussi d'inclure des notes masquées, qui faciliteront les recherches par thèmes. D'autres initiatives comme la [TEI](https://tei-c.org/release/doc/tei-p5-doc/fr/html/) visent à établir des standards, qui permettraient d'utiliser plus efficacement les textes sources, s'ils étaient universellement utilisés.
### Les recherches de mots clés à travers plusieurs fichiers
Les logiciels de traitement de texte (comme Word) permettent la recherche de mots, mais uniquement sur un seul fichier. Sous Linux, il existe une application bien pratique, *grep*, qui permet de faire ce genre de recherche à travers plusieurs fichiers textes (et en généralisant ces recherches grâce aux expressions rationnelles). Cette [page d'Ubuntu](https://doc.ubuntu-fr.org/recherche_de_fichiers) présente les différentes solutions qui existent.
#### cgvg
La [page de l'auteur donne le source](http://www.uzix.org/cgvg.html). On trouve aussi d'autres explications sur [une page de Debian](https://packages.debian.org/unstable/cgvg). Cette suite n'est a priori plus maintenue, mais fonctionne bien. Elle permet de faire des recherches avec le commande `cg` puis de visualiser les résultats dans les fichiers avec `vg`.
#### docFetcher
Ce logiciel a l'intérêt d'exister sous les trois plateformes.
#### ExifTool
Ce [logiciel](https://exiftool.org/) permet de visualiser et d'écrire directement dans les métadata d'un fichier image. On peut ainsi insérer une nouvelle propriété, qui pourra à son tour être trouvées par une recherche sur un mot clé donné.
La commande [mogrify d'ImageMagick](https://imagemagick.org/script/mogrify.php) permet aussi de faire cela, mais je n'ai pas encore approfondi la desssus.
### La gestion de versions avec Git
Le logiciel [Git](https://git-scm.com/) a été dévelopé par Linus Torwald est son équipe en 2005 pour travailler en équipe sur le noyaux linux et remplacer le logiciel *bitKeeper* qui changeait alors de licence. Ce logiciel conserve les différentes versions d'une serie de fichiers (que l'on peut choisir un à un), ce qui permet les retours en arrière et aussi d'identifier et de commenter les changements. Il fonctionne de manière non centralisée: chacun conservant une copie en local, peut ensuite développer des branches alternatives. Ceci correspond pleinement à l'esprit des logiciels libres.
Mais l'application à des prises de notes est aussi très intéressante : on prend des notes, on peut revenir en arrière tout en conservant des notes alternatives qui pourraient redevenir intéressantes plus tard...
Deux applications cloud existent sur la base de ce logiciel:
- [github](https://github.com/)
- [gitlab](https://about.gitlab.com/)
Ces deux applications appartiennent à des entrerprises privées et ont chacune un fonctionnement commercial différent.
- github est gratuit pour les étudiants, mais devient payante pour les entreprises
- gitlab permet à chacun de se faire une version personnalisée et c'est ensuite le service qui devient payant
Ce cours utilise une version Inria de Gitlab
## Des liens utiles que j'ai retenus après ce module:
- [Lien vers La BnF sur l'histoire des écritures](http://classes.bnf.fr/ecritures/)
- [table des caractères Unicode](https://www.utf8-chartable.de/)
- [Élaboration et conversion de documents avec Markdown et Pandoc, de Jean-Daniel Bonjour](https://enacit.epfl.ch/cours/markdown-pandoc/)
- [La TEI: Text Encoding Initiative](https://tei-c.org/release/doc/tei-p5-doc/fr/html/)
- [Odette, logiciel TEI, présentation de Frédéric Glorieux](http://obvil.sorbonne-universite.site/developpements/odette)
*Autres ressources intéressantes:*
- [Qu'est-ce qu'un lieu de savoir](https://books.openedition.org/oep/650)
......@@ -13,22 +13,22 @@ Une ligne de `code`
## Sous-partie 2 : listes
** Liste à puces **
**Liste à puces**
- item
- sous-item
- sous-item
- item
- item
** Liste numérotée **
**Liste numérotée**
1. item
2. item
3. item
** Sous-partie 3 : code **
## Sous-partie 3 : code **
```
# Extrait de code`
# Extrait de code
```
# -- coding: utf-8-unix; mode:org; fill-column: 100; mode: auto-fill; -*-
#+TITLE: Introduction à Markdown
#+DATE: June, 2018
#+LANG: fr
#+STARTUP: overview indent
#+OPTIONS: num:nil toc:t
Voici un aperçu rapide de la syntaxe Markdown repris d'une
[[https://guides.github.com/features/mastering-markdown/][présentation de GitHub]] ainsi que de celles d'[[http://csrgxtu.github.io/2015/03/20/Writing-Mathematic-Fomulars-in-Markdown/][Archer Reilly]].
* Table des matières :TOC:
- [[#syntaxe][Syntaxe]]
- [[#headers][Headers]]
- [[#emphasis][Emphasis]]
- [[#lists][Lists]]
- [[#images][Images]]
- [[#links][Links]]
- [[#blockquotes][Blockquotes]]
- [[#inline-code][Inline code]]
- [[#écrire-des-maths][Écrire des Maths]]
- [[#lettres-grecques][Lettres grecques]]
- [[#fonctions-et-opérateurs][Fonctions et opérateurs]]
- [[#exposants-et-indices][Exposants et indices]]
- [[#fractions-coefficients-binomiaux-racines-][Fractions, coefficients binomiaux, racines...]]
- [[#sommes-et-intégrales][Sommes et intégrales]]
- [[#déguisements][Déguisements]]
- [[#autour-de-markdown][Autour de Markdown]]
* Syntaxe
** Headers
#+BEGIN_EXAMPLE
# This is an <h1> tag
## This is an <h2> tag
###### This is an <h6> tag
#+END_EXAMPLE
** Emphasis
#+BEGIN_EXAMPLE
*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__
_You **can** combine them_
#+END_EXAMPLE
** Lists
*** Unordered
#+BEGIN_EXAMPLE
- Item 1
- Item 2
- Item 2a
- Item 2b
#+END_EXAMPLE
*** Ordered
#+BEGIN_EXAMPLE
1. Item 1
2. Item 2
3. Item 3
1. Item 3a
2. Item 3b
#+END_EXAMPLE
** Images
#+BEGIN_EXAMPLE
![GitHub Logo](/images/logo.png)
Format: ![Alt Text](url)
#+END_EXAMPLE
** Links
#+BEGIN_EXAMPLE
http://github.com - automatic!
[GitHub](http://github.com)
#+END_EXAMPLE
** Blockquotes
#+BEGIN_EXAMPLE
As Kanye West said:
> We're living the future so
> the present is our past.
#+END_EXAMPLE
** Inline code
#+BEGIN_EXAMPLE
To print some text with Python, you should use the `print()` function.
```
print("Hello world!")
```
#+END_EXAMPLE
* Écrire des Maths
Il est possible d'écrire des formules en Markdown, soit en mode *inline*
soit en mode *displayed formulas*. Dans le premier cas, les formules
sont incluses directement à l'intérieur du paragraphe courant alors
que dans le second, elles apparaissent centrées et mises en exergue.
Le formatage de la formule est légèrement différent dans les deux cas
car pour qu'une formule s'affiche joliment sur une seule ligne, il
faut la "tasser" un peu plus que lorsqu'elle est mise en valeur.
Pour écrire une formule en mode *inline*, il faut la délimiter par un =$=
(du coup, pour écrire le symbole dollar, il faut le préfixer par un
backslash, comme ceci : =\$=) alors que pour écrire en mode *displayed*, il
faut la délimiter par un =$$=. Un petit exemple valant mieux qu'un long
discours, voici concrètement comment cela fonctionne :
#+BEGIN_EXAMPLE
Cette expression $\sum_{i=1}^n X_i$ est inlinée.
#+END_EXAMPLE
Cette expression $\sum_{i=1}^n X_i$ est inlinée.
#+BEGIN_EXAMPLE
Cette expression est mise en valeur :
$$\sum_{i=1}^n X_i$$
#+END_EXAMPLE
Cette expression est mise en valeur :
$$\sum_{i=1}^n X_i$$
Nous vous présentons par la suite une sélection de symboles et de
commandes courants. En fait, à peu près tout ce qui est classique
dans le langage LaTeX peut être utilisé pourvu que vous délimitiez
bien avec un =$=. Pour d'autres exemples plus complets jetez un coup
d'œil à ces [[http://www.statpower.net/Content/310/R%20Stuff/SampleMarkdown.html][exemples de James H. Steiger]].
** Lettres grecques
| Symbole | Commande |
|---------+----------|
| $\alpha$ | =$\alpha$= |
| $\beta$ | =$\beta$= |
| $\gamma$ | =$\gamma$= |
| $\Gamma$ | =$\Gamma$= |
| $\pi$ | =$\pi$= |
** Fonctions et opérateurs
| Symbole | Commande |
|---------+----------|
| $\cos$ | =$\cos$= |
| $\sin$ | =$\sin$= |
| $\lim$ | =$\lim$= |
| $\exp$ | =$\exp$= |
| $\to$ | =$\to$= |
| $\in$ | =$\in$= |
| $\forall$ | =$\forall$= |
| $\exists$ | =$\exists$= |
| $\equiv$ | =$\equiv$= |
| $\sim$ | =$\sim$= |
| $\approx$ | =$\approx$= |
| $\times$ | =$\times$= |
| $\le$ | =$\le$= |
| $\ge$ | =$\ge$= |
** Exposants et indices
| Symbole | Commande |
|---------+-----------|
| $k_{n+1}$ | =$k_{n+1}$= |
| $n^2$ | =$n^2$= |
| $k_n^2$ | =$k_n^2$= |
** Fractions, coefficients binomiaux, racines...
| Symbole | Commande |
|-----------------------------+-----------------------------|
| $\frac{4z^3}{16}$ | =$\frac{4z^3}{16}$= |
| $\frac{n!}{k!(n-k)!}$ | =$\frac{n!}{k!(n-k)!}$= |
| $\binom{n}{k}$ | =$\binom{n}{k}$= |
| $\frac{\frac{x}{1}}{x - y}$ | =$\frac{\frac{x}{1}}{x - y}$= |
| $^3/_7$ | =$^3/_7$= |
| $\sqrt{k}$ | =$\sqrt{k}$= |
| $\sqrt[n]{k}$ | =$\sqrt[n]{k}$= |
** Sommes et intégrales
| Symbole | Commande |
|---------------------------------+--------------------------------------|
| $\sum_{i=1}^{10} t_i$ | =$\sum_{i=1}^{10} t_i$= |
| $\int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x$ | =$\int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x$= |
** Déguisements
| Symbole | Commande |
|-----------------------+-----------------------|
| $\hat{a}$ | =$\hat{a}$= |
| $\bar{a}$ | =$\bar{a}$= |
| $\dot{a}$ | =$\dot{a}$= |
| $\ddot{a}$ | =$\ddot{a}$= |
| $\overrightarrow{AB}$ | =$\overrightarrow{AB}$= |
* Autour de =Markdown=
Tout d'abord, pour aller plus loin avec =Markdown= et ses extensions / ramifications :
- Le didacticiel « [[https://enacit1.epfl.ch/markdown-pandoc/][Élaboration et conversion de documents avec Markdown et Pandoc]] » de Jean-Daniel Bonjour (EPFL), précis, complet, concis, en français ; un vrai bonheur !
- L'article [[https://en.wikipedia.org/wiki/Markdown#Example][Markdown]] de wikipedia en anglais contient un bon pense-bête sur la syntaxe =Markdown=.
- GitHub propose un court et efficace didacticiel (en anglais) : [[https://guides.github.com/features/mastering-markdown/][Mastering Markdown]].
Comme nous l'illustrons dans le « film d'écran » (/screencast/), l'éditeur de texte des dépôts =GitHub=
et =GitLab= permet d'interpréter / transformer à la demande un fichier =Markdown= en un fichier
=html=. C'est à la fois agréable et pratique, mais ce n'est pas une solution pour une utilisation
quotidienne de =Markdown=, pour cela, il est plus efficace d'éditer son texte, avec un éditeur de
texte, sur son ordinateur, avant de « l'exporter » dans un format comme =html=, =pdf=, =docx=, =epub=,
etc. Il existe des éditeurs plus ou moins spécialisés pour =Markdown=, certains sont indiqués sur la
page [[https://github.com/jgm/pandoc/wiki/Pandoc-Extras#editors][Editors]] du site de =Pandoc=, mais nous préconisons clairement l'emploi d'un éditeur de texte
« généraliste » capable de reconnaître la syntaxe =Markdown=. Nous en avons indiqué en début de
séquence et on pourra trouver des informations complémentaires dans la section
[[https://enacit1.epfl.ch/markdown-pandoc/#editeurs_markdown][Quelques éditeurs adaptés à l'édition Markdown]] du didacticiel de Jean-Daniel Bonjour.
Pour convertir un fichier =Markdown= en un format « arbitraire », la solution à ce jour la plus
complète est [[http://pandoc.org/][Pandoc]], logiciel développé par John MacFarlane, un philosophe de Berkeley (le site
[[https://github.com/jgm/pandoc][GitHub]]). En plus du site de =Pandoc=, le didacticiel de J.-D. Bonjour donne de nombreuses explications
sur comment installer et utiliser =Pandoc= dans la section [[https://enacit1.epfl.ch/markdown-pandoc/#commande_pandoc][Utilisation du convertisseur Pandoc]]. Comme
=Pandoc= -- écrit en Haskell -- peut être parfois un peu difficile à installer, nous indiquons
maintenant quelques solutions alternatives :
- Des sites comme [[http://www.markdowntopdf.com/]] et [[http://markdown2pdf.com/]] permettent de convertir
en ligne un fichier =Markdown= en un fichier =pdf=.
- Le projet [[http://commonmark.org/][CommonMark]] propose, en plus d'une spécification plus rigoureuse de la syntaxe =Markdown=,
des convertisseurs =Markdown= → =html= / =LaTeX= (et plus) écrits en =C= et en =JavaScript=
([[https://github.com/CommonMark/CommonMark]]).
- Le site de [[https://daringfireball.net/projects/markdown/][John Gruber]], le créateur de =Markdown=, fournit un convertisseur =Markdown= → =html= écrit en
=Perl=.
- [[http://fletcherpenney.net/multimarkdown/][MultiMarkdown]] est une autre extension de =Markdown= qui vient avec son convertisseur =Markdown= → =html=
écrit en =C=.
- [[https://github.com/joeyespo/grip][grip]] est un serveur écrit en =Python= qui permet de convertir et visualiser à la volée des fichiers
=Markdown= avec son navigateur (très utile pour éviter d'avoir à faire des « commits » en grande
quantité lorsqu'on écrit de tels fichiers pour un dépôt =GitHub= ou =GitLab=).
La conversion en =pdf= passe toujours par [[https://fr.wikipedia.org/wiki/LaTeX][LaTeX]] ce qui nécessite d'avoir une version complète et à
jour de ce logiciel sur sa machine.
Dans la petite démonstration, nous montrons comment générer un fichier =docx= à partir d'un fichier =md=
avec =Pandoc= et nous soulignons qu'il est alors possible d'utiliser un traitement de texte comme
=LibreOffice= pour modifier le fichier obtenu. Il est clair que si des modifications sont apportées au
=docx= elles ne seront pas (automatiquement) propagées au =md=. Il faudra utiliser =Pandoc= pour cela et
effectuer une conversion de =docx= vers =md= (et seuls les éléments du format =docx= qui existent en =md=
seront conservés).
Une stratégie qui est souvent employée et qui fonctionne bien en pratique consiste à faire le gros
du travail de rédaction d'un article ou d'un mémoire en =Markdown=. La rédaction terminée, le fichier
est exporté au format =docx= (ou =LaTeX=) et des ajustements de mise en page sont alors effectués avec
un logiciel de traitement de texte (ou un éditeur =LaTeX=).
Module 2
# Module 2 : La vitrine et l'envers du décors
## Introduction
Trois outils sont présentés dans ce module
1. Jupyter : un notebook orienté pour le langage Python (mais acceptant R)
2. RStdudio: un environnement de développement pour le langage R
3. org mode: un environnement généraliste développé en particulier pour Emacs
## Jupyter
Jupyter permet de mélanger le code Python avec des descriptions et les résultats.
Il existe des méta instructions comme `matplotlib line` qui est une instruction spécifiant que les images seront intégrées au notebook. On peut en avoir la liste complète avec la macro-instruction `%lsmagic`
"","speed","dist"
"1",4,2
"2",4,10
"3",7,4
"4",7,22
"5",8,16
"6",9,10
"7",10,18
"8",10,26
"9",10,34
"10",11,17
"11",11,28
"12",12,14
"13",12,20
"14",12,24
"15",12,28
"16",13,26
"17",13,34
"18",13,34
"19",13,46
"20",14,26
"21",14,36
"22",14,60
"23",14,80
"24",15,20
"25",15,26
"26",15,54
"27",16,32
"28",16,40
"29",17,32
"30",17,40
"31",17,50
"32",18,42
"33",18,56
"34",18,76
"35",18,84
"36",19,36
"37",19,46
"38",19,68
"39",20,32
"40",20,48
"41",20,52
"42",20,56
"43",20,64
"44",22,66
"45",23,54
"46",24,70
"47",24,92
"48",24,93
"49",24,120
"50",25,85
module2/exo1/cosxsx.png

19 KB | W: | H:

module2/exo1/cosxsx.png

21.9 KB | W: | H:

module2/exo1/cosxsx.png
module2/exo1/cosxsx.png
module2/exo1/cosxsx.png
module2/exo1/cosxsx.png
  • 2-up
  • Swipe
  • Onion skin
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Notebook Python R\n",
"\n",
"## Import des données dans Python"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Unnamed: 0</th>\n",
" <th>speed</th>\n",
" <th>dist</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>4</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>4</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>7</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>7</td>\n",
" <td>22</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>8</td>\n",
" <td>16</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Unnamed: 0 speed dist\n",
"0 1 4 2\n",
"1 2 4 10\n",
"2 3 7 4\n",
"3 4 7 22\n",
"4 5 8 16"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"# data_url = \"https://forge.scilab.org/index.php/p/rdataset/source/file/master/csv/datasets/cars.csv\"\n",
"data_url = \"cars.csv\"\n",
"df_python = pd.read_csv(data_url)\n",
"df_python.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Supression de la première colonne"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>speed</th>\n",
" <th>dist</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>4</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>4</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>7</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>7</td>\n",
" <td>22</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>8</td>\n",
" <td>16</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" speed dist\n",
"0 4 2\n",
"1 4 10\n",
"2 7 4\n",
"3 7 22\n",
"4 8 16"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_python.drop(df_python.columns[[0]], axis=1, inplace=True)\n",
"df_python.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Summary avec Python"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>speed</th>\n",
" <th>dist</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>50.000000</td>\n",
" <td>50.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>15.400000</td>\n",
" <td>42.980000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>5.287644</td>\n",
" <td>25.769377</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>4.000000</td>\n",
" <td>2.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>12.000000</td>\n",
" <td>26.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>15.000000</td>\n",
" <td>36.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>19.000000</td>\n",
" <td>56.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>25.000000</td>\n",
" <td>120.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" speed dist\n",
"count 50.000000 50.000000\n",
"mean 15.400000 42.980000\n",
"std 5.287644 25.769377\n",
"min 4.000000 2.000000\n",
"25% 12.000000 26.000000\n",
"50% 15.000000 36.000000\n",
"75% 19.000000 56.000000\n",
"max 25.000000 120.000000"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_python.describe()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Summary avec R"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from rpy2.robjects import pandas2ri\n",
"pandas2ri.activate()\n",
"from rpy2.robjects.packages import importr"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" speed dist \n",
" Min. : 4.0 Min. : 2.00 \n",
" 1st Qu.:12.0 1st Qu.: 26.00 \n",
" Median :15.0 Median : 36.00 \n",
" Mean :15.4 Mean : 42.98 \n",
" 3rd Qu.:19.0 3rd Qu.: 56.00 \n",
" Max. :25.0 Max. :120.00 \n",
"\n"
]
}
],
"source": [
"base = importr('base')\n",
"print(base.summary(df_python))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"ename": "RRuntimeError",
"evalue": "Error in loadNamespace(name) : there is no package called ‘prettyR’\n",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRRuntimeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-9-d7480842a7ea>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mprettyR\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mimportr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'prettyR'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprettyR\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdescribe\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf_python\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/opt/conda/lib/python3.6/site-packages/rpy2/robjects/packages.py\u001b[0m in \u001b[0;36mimportr\u001b[0;34m(name, lib_loc, robject_translations, signature_translation, suppress_messages, on_conflict, symbol_r2python, symbol_check_after, data)\u001b[0m\n\u001b[1;32m 451\u001b[0m if _package_has_namespace(rname, \n\u001b[1;32m 452\u001b[0m _system_file(package = rname)):\n\u001b[0;32m--> 453\u001b[0;31m \u001b[0menv\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_get_namespace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 454\u001b[0m \u001b[0mversion\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_get_namespace_version\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 455\u001b[0m \u001b[0mexported_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mset\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_get_namespace_exports\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mRRuntimeError\u001b[0m: Error in loadNamespace(name) : there is no package called ‘prettyR’\n"
]
}
],
"source": [
"prettyR = importr('prettyR')\n",
"print(prettyR.describe(df_python))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Liens utiles\n",
"\n",
"- http://rpy.sourceforge.net/rpy2/doc-2.4/html/introduction.html\n",
"- https://rpy2.readthedocs.io/en/version_2.8.x/"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Petit exemple de complétion"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"mu, sigma = 100, 15"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
" x = np.random.normal(loc=mu, scale=sigma, size=10000)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
" import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAD8CAYAAACRkhiPAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAEGVJREFUeJzt3X+s3XV9x/Hna1QZ/iDCWhi2zdqZugxIhtIxNrNFZZEqi8U/TEo26TKWGoKLLu5H0WS6P5qg80dCMlhwMMrmII3iaAJsIjEzJgheGFIKNlSpcKGj15lNtiVM8L0/zod4LOf2/r6H28/zkZyc73l/P9/z/bxz2776/Z7v99xUFZKkPv3MuCcgSRofQ0CSOmYISFLHDAFJ6pghIEkdMwQkqWOGgCR1zBCQpI4ZApLUsVXjnsBMVq9eXRs2bBj3NCRpRbn//vu/X1VrZhr3sg+BDRs2MDExMe5pSNKKkuR7sxnn6SBJ6pghIEkdMwQkqWOGgCR1zBCQpI4ZApLUM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"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
" %matplotlib inline\n",
"plt.hist(x)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
" %load_ext rpy2.ipython"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAeAAAAHgCAMAAABKCk6nAAAC9FBMVEUAAAABAQECAgIDAwMEBAQFBQUGBgYHBwcJCQkKCgoLCwsMDAwNDQ0ODg4PDw8QEBARERESEhITExMUFBQVFRUWFhYXFxcYGBgZGRkbGxscHBwdHR0eHh4fHx8gICAhISEiIiIjIyMkJCQlJSUmJiYnJycoKCgqKiorKyssLCwtLS0uLi4vLy8wMDAxMTEzMzM0NDQ1NTU2NjY3Nzc4ODg5OTk6Ojo7Ozs8PDw9PT0+Pj4/Pz9AQEBBQUFCQkJDQ0NERERFRUVGRkZHR0dISEhJSUlKSkpLS0tMTExNTU1OTk5PT09QUFBRUVFSUlJTU1NUVFRVVVVWVlZXV1dYWFhZWVlaWlpbW1tcXFxdXV1eXl5fX19gYGBhYWFiYmJjY2NkZGRlZWVmZmZnZ2doaGhpaWlqampra2tsbGxtbW1ubm5vb29wcHBxcXFycnJzc3N0dHR1dXV2dnZ3d3d4eHh5eXl6enp7e3t8fHx9fX1+fn5/f3+AgICBgYGCgoKDg4OEhISFhYWGhoaHh4eIiIiJiYmKioqLi4uMjIyNjY2Ojo6Pj4+QkJCRkZGSkpKTk5OUlJSVlZWWlpaXl5eYmJiZmZmampqbm5ucnJydnZ2enp6fn5+goKChoaGioqKjo6OkpKSlpaWmpqanp6eoqKipqamqqqqrq6usrKytra2urq6vr6+wsLCxsbGysrKzs7O0tLS1tbW2tra3t7e4uLi5ubm6urq7u7u8vLy9vb2+vr6/v7/AwMDBwcHCwsLDw8PExMTFxcXGxsbHx8fIyMjJycnKysrLy8vMzMzNzc3Ozs7Pz8/Q0NDR0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d+rdU/KH5xzvRVVVa7CDtHvPvpQ/EmuEfNq1JAuAC+wb//6YAt+s4Hcjso33/nVpUvVGnmcc70dVU2uuJNFHAgmDgQTB4KJA8HEgWDiQDBxIJg4EEwcCCYOBBMHgokDwcSBYOJAMHEgmDgQTBwIJg4EEweCiQPBbmQKGG9jNBDsBgRbnZJOf3miY9Hehv0d/0hnbE2jv8Rc+tfHO3X/NgGCLc6yOGfF4J2Z1daz9U+zMw8eZKlJtz+yap2r6AjBFmfHo2tvSkfiWoyVVb80O46xG78vvfUxsxVjGyHY6qTZa75cmFlP+une7En31qtXr9a5Wx8TuzK2F4KtT17M5Mz/cLKb1S4vqqzGeOtjRpL01xiCLc60MU5ntymZ96Sxz/7KLvwpm+3tf/vjQK2zZckQbHEuNX/siTY3Mp8a/HSDnYytbfTUczv+9ZHyyDMfPGF0gvwJLcGVULzcvSsQTBwIJk4oCg4pIJg4EEwcCCYOBBMHgokDwcSBYOJAMHEgmDgQTBwIJg4EEweCiQPBxIFg4vw/C6hxe08+0jwAAAAASUVORK5CYII=\n"
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%R\n",
"plot(cars)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "R",
"language": "R",
"name": "ir"
},
"language_info": {
"codemirror_mode": "r",
"file_extension": ".r",
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
"version": "3.4.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
---
title: "Your title"
author: "Your name"
date: "Today's date"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Some explanations
This is an R Markdown document that you can easily export to HTML, PDF, and MS Word formats. For more information on R Markdown, see <http://rmarkdown.rstudio.com>.
When you click on the button **Knit**, the document will be compiled in order to re-execute the R code and to include the results into the final document. As we have shown in the video, R code is inserted as follows:
```{r cars}
summary(cars)
```
It is also straightforward to include figures. For example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note the parameter `echo = FALSE` that indicates that the code will not appear in the final version of the document. We recommend not to use this parameter in the context of this MOOC, because we want your data analyses to be perfectly transparent and reproducible.
Since the results are not stored in Rmd files, you should generate an HTML or PDF version of your exercises and commit them. Otherwise reading and checking your analysis will be difficult for anyone else but you.
Now it's your turn! You can delete all this information and replace it by your computational document.
#+TITLE: Your title
#+AUTHOR: Your name
#+DATE: Today's date
#+LANGUAGE: en
# #+PROPERTY: header-args :eval never-export
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
* Some explanations
This is an org-mode document with code examples in R. Once opened in
Emacs, this document can easily be exported to HTML, PDF, and Office
formats. For more information on org-mode, see
https://orgmode.org/guide/.
When you type the shortcut =C-c C-e h o=, this document will be
exported as HTML. All the code in it will be re-executed, and the
results will be retrieved and included into the exported document. If
you do not want to re-execute all code each time, you can delete the #
and the space before ~#+PROPERTY:~ in the header of this document.
Like we showed in the video, R code is included as follows (and is
exxecuted by typing ~C-c C-c~):
#+begin_src R :results output :exports both
print("Hello world!")
#+end_src
#+RESULTS:
: [1] "Hello world!"
And now the same but in an R session. This is the most frequent
situation, because R is really an interactive language. With a
session, R's state, i.e. the values of all the variables, remains
persistent from one code block to the next. The code is still executed
using ~C-c C-c~.
#+begin_src R :results output :session *R* :exports both
summary(cars)
#+end_src
#+RESULTS:
: speed dist
: Min. : 4.0 Min. : 2.00
: 1st Qu.:12.0 1st Qu.: 26.00
: Median :15.0 Median : 36.00
: Mean :15.4 Mean : 42.98
: 3rd Qu.:19.0 3rd Qu.: 56.00
: Max. :25.0 Max. :120.00
Finally, an example for graphical output:
#+begin_src R :results output graphics :file "./cars.png" :exports results :width 600 :height 400 :session *R*
plot(cars)
#+end_src
#+RESULTS:
[[file:./cars.png]]
Note the parameter ~:exports results~, which indicates that the code
will not appear in the exported document. We recommend that in the
context of this MOOC, you always leave this parameter setting as
~:exports both~, because we want your analyses to be perfectly
transparent and reproducible.
Watch out: the figure generated by the code block is /not/ stored in
the org document. It's a plain file, here named ~cars.png~. You have
to commit it explicitly if you want your analysis to be legible and
understandable on GitLab.
Finally, don't forget that we provide in the resource section of this
MOOC a configuration with a few keyboard shortcuts that allow you to
quickly create code blocks in R by typing ~<r~ or ~<R~ followed by
~Tab~.
Now it's your turn! You can delete all this information and replace it
by your computational document.
#+TITLE: Votre titre
#+AUTHOR: Votre nom
#+DATE: La date du jour
#+LANGUAGE: fr
# #+PROPERTY: header-args :eval never-export
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
Content-Type: text/enriched
Text-Width: 100
<x-color><param>#73d216</param># -*- coding: utf-8-unix; mode: org; mode: auto-fill; fill-column: 100; -*-</x-color>
#+TITLE: <x-color><param>pale turquoise</param>Premier exercice
</x-color>#+AUTHOR: <x-color><param>pale turquoise</param>Mathieu Pouit
</x-color>#+DATE: <x-color><param>pale turquoise</param>2020-11-19
</x-color>#+LANGUAGE: fr
<x-color><param>#73d216</param># #+PROPERTY: header-args :eval never-export</x-color>
#+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: <<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"><</script>
#+HTML_HEAD: <<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
* Quelques explications
Ceci est un document org-mode avec quelques exemples de code
R. Une fois ouvert dans emacs, ce document peut aisément être
exporté au format HTML, PDF, et Office. Pour plus de détails sur
org-mode vous pouvez consulter https://orgmode.org/guide/.
Lorsque vous utiliserez le raccourci =C-c C-e h o=, ce document sera
compilé en html. Tout le code contenu sera ré-exécuté, les résultats
récupérés et inclus dans un document final. Si vous ne souhaitez pas
......@@ -25,25 +35,31 @@ ré-exécuter tout le code à chaque fois, il vous suffit de supprimer
le # et l'espace qui sont devant le ~#+PROPERTY:~ au début de ce
document.
Comme nous vous l'avons montré dans la vidéo, on inclut du code
R de la façon suivante (et on l'exécute en faisant ~C-c C-c~):
#+begin_src R :results output :exports both
print("Hello world!")
#+end_src
#+RESULTS:
: [1] "Hello world!"
Voici la même chose, mais avec une session R (c'est le cas le
plus courant, R étant vraiment un langage interactif), donc une
persistance d'un bloc à l'autre (et on l'exécute toujours en faisant
~C-c C-c~).
#+begin_src R :results output :session *R* :exports both
summary(cars)
#+end_src
#+RESULTS:
: speed dist
: Min. : 4.0 Min. : 2.00
......@@ -53,32 +69,39 @@ summary(cars)
: 3rd Qu.:19.0 3rd Qu.: 56.00
: Max. :25.0 Max. :120.00
Et enfin, voici un exemple de sortie graphique:
#+begin_src R :results output graphics :file "./cars.png" :exports results :width 600 :height 400 :session *R*
plot(cars)
#+end_src
#+RESULTS:
[[file:./cars.png]]
Vous remarquerez le paramètre ~:exports results~ qui indique que le code
ne doit pas apparaître dans la version finale du document. Nous vous
recommandons dans le cadre de ce MOOC de ne pas changer ce paramètre
(indiquer ~both~) car l'objectif est que vos analyses de données soient
parfaitement transparentes pour être reproductibles.
Attention, la figure ainsi générée n'est pas stockée dans le document
org. C'est un fichier ordinaire, ici nommé ~cars.png~. N'oubliez pas
de le committer si vous voulez que votre analyse soit lisible et
compréhensible sur GitLab.
Enfin, pour les prochains exercices, nous ne vous fournirons pas
forcément de fichier de départ, ça sera à vous de le créer, par
exemple en repartant de ce document et de le commiter vers
gitlab. N'oubliez pas que nous vous fournissons dans les ressources de
ce MOOC une configuration avec un certain nombre de raccourcis
claviers permettant de créer rapidement les blocs de code R (en
faisant ~<r~ ou ~<R~ suivi de ~Tab~).
faisant ~<<r~ ou ~<<R~ suivi de ~Tab~).
Maintenant, à vous de jouer! Vous pouvez effacer toutes ces
informations et les remplacer par votre document computationnel.
#+TITLE: Your title
#+AUTHOR: Your name
#+DATE: Today's date
#+LANGUAGE: en
# #+PROPERTY: header-args :eval never-export
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
* Some explanations
This is an org-mode document with code examples in R. Once opened in
Emacs, this document can easily be exported to HTML, PDF, and Office
formats. For more information on org-mode, see
https://orgmode.org/guide/.
When you type the shortcut =C-c C-e h o=, this document will be
exported as HTML. All the code in it will be re-executed, and the
results will be retrieved and included into the exported document. If
you do not want to re-execute all code each time, you can delete the #
and the space before ~#+PROPERTY:~ in the header of this document.
Like we showed in the video, Python code is included as follows (and
is exxecuted by typing ~C-c C-c~):
#+begin_src python :results output :exports both
print("Hello world!")
#+end_src
#+RESULTS:
: Hello world!
And now the same but in an Python session. With a session, Python's
state, i.e. the values of all the variables, remains persistent from
one code block to the next. The code is still executed using ~C-c
C-c~.
#+begin_src python :results output :session :exports both
import numpy
x=numpy.linspace(-15,15)
print(x)
#+end_src
#+RESULTS:
#+begin_example
[-15. -14.3877551 -13.7755102 -13.16326531 -12.55102041
-11.93877551 -11.32653061 -10.71428571 -10.10204082 -9.48979592
-8.87755102 -8.26530612 -7.65306122 -7.04081633 -6.42857143
-5.81632653 -5.20408163 -4.59183673 -3.97959184 -3.36734694
-2.75510204 -2.14285714 -1.53061224 -0.91836735 -0.30612245
0.30612245 0.91836735 1.53061224 2.14285714 2.75510204
3.36734694 3.97959184 4.59183673 5.20408163 5.81632653
6.42857143 7.04081633 7.65306122 8.26530612 8.87755102
9.48979592 10.10204082 10.71428571 11.32653061 11.93877551
12.55102041 13.16326531 13.7755102 14.3877551 15. ]
#+end_example
Finally, an example for graphical output:
#+begin_src python :results output file :session :var matplot_lib_filename="./cosxsx.png" :exports results
import matplotlib.pyplot as plt
plt.figure(figsize=(10,5))
plt.plot(x,numpy.cos(x)/x)
plt.tight_layout()
plt.savefig(matplot_lib_filename)
print(matplot_lib_filename)
#+end_src
#+RESULTS:
[[file:./cosxsx.png]]
Note the parameter ~:exports results~, which indicates that the code
will not appear in the exported document. We recommend that in the
context of this MOOC, you always leave this parameter setting as
~:exports both~, because we want your analyses to be perfectly
transparent and reproducible.
Watch out: the figure generated by the code block is /not/ stored in
the org document. It's a plain file, here named ~cosxsx.png~. You have
to commit it explicitly if you want your analysis to be legible and
understandable on GitLab.
Finally, don't forget that we provide in the resource section of this
MOOC a configuration with a few keyboard shortcuts that allow you to
quickly create code blocks in Python by typing ~<p~, ~<P~ or ~<PP~
followed by ~Tab~.
Now it's your turn! You can delete all this information and replace it
by your computational document.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr">
<head>
<!-- 2020-11-14 sam. 21:04 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Votre titre</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Votre nom" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/readtheorg.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://www.pirilampo.org/styles/lib/js/jquery.stickytableheaders.js"></script>
<script type="text/javascript" src="http://www.pirilampo.org/styles/readtheorg/js/readtheorg.js"></script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<h1 class="title">Votre titre</h1>
<div id="table-of-contents">
<h2>Table des matières</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org127ab2e">1. Quelques explications</a></li>
</ul>
</div>
</div>
<div id="outline-container-org127ab2e" class="outline-2">
<h2 id="org127ab2e"><span class="section-number-2">1</span> Quelques explications</h2>
<div class="outline-text-2" id="text-1">
<p>
Ceci est un document org-mode avec quelques exemples de code python. Une fois
ouvert dans emacs, ce document peut aisément être exporté au format HTML, PDF,
et Office. Pour plus de détails sur org-mode vous pouvez consulter
<a href="https://orgmode.org/guide/">https://orgmode.org/guide/</a>.
</p>
<p>
Lorsque vous utiliserez le raccourci <code>C-c C-e h o</code>, ce document sera compilé en
html. Tout le code contenu sera ré-exécuté, les résultats récupérés et inclus
dans un document final. Si vous ne souhaitez pas ré-exécuter tout le code à
chaque fois, il vous suffit de supprimer le # et l'espace qui sont devant le
<code>#+PROPERTY:</code> au début de ce document.
</p>
<p>
Comme nous vous l'avons montré dans la vidéo, on inclue du code
python de la façon suivante (et on l'exécute en faisant <code>C-c C-c</code>):
</p>
<p>
Il existe une <a href="https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html">aide spécifique sur l'exécution de Python dans Org-mode</a>. En
particulier, il faut indiquer que le programme python s'appelle <code>python3</code> sous
linux, pour ne pas confondre avec <code>python2</code> , qui avait pris jusqu'ici l'alias
<code>python</code> par défaut.
</p>
<div class="org-src-container">
<pre class="src src-python"><span style="color: #b4fa70;">print</span>(<span style="color: #e9b96e;">"Hello world!"</span>)
</pre>
</div>
<pre class="example">
Hello world!
</pre>
<p>
Voici la même chose, mais avec une session python, donc une
persistance d'un bloc à l'autre (et on l'exécute toujours en faisant
<code>C-c C-c</code>).
</p>
<div class="org-src-container">
<pre class="src src-python"><span style="color: #b4fa70;">import</span> numpy
<span style="color: #fcaf3e;">x</span>=numpy.linspace(-15,15)
<span style="color: #b4fa70;">print</span>(x)
</pre>
</div>
<pre class="example">
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
[-15. -14.3877551 -13.7755102 -13.16326531 -12.55102041
-11.93877551 -11.32653061 -10.71428571 -10.10204082 -9.48979592
-8.87755102 -8.26530612 -7.65306122 -7.04081633 -6.42857143
-5.81632653 -5.20408163 -4.59183673 -3.97959184 -3.36734694
-2.75510204 -2.14285714 -1.53061224 -0.91836735 -0.30612245
0.30612245 0.91836735 1.53061224 2.14285714 2.75510204
3.36734694 3.97959184 4.59183673 5.20408163 5.81632653
6.42857143 7.04081633 7.65306122 8.26530612 8.87755102
9.48979592 10.10204082 10.71428571 11.32653061 11.93877551
12.55102041 13.16326531 13.7755102 14.3877551 15. ]
</pre>
<p>
Et enfin, voici un exemple de sortie graphique:
</p>
<div class="figure">
<p><img src="./cosxsx.png" alt="cosxsx.png" />
</p>
</div>
<p>
Vous remarquerez le paramètre <code>:exports results</code> qui indique que le code
ne doit pas apparaître dans la version finale du document. Nous vous
recommandons dans le cadre de ce MOOC de ne pas changer ce paramètre
(indiquer <code>both</code>) car l'objectif est que vos analyses de données soient
parfaitement transparentes pour être reproductibles.
</p>
<p>
Attention, la figure ainsi générée n'est pas stockée dans le document
org. C'est un fichier ordinaire, ici nommé <code>cosxsx.png</code>. N'oubliez pas
de le committer si vous voulez que votre analyse soit lisible et
compréhensible sur GitLab.
</p>
<p>
Enfin, n'oubliez pas que nous vous fournissons dans les ressources de
ce MOOC une configuration avec un certain nombre de raccourcis
claviers permettant de créer rapidement les blocs de code python (en
faisant <code>&lt;p</code>, <code>&lt;P</code> ou <code>&lt;PP</code> suivi de <code>Tab</code>).
</p>
<p>
Maintenant, à vous de jouer! Vous pouvez effacer toutes ces
informations et les remplacer par votre document computationnel.
</p>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="date">Date: La date du jour</p>
<p class="author">Auteur: Votre nom</p>
<p class="date">Created: 2020-11-14 sam. 21:04</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>
# -*- coding: utf-8-unix; mode:org; mode: auto-fill; fill-column: 80; -*-
#+TITLE: Votre titre
#+AUTHOR: Votre nom
#+DATE: La date du jour
#+STARTUP: showall
#+STARTUP: hidestars
#+LANGUAGE: fr
# #+PROPERTY: header-args :eval never-export
#+PROPERTY: header-args :eval never-export
#+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"/>
......@@ -13,22 +19,26 @@
* Quelques explications
Ceci est un document org-mode avec quelques exemples de code
python. Une fois ouvert dans emacs, ce document peut aisément être
exporté au format HTML, PDF, et Office. Pour plus de détails sur
org-mode vous pouvez consulter https://orgmode.org/guide/.
Ceci est un document org-mode avec quelques exemples de code python. Une fois
ouvert dans emacs, ce document peut aisément être exporté au format HTML, PDF,
et Office. Pour plus de détails sur org-mode vous pouvez consulter
https://orgmode.org/guide/.
Lorsque vous utiliserez le raccourci =C-c C-e h o=, ce document sera
compilé en html. Tout le code contenu sera ré-exécuté, les résultats
récupérés et inclus dans un document final. Si vous ne souhaitez pas
ré-exécuter tout le code à chaque fois, il vous suffit de supprimer
le # et l'espace qui sont devant le ~#+PROPERTY:~ au début de ce
document.
Lorsque vous utiliserez le raccourci =C-c C-e h o=, ce document sera compilé en
html. Tout le code contenu sera ré-exécuté, les résultats récupérés et inclus
dans un document final. Si vous ne souhaitez pas ré-exécuter tout le code à
chaque fois, il vous suffit de supprimer le # et l'espace qui sont devant le
~#+PROPERTY:~ au début de ce document.
Comme nous vous l'avons montré dans la vidéo, on inclue du code
python de la façon suivante (et on l'exécute en faisant ~C-c C-c~):
#+begin_src python :results output :exports both
Il existe une [[https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html][aide spécifique sur l'exécution de Python dans Org-mode]]. En
particulier, il faut indiquer que le programme python s'appelle ~python3~ sous
linux, pour ne pas confondre avec ~python2~ , qui avait pris jusqu'ici l'alias
~python~ par défaut.
#+begin_src python :results output :exports both :python python3
print("Hello world!")
#+end_src
......@@ -38,7 +48,7 @@ print("Hello world!")
Voici la même chose, mais avec une session python, donc une
persistance d'un bloc à l'autre (et on l'exécute toujours en faisant
~C-c C-c~).
#+begin_src python :results output :session :exports both
#+begin_src python :results output :session :exports both :python python3
import numpy
x=numpy.linspace(-15,15)
print(x)
......@@ -46,6 +56,9 @@ print(x)
#+RESULTS:
#+begin_example
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
[-15. -14.3877551 -13.7755102 -13.16326531 -12.55102041
-11.93877551 -11.32653061 -10.71428571 -10.10204082 -9.48979592
-8.87755102 -8.26530612 -7.65306122 -7.04081633 -6.42857143
......@@ -59,7 +72,7 @@ print(x)
#+end_example
Et enfin, voici un exemple de sortie graphique:
#+begin_src python :results output file :session :var matplot_lib_filename="./cosxsx.png" :exports results
#+begin_src python :results output file :session :var matplot_lib_filename="./cosxsx.png" :exports results :python python3
import matplotlib.pyplot as plt
plt.figure(figsize=(10,5))
......@@ -73,6 +86,7 @@ print(matplot_lib_filename)
#+RESULTS:
[[file:./cosxsx.png]]
Vous remarquerez le paramètre ~:exports results~ qui indique que le code
ne doit pas apparaître dans la version finale du document. Nous vous
recommandons dans le cadre de ce MOOC de ne pas changer ce paramètre
......
{
"cells": [],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"cells": [],
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# toy_notbook_fr "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"March 28, 2019"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## À propos du calcul de $\\pi$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### En démandant à la lib maths "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Mon ordinateur m'indique de $\\pi$ vaut *approximativement*"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3.141592653589793\n"
]
}
],
"source": [
"from math import *\n",
"print(pi)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### En utilisant la méthode des aiguilles de Buffon"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Mais calculé avec la **méthode** des [aiguilles de Buffon](https://fr.wikipedia.org/wiki/Aiguille_de_Buffon), on obtiendrait comme **approximation**"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.144654088050314"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"np.random.seed(seed=42)\n",
"N = 1000\n",
"x = np.random.uniform(size=N, low=0, high=1)\n",
"theta = np.random.uniform(size=N, low=0, high=pi/2)\n",
"2/(sum((x+np.sin(theta))>1)/N)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Avec un argument \"fréquentiel\" de surface"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Sinon, une méthode plus simple à comprendre et ne faisant pas intervenir d'appel à la fonction sinus se base sur le fait que si $X \\sim U(0,1)$ et $Y \\sim U(0,1)$ alors $P[X^2 + Y^2] = \\pi/4$ (voir méthode Monte Carlo sur Wikipédia). Le code suivant illustre ce fait."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAP4AAAD4CAYAAADMz1tMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Il7ecAAAACXBIWXMAAAsTAAALEwEAmpwYAACUa0lEQVR4nO29eXBc2Xkf+t1GYwcajUZjaQINYmFzCBAkhyQ4mM0zI2k4M5bikRwrtpa45NgvKudJqryX91KVl7z4uZx/nKScKsdREus5enZUsuWlyhPaGodDSjMceRaK4DIz4IYmQGIjQCyNxt5AN3DfHz9+c06fPnfpRoPTNPFVsUA0bt977jnn+863/j7DNE3apV3apUeLPJ/0AHZpl3bpwdMu4+/SLj2CtMv4u7RLjyDtMv4u7dIjSLuMv0u79AiS95N6cDAYNNva2j6px+/SLv2dp4sXL86aplmv+9snxvhtbW3U39//ST1+l3bp7zwZhjFi9bddVX+XdukRpF3G36VdegRpl/F3aZceQdpl/F3apUeQdhl/l3bpESRHr75hGN8lor9HRNOmafZo/m4Q0e8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gPbDhXCiZ8NmCdjAGrBPD+hsZFhGC8S0b8ioldN01x/AONichpfNRH1ENFbhmHcIdiBpx6gg8/N/I0T0SnTNJOmad4m4Ds+KMBpN+P7NSL6MyIi0zTfI6IyQpFMIZCr/amlB+WosHFgeIlomIjaSThYDirXfIPSnXt/VkBjO0pwEEUKce6U69+iB+vcczN/rxDRH93/f5CgutYV0Pj+hoh+5f7/uwg2vvEA57CNrJ17n6N0595PXd/3Qb2Aw8t9liDph4joX93/7LcIJygRpOyfE9EtIvopEXUU0NjOEtE9Irpy/9+pQpo75doHyvgu588gmCPXiOgjIvpSgY2vm4jeuS8UrhDRSw9wbH9CRJNElCRoRr9GRL9ORL8uzd2374/9o2zWdjdld5d26RGkQrDxd2mXdukB0y7j79IuPYK0y/i7tEuPIO0y/i7t0iNIu4y/S7v0CNIu4+/SLj2CtMv4u7RLjyD9//1iHnO2ZPFRAAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"\n",
"np.random.seed(seed=42)\n",
"N = 1000\n",
"x = np.random.uniform(size=N, low=0, high=1)\n",
"y = np.random.uniform(size=N, low=0, high=1)\n",
"accept = (x*x+y*y) <= 1\n",
"reject = np.logical_not(accept)\n",
"\n",
"fig, ax = plt.subplots(1)\n",
"ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None)\n",
"ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)\n",
"ax.set_aspect('equal')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Il est alors aisé d'obtenir une approximation (pas terrible) de $\\pi$ en comptant combien de fois en moyenne, $X^2 + Y^2$ est inférieur à 1 :"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.112"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"4*np.mean(accept)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
......@@ -16,10 +192,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
#!/usr/bin/env python
# coding: utf-8
# # toy_notbook_fr
# March 28, 2019
# ## À propos du calcul de $\pi$
# ### En démandant à la lib maths
# Mon ordinateur m'indique de $\pi$ vaut *approximativement*
# In[1]:
from math import *
print(pi)
# ### En utilisant la méthode des aiguilles de Buffon
# Mais calculé avec la méthode des aiguilles de Buffon, on obtiendrait
# In[2]:
import numpy as np
np.random.seed(seed=42)
N = 1000
x = np.random.uniform(size=N, low=0, high=1)
theta = np.random.uniform(size=N, low=0, high=pi/2)
2/(sum((x+np.sin(theta))>1)/N)
# ### Avec un argument "fréquentiel" de surface
# Sinon, une méthode plus simple à comprendre et ne faisant pas intervenir d'appel à la fonction sinus se base sur le fait que si $X \sim U(0,1)$ et $Y \sim U(0,1)$ alors $P[X^2 + Y^2] = \pi/4$ (voir méthode Monte Carlo sur Wikipédia). Le code suivant illustre ce fait.
# In[5]:
get_ipython().run_line_magic('matplotlib', 'inline')
import matplotlib.pyplot as plt
np.random.seed(seed=42)
N = 1000
x = np.random.uniform(size=N, low=0, high=1)
y = np.random.uniform(size=N, low=0, high=1)
accept = (x*x+y*y) <= 1
reject = np.logical_not(accept)
fig, ax = plt.subplots(1)
ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None)
ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)
ax.set_aspect('equal')
# Il est alors aisé d'obtenir une approximation (pas terrible) de $\pi$ en comptant combien de fois en moyenne, $X^2 + Y^2$ est inférieur à 1 :
# In[6]:
4*np.mean(accept)
# In[ ]:
#+TITLE: Your title
#+AUTHOR: Your name
#+DATE: Today's date
#+LANGUAGE: en
# #+PROPERTY: header-args :eval never-export
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
* Some explanations
This is an org-mode document with code examples in R. Once opened in
Emacs, this document can easily be exported to HTML, PDF, and Office
formats. For more information on org-mode, see
https://orgmode.org/guide/.
When you type the shortcut =C-c C-e h o=, this document will be
exported as HTML. All the code in it will be re-executed, and the
results will be retrieved and included into the exported document. If
you do not want to re-execute all code each time, you can delete the #
and the space before ~#+PROPERTY:~ in the header of this document.
Like we showed in the video, R code is included as follows (and is
exxecuted by typing ~C-c C-c~):
#+begin_src R :results output :exports both
print("Hello world!")
#+end_src
#+RESULTS:
: [1] "Hello world!"
And now the same but in an R session. This is the most frequent
situation, because R is really an interactive language. With a
session, R's state, i.e. the values of all the variables, remains
persistent from one code block to the next. The code is still executed
using ~C-c C-c~.
#+begin_src R :results output :session *R* :exports both
summary(cars)
#+end_src
#+RESULTS:
: speed dist
: Min. : 4.0 Min. : 2.00
: 1st Qu.:12.0 1st Qu.: 26.00
: Median :15.0 Median : 36.00
: Mean :15.4 Mean : 42.98
: 3rd Qu.:19.0 3rd Qu.: 56.00
: Max. :25.0 Max. :120.00
Finally, an example for graphical output:
#+begin_src R :results output graphics :file "./cars.png" :exports results :width 600 :height 400 :session *R*
plot(cars)
#+end_src
#+RESULTS:
[[file:./cars.png]]
Note the parameter ~:exports results~, which indicates that the code
will not appear in the exported document. We recommend that in the
context of this MOOC, you always leave this parameter setting as
~:exports both~, because we want your analyses to be perfectly
transparent and reproducible.
Watch out: the figure generated by the code block is /not/ stored in
the org document. It's a plain file, here named ~cars.png~. You have
to commit it explicitly if you want your analysis to be legible and
understandable on GitLab.
Finally, don't forget that we provide in the resource section of this
MOOC a configuration with a few keyboard shortcuts that allow you to
quickly create code blocks in R by typing ~<r~ or ~<R~ followed by
~Tab~.
Now it's your turn! You can delete all this information and replace it
by your computational document.
---
title: "Your title"
author: "Your name"
date: "Today's date"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Some explanations
This is an R Markdown document that you can easily export to HTML, PDF, and MS Word formats. For more information on R Markdown, see <http://rmarkdown.rstudio.com>.
When you click on the button **Knit**, the document will be compiled in order to re-execute the R code and to include the results into the final document. As we have shown in the video, R code is inserted as follows:
```{r cars}
summary(cars)
```
It is also straightforward to include figures. For example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note the parameter `echo = FALSE` that indicates that the code will not appear in the final version of the document. We recommend not to use this parameter in the context of this MOOC, because we want your data analyses to be perfectly transparent and reproducible.
Since the results are not stored in Rmd files, you should generate an HTML or PDF version of your exercises and commit them. Otherwise reading and checking your analysis will be difficult for anyone else but you.
Now it's your turn! You can delete all this information and replace it by your computational document.
{
"cells": [],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
#+TITLE: Your title
#+AUTHOR: Your name
#+DATE: Today's date
#+LANGUAGE: en
# #+PROPERTY: header-args :eval never-export
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
* Some explanations
This is an org-mode document with code examples in R. Once opened in
Emacs, this document can easily be exported to HTML, PDF, and Office
formats. For more information on org-mode, see
https://orgmode.org/guide/.
When you type the shortcut =C-c C-e h o=, this document will be
exported as HTML. All the code in it will be re-executed, and the
results will be retrieved and included into the exported document. If
you do not want to re-execute all code each time, you can delete the #
and the space before ~#+PROPERTY:~ in the header of this document.
Like we showed in the video, Python code is included as follows (and
is exxecuted by typing ~C-c C-c~):
#+begin_src python :results output :exports both
print("Hello world!")
#+end_src
#+RESULTS:
: Hello world!
And now the same but in an Python session. With a session, Python's
state, i.e. the values of all the variables, remains persistent from
one code block to the next. The code is still executed using ~C-c
C-c~.
#+begin_src python :results output :session :exports both
import numpy
x=numpy.linspace(-15,15)
print(x)
#+end_src
#+RESULTS:
#+begin_example
[-15. -14.3877551 -13.7755102 -13.16326531 -12.55102041
-11.93877551 -11.32653061 -10.71428571 -10.10204082 -9.48979592
-8.87755102 -8.26530612 -7.65306122 -7.04081633 -6.42857143
-5.81632653 -5.20408163 -4.59183673 -3.97959184 -3.36734694
-2.75510204 -2.14285714 -1.53061224 -0.91836735 -0.30612245
0.30612245 0.91836735 1.53061224 2.14285714 2.75510204
3.36734694 3.97959184 4.59183673 5.20408163 5.81632653
6.42857143 7.04081633 7.65306122 8.26530612 8.87755102
9.48979592 10.10204082 10.71428571 11.32653061 11.93877551
12.55102041 13.16326531 13.7755102 14.3877551 15. ]
#+end_example
Finally, an example for graphical output:
#+begin_src python :results output file :session :var matplot_lib_filename="./cosxsx.png" :exports results
import matplotlib.pyplot as plt
plt.figure(figsize=(10,5))
plt.plot(x,numpy.cos(x)/x)
plt.tight_layout()
plt.savefig(matplot_lib_filename)
print(matplot_lib_filename)
#+end_src
#+RESULTS:
[[file:./cosxsx.png]]
Note the parameter ~:exports results~, which indicates that the code
will not appear in the exported document. We recommend that in the
context of this MOOC, you always leave this parameter setting as
~:exports both~, because we want your analyses to be perfectly
transparent and reproducible.
Watch out: the figure generated by the code block is /not/ stored in
the org document. It's a plain file, here named ~cosxsx.png~. You have
to commit it explicitly if you want your analysis to be legible and
understandable on GitLab.
Finally, don't forget that we provide in the resource section of this
MOOC a configuration with a few keyboard shortcuts that allow you to
quickly create code blocks in Python by typing ~<p~, ~<P~ or ~<PP~
followed by ~Tab~.
Now it's your turn! You can delete all this information and replace it
by your computational document.
#+TITLE: Votre titre
#+AUTHOR: Votre nom
#+DATE: La date du jour
# -*- coding: utf-8-unix; mode: org; mode: auto-fill; fill-column: 100; -*-
#+TITLE: Module 2 Exercice 2 : première lignes de Python sous Emacs
#+AUTHOR: Mathieu Pouit
#+DATE: 19.11.2020
#+LANGUAGE: fr
# #+PROPERTY: header-args :eval never-export
......@@ -28,7 +30,7 @@ document.
Comme nous vous l'avons montré dans la vidéo, on inclue du code
python de la façon suivante (et on l'exécute en faisant ~C-c C-c~):
#+begin_src python :results output :exports both
#+begin_src python :results output :exports both :python python3
print("Hello world!")
#+end_src
......@@ -38,7 +40,7 @@ print("Hello world!")
Voici la même chose, mais avec une session python, donc une
persistance d'un bloc à l'autre (et on l'exécute toujours en faisant
~C-c C-c~).
#+begin_src python :results output :session :exports both
#+begin_src python :results output :session :exports both :python python3
import numpy
x=numpy.linspace(-15,15)
print(x)
......@@ -59,7 +61,7 @@ print(x)
#+end_example
Et enfin, voici un exemple de sortie graphique:
#+begin_src python :results output file :session :var matplot_lib_filename="./cosxsx.png" :exports results
#+begin_src python :results output file :session :var matplot_lib_filename="./cosxsx.png" :exports results :python python3
import matplotlib.pyplot as plt
plt.figure(figsize=(10,5))
......@@ -91,3 +93,34 @@ faisant ~<p~, ~<P~ ou ~<PP~ suivi de ~Tab~).
Maintenant, à vous de jouer! Vous pouvez effacer toutes ces
informations et les remplacer par votre document computationnel.
* Mon exercice en Python
#+begin_src python :results output :exports both :python python3 :session
import numpy as np
data = np.array([14.0, 7.6, 11.2, 12.8, 12.5, 9.9, 14.9, 9.4, 16.9, 10.2, 14.9, 18.1, 7.3, 9.8,
10.9,12.2, 9.9, 2.9, 2.8, 15.4, 15.7, 9.7, 13.1, 13.2, 12.3, 11.7, 16.0, 12.4, 17.9, 12.2, 16.2,
18.7, 8.9, 11.9, 12.1, 14.6, 12.1, 4.7, 3.9, 16.9, 16.8, 11.3, 14.4, 15.7, 14.0, 13.6, 18.0, 13.6,
19.9, 13.7, 17.0, 20.5, 9.9, 12.5, 13.2, 16.1, 13.5, 6.3, 6.4, 17.6, 19.1, 12.8, 15.5, 16.3, 15.2,
14.6, 19.1, 14.4, 21.4, 15.1, 19.6, 21.7, 11.3, 15.0, 14.3, 16.8, 14.0, 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, 8.9, 21.0])
print('la moyenne est : %5.3f' % np.mean(data))
print('le minimum est : %3.1f' % np.min(data))
print('le maximum est : %3.1f' % np.max(data))
print('la médiane est : %5.3f' % np.median(data))
print('l\'écart type est : %5.3f' % np.std(data, ddof=1))
#+end_src
#+RESULTS:
: la moyenne est : 14.113
: le minimum est : 2.8
: le maximum est : 23.4
: la médiane est : 14.500
: l'écart type est : 4.334
#+TITLE: Your title
#+AUTHOR: Your name
#+DATE: Today's date
#+LANGUAGE: en
# #+PROPERTY: header-args :eval never-export
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
* Some explanations
This is an org-mode document with code examples in R. Once opened in
Emacs, this document can easily be exported to HTML, PDF, and Office
formats. For more information on org-mode, see
https://orgmode.org/guide/.
When you type the shortcut =C-c C-e h o=, this document will be
exported as HTML. All the code in it will be re-executed, and the
results will be retrieved and included into the exported document. If
you do not want to re-execute all code each time, you can delete the #
and the space before ~#+PROPERTY:~ in the header of this document.
Like we showed in the video, R code is included as follows (and is
exxecuted by typing ~C-c C-c~):
#+begin_src R :results output :exports both
print("Hello world!")
#+end_src
#+RESULTS:
: [1] "Hello world!"
And now the same but in an R session. This is the most frequent
situation, because R is really an interactive language. With a
session, R's state, i.e. the values of all the variables, remains
persistent from one code block to the next. The code is still executed
using ~C-c C-c~.
#+begin_src R :results output :session *R* :exports both
summary(cars)
#+end_src
#+RESULTS:
: speed dist
: Min. : 4.0 Min. : 2.00
: 1st Qu.:12.0 1st Qu.: 26.00
: Median :15.0 Median : 36.00
: Mean :15.4 Mean : 42.98
: 3rd Qu.:19.0 3rd Qu.: 56.00
: Max. :25.0 Max. :120.00
Finally, an example for graphical output:
#+begin_src R :results output graphics :file "./cars.png" :exports results :width 600 :height 400 :session *R*
plot(cars)
#+end_src
#+RESULTS:
[[file:./cars.png]]
Note the parameter ~:exports results~, which indicates that the code
will not appear in the exported document. We recommend that in the
context of this MOOC, you always leave this parameter setting as
~:exports both~, because we want your analyses to be perfectly
transparent and reproducible.
Watch out: the figure generated by the code block is /not/ stored in
the org document. It's a plain file, here named ~cars.png~. You have
to commit it explicitly if you want your analysis to be legible and
understandable on GitLab.
Finally, don't forget that we provide in the resource section of this
MOOC a configuration with a few keyboard shortcuts that allow you to
quickly create code blocks in R by typing ~<r~ or ~<R~ followed by
~Tab~.
Now it's your turn! You can delete all this information and replace it
by your computational document.
---
title: "Your title"
author: "Your name"
date: "Today's date"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Some explanations
This is an R Markdown document that you can easily export to HTML, PDF, and MS Word formats. For more information on R Markdown, see <http://rmarkdown.rstudio.com>.
When you click on the button **Knit**, the document will be compiled in order to re-execute the R code and to include the results into the final document. As we have shown in the video, R code is inserted as follows:
```{r cars}
summary(cars)
```
It is also straightforward to include figures. For example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note the parameter `echo = FALSE` that indicates that the code will not appear in the final version of the document. We recommend not to use this parameter in the context of this MOOC, because we want your data analyses to be perfectly transparent and reproducible.
Since the results are not stored in Rmd files, you should generate an HTML or PDF version of your exercises and commit them. Otherwise reading and checking your analysis will be difficult for anyone else but you.
Now it's your turn! You can delete all this information and replace it by your computational document.
{
"cells": [],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
#+TITLE: Your title
#+AUTHOR: Your name
#+DATE: Today's date
#+LANGUAGE: en
# #+PROPERTY: header-args :eval never-export
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
* Some explanations
This is an org-mode document with code examples in R. Once opened in
Emacs, this document can easily be exported to HTML, PDF, and Office
formats. For more information on org-mode, see
https://orgmode.org/guide/.
When you type the shortcut =C-c C-e h o=, this document will be
exported as HTML. All the code in it will be re-executed, and the
results will be retrieved and included into the exported document. If
you do not want to re-execute all code each time, you can delete the #
and the space before ~#+PROPERTY:~ in the header of this document.
Like we showed in the video, Python code is included as follows (and
is exxecuted by typing ~C-c C-c~):
#+begin_src python :results output :exports both
print("Hello world!")
#+end_src
#+RESULTS:
: Hello world!
And now the same but in an Python session. With a session, Python's
state, i.e. the values of all the variables, remains persistent from
one code block to the next. The code is still executed using ~C-c
C-c~.
#+begin_src python :results output :session :exports both
import numpy
x=numpy.linspace(-15,15)
print(x)
#+end_src
#+RESULTS:
#+begin_example
[-15. -14.3877551 -13.7755102 -13.16326531 -12.55102041
-11.93877551 -11.32653061 -10.71428571 -10.10204082 -9.48979592
-8.87755102 -8.26530612 -7.65306122 -7.04081633 -6.42857143
-5.81632653 -5.20408163 -4.59183673 -3.97959184 -3.36734694
-2.75510204 -2.14285714 -1.53061224 -0.91836735 -0.30612245
0.30612245 0.91836735 1.53061224 2.14285714 2.75510204
3.36734694 3.97959184 4.59183673 5.20408163 5.81632653
6.42857143 7.04081633 7.65306122 8.26530612 8.87755102
9.48979592 10.10204082 10.71428571 11.32653061 11.93877551
12.55102041 13.16326531 13.7755102 14.3877551 15. ]
#+end_example
Finally, an example for graphical output:
#+begin_src python :results output file :session :var matplot_lib_filename="./cosxsx.png" :exports results
import matplotlib.pyplot as plt
plt.figure(figsize=(10,5))
plt.plot(x,numpy.cos(x)/x)
plt.tight_layout()
plt.savefig(matplot_lib_filename)
print(matplot_lib_filename)
#+end_src
#+RESULTS:
[[file:./cosxsx.png]]
Note the parameter ~:exports results~, which indicates that the code
will not appear in the exported document. We recommend that in the
context of this MOOC, you always leave this parameter setting as
~:exports both~, because we want your analyses to be perfectly
transparent and reproducible.
Watch out: the figure generated by the code block is /not/ stored in
the org document. It's a plain file, here named ~cosxsx.png~. You have
to commit it explicitly if you want your analysis to be legible and
understandable on GitLab.
Finally, don't forget that we provide in the resource section of this
MOOC a configuration with a few keyboard shortcuts that allow you to
quickly create code blocks in Python by typing ~<p~, ~<P~ or ~<PP~
followed by ~Tab~.
Now it's your turn! You can delete all this information and replace it
by your computational document.
#+TITLE: Votre titre
#+AUTHOR: Votre nom
#+DATE: La date du jour
# -*- coding: utf-8-unix; mode: org; mode: auto-fill; fill-column: 100; -*-
#+TITLE: Module 2 Exercice 3 : premier graphique avec Python
#+AUTHOR: Mathieu Pouit
#+DATE: 19.11.2020
#+LANGUAGE: fr
# #+PROPERTY: header-args :eval never-export
......@@ -91,3 +93,65 @@ faisant ~<p~, ~<P~ ou ~<PP~ suivi de ~Tab~).
Maintenant, à vous de jouer! Vous pouvez effacer toutes ces
informations et les remplacer par votre document computationnel.
* mon exercice de génération de courbe
#+begin_src shell :results output :exports both
pwd
#+end_src
#+RESULTS:
: /home/mathieu/Qsync/informatique/rechercheReproductible/mooc-rr/module2/exo3
#+begin_src python :results output file :session :var matplot_lib_filename="./sequencePlot.png" :exports results :python python3
import numpy as np
import matplotlib.pyplot as plt
data = np.array([14.0, 7.6, 11.2, 12.8, 12.5, 9.9, 14.9, 9.4, 16.9, 10.2, 14.9, 18.1, 7.3, 9.8,
10.9,12.2, 9.9, 2.9, 2.8, 15.4, 15.7, 9.7, 13.1, 13.2, 12.3, 11.7, 16.0, 12.4, 17.9, 12.2, 16.2,
18.7, 8.9, 11.9, 12.1, 14.6, 12.1, 4.7, 3.9, 16.9, 16.8, 11.3, 14.4, 15.7, 14.0, 13.6, 18.0, 13.6,
19.9, 13.7, 17.0, 20.5, 9.9, 12.5, 13.2, 16.1, 13.5, 6.3, 6.4, 17.6, 19.1, 12.8, 15.5, 16.3, 15.2,
14.6, 19.1, 14.4, 21.4, 15.1, 19.6, 21.7, 11.3, 15.0, 14.3, 16.8, 14.0, 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, 8.9, 21.0])
fig=plt.figure(figsize=(3,2))
plt.plot(data)
plt.savefig(matplot_lib_filename)
print(matplot_lib_filename)
fig.tight_layout()
#+end_src
#+RESULTS:
[[file:./sequencePlot.png]]
#+begin_src python :results output file :session :var matplot_lib_filename="./histogram.png" :exports results :python python3
import numpy as np
import matplotlib.pyplot as plt
data = np.array([14.0, 7.6, 11.2, 12.8, 12.5, 9.9, 14.9, 9.4, 16.9, 10.2, 14.9, 18.1, 7.3, 9.8,
10.9,12.2, 9.9, 2.9, 2.8, 15.4, 15.7, 9.7, 13.1, 13.2, 12.3, 11.7, 16.0, 12.4, 17.9, 12.2, 16.2,
18.7, 8.9, 11.9, 12.1, 14.6, 12.1, 4.7, 3.9, 16.9, 16.8, 11.3, 14.4, 15.7, 14.0, 13.6, 18.0, 13.6,
19.9, 13.7, 17.0, 20.5, 9.9, 12.5, 13.2, 16.1, 13.5, 6.3, 6.4, 17.6, 19.1, 12.8, 15.5, 16.3, 15.2,
14.6, 19.1, 14.4, 21.4, 15.1, 19.6, 21.7, 11.3, 15.0, 14.3, 16.8, 14.0, 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, 8.9, 21.0])
fig=plt.figure(figsize=(3,2))
plt.hist(data)
plt.savefig(matplot_lib_filename)
print(matplot_lib_filename)
fig.tight_layout()
#+end_src
#+RESULTS:
[[file:./histogram.png]]
#+TITLE: Your title
#+AUTHOR: Your name
#+DATE: Today's date
#+LANGUAGE: en
# #+PROPERTY: header-args :eval never-export
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
* Some explanations
This is an org-mode document with code examples in R. Once opened in
Emacs, this document can easily be exported to HTML, PDF, and Office
formats. For more information on org-mode, see
https://orgmode.org/guide/.
When you type the shortcut =C-c C-e h o=, this document will be
exported as HTML. All the code in it will be re-executed, and the
results will be retrieved and included into the exported document. If
you do not want to re-execute all code each time, you can delete the #
and the space before ~#+PROPERTY:~ in the header of this document.
Like we showed in the video, R code is included as follows (and is
exxecuted by typing ~C-c C-c~):
#+begin_src R :results output :exports both
print("Hello world!")
#+end_src
#+RESULTS:
: [1] "Hello world!"
And now the same but in an R session. This is the most frequent
situation, because R is really an interactive language. With a
session, R's state, i.e. the values of all the variables, remains
persistent from one code block to the next. The code is still executed
using ~C-c C-c~.
#+begin_src R :results output :session *R* :exports both
summary(cars)
#+end_src
#+RESULTS:
: speed dist
: Min. : 4.0 Min. : 2.00
: 1st Qu.:12.0 1st Qu.: 26.00
: Median :15.0 Median : 36.00
: Mean :15.4 Mean : 42.98
: 3rd Qu.:19.0 3rd Qu.: 56.00
: Max. :25.0 Max. :120.00
Finally, an example for graphical output:
#+begin_src R :results output graphics :file "./cars.png" :exports results :width 600 :height 400 :session *R*
plot(cars)
#+end_src
#+RESULTS:
[[file:./cars.png]]
Note the parameter ~:exports results~, which indicates that the code
will not appear in the exported document. We recommend that in the
context of this MOOC, you always leave this parameter setting as
~:exports both~, because we want your analyses to be perfectly
transparent and reproducible.
Watch out: the figure generated by the code block is /not/ stored in
the org document. It's a plain file, here named ~cars.png~. You have
to commit it explicitly if you want your analysis to be legible and
understandable on GitLab.
Finally, don't forget that we provide in the resource section of this
MOOC a configuration with a few keyboard shortcuts that allow you to
quickly create code blocks in R by typing ~<r~ or ~<R~ followed by
~Tab~.
Now it's your turn! You can delete all this information and replace it
by your computational document.
---
title: "Your title"
author: "Your name"
date: "Today's date"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Some explanations
This is an R Markdown document that you can easily export to HTML, PDF, and MS Word formats. For more information on R Markdown, see <http://rmarkdown.rstudio.com>.
When you click on the button **Knit**, the document will be compiled in order to re-execute the R code and to include the results into the final document. As we have shown in the video, R code is inserted as follows:
```{r cars}
summary(cars)
```
It is also straightforward to include figures. For example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note the parameter `echo = FALSE` that indicates that the code will not appear in the final version of the document. We recommend not to use this parameter in the context of this MOOC, because we want your data analyses to be perfectly transparent and reproducible.
Since the results are not stored in Rmd files, you should generate an HTML or PDF version of your exercises and commit them. Otherwise reading and checking your analysis will be difficult for anyone else but you.
Now it's your turn! You can delete all this information and replace it by your computational document.
{
"cells": [],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
#+TITLE: Your title
#+AUTHOR: Your name
#+DATE: Today's date
#+LANGUAGE: en
# #+PROPERTY: header-args :eval never-export
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
* Some explanations
This is an org-mode document with code examples in R. Once opened in
Emacs, this document can easily be exported to HTML, PDF, and Office
formats. For more information on org-mode, see
https://orgmode.org/guide/.
When you type the shortcut =C-c C-e h o=, this document will be
exported as HTML. All the code in it will be re-executed, and the
results will be retrieved and included into the exported document. If
you do not want to re-execute all code each time, you can delete the #
and the space before ~#+PROPERTY:~ in the header of this document.
Like we showed in the video, Python code is included as follows (and
is exxecuted by typing ~C-c C-c~):
#+begin_src python :results output :exports both
print("Hello world!")
#+end_src
#+RESULTS:
: Hello world!
And now the same but in an Python session. With a session, Python's
state, i.e. the values of all the variables, remains persistent from
one code block to the next. The code is still executed using ~C-c
C-c~.
#+begin_src python :results output :session :exports both
import numpy
x=numpy.linspace(-15,15)
print(x)
#+end_src
#+RESULTS:
#+begin_example
[-15. -14.3877551 -13.7755102 -13.16326531 -12.55102041
-11.93877551 -11.32653061 -10.71428571 -10.10204082 -9.48979592
-8.87755102 -8.26530612 -7.65306122 -7.04081633 -6.42857143
-5.81632653 -5.20408163 -4.59183673 -3.97959184 -3.36734694
-2.75510204 -2.14285714 -1.53061224 -0.91836735 -0.30612245
0.30612245 0.91836735 1.53061224 2.14285714 2.75510204
3.36734694 3.97959184 4.59183673 5.20408163 5.81632653
6.42857143 7.04081633 7.65306122 8.26530612 8.87755102
9.48979592 10.10204082 10.71428571 11.32653061 11.93877551
12.55102041 13.16326531 13.7755102 14.3877551 15. ]
#+end_example
Finally, an example for graphical output:
#+begin_src python :results output file :session :var matplot_lib_filename="./cosxsx.png" :exports results
import matplotlib.pyplot as plt
plt.figure(figsize=(10,5))
plt.plot(x,numpy.cos(x)/x)
plt.tight_layout()
plt.savefig(matplot_lib_filename)
print(matplot_lib_filename)
#+end_src
#+RESULTS:
[[file:./cosxsx.png]]
Note the parameter ~:exports results~, which indicates that the code
will not appear in the exported document. We recommend that in the
context of this MOOC, you always leave this parameter setting as
~:exports both~, because we want your analyses to be perfectly
transparent and reproducible.
Watch out: the figure generated by the code block is /not/ stored in
the org document. It's a plain file, here named ~cosxsx.png~. You have
to commit it explicitly if you want your analysis to be legible and
understandable on GitLab.
Finally, don't forget that we provide in the resource section of this
MOOC a configuration with a few keyboard shortcuts that allow you to
quickly create code blocks in Python by typing ~<p~, ~<P~ or ~<PP~
followed by ~Tab~.
Now it's your turn! You can delete all this information and replace it
by your computational document.
#+TITLE: Votre titre
#+AUTHOR: Votre nom
# -*- coding: utf-8-unix; mode: org; mode: auto-fill; fill-column: 100; -*-
#+TITLE: Module 2 Exercice 4
#+AUTHOR: Mathieu Pouit
#+DATE: La date du jour
#+LANGUAGE: fr
# #+PROPERTY: header-args :eval never-export
......
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analysis of the risk of failure of the O-rings on the Challenger shuttle"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"On January 27, 1986, the day before the takeoff of the shuttle _Challenger_, had\n",
"a three-hour teleconference was held between \n",
"Morton Thiokol (the manufacturer of one of the engines) and NASA. The\n",
"discussion focused on the consequences of the\n",
"temperature at take-off of 31°F (just below\n",
"0°C) for the success of the flight and in particular on the performance of the\n",
"O-rings used in the engines. Indeed, no test\n",
"had been performed at this temperature.\n",
"\n",
"The following study takes up some of the analyses carried out that\n",
"night with the objective of assessing the potential influence of\n",
"the temperature and pressure to which the O-rings are subjected\n",
"on their probability of malfunction. Our starting point is \n",
"the results of the experiments carried out by NASA engineers\n",
"during the six years preceding the launch of the shuttle\n",
"Challenger."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Loading the data\n",
"We start by loading this data:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<caption>A data.frame: 23 × 5</caption>\n",
"<thead>\n",
"\t<tr><th scope=col>Date</th><th scope=col>Count</th><th scope=col>Temperature</th><th scope=col>Pressure</th><th scope=col>Malfunction</th></tr>\n",
"\t<tr><th scope=col>&lt;fct&gt;</th><th scope=col>&lt;int&gt;</th><th scope=col>&lt;int&gt;</th><th scope=col>&lt;int&gt;</th><th scope=col>&lt;int&gt;</th></tr>\n",
"</thead>\n",
"<tbody>\n",
"\t<tr><td>4/12/81 </td><td>6</td><td>66</td><td> 50</td><td>0</td></tr>\n",
"\t<tr><td>11/12/81 </td><td>6</td><td>70</td><td> 50</td><td>1</td></tr>\n",
"\t<tr><td>3/22/82 </td><td>6</td><td>69</td><td> 50</td><td>0</td></tr>\n",
"\t<tr><td>11/11/82 </td><td>6</td><td>68</td><td> 50</td><td>0</td></tr>\n",
"\t<tr><td>4/04/83 </td><td>6</td><td>67</td><td> 50</td><td>0</td></tr>\n",
"\t<tr><td>6/18/82 </td><td>6</td><td>72</td><td> 50</td><td>0</td></tr>\n",
"\t<tr><td>8/30/83 </td><td>6</td><td>73</td><td>100</td><td>0</td></tr>\n",
"\t<tr><td>11/28/83 </td><td>6</td><td>70</td><td>100</td><td>0</td></tr>\n",
"\t<tr><td>2/03/84 </td><td>6</td><td>57</td><td>200</td><td>1</td></tr>\n",
"\t<tr><td>4/06/84 </td><td>6</td><td>63</td><td>200</td><td>1</td></tr>\n",
"\t<tr><td>8/30/84 </td><td>6</td><td>70</td><td>200</td><td>1</td></tr>\n",
"\t<tr><td>10/05/84 </td><td>6</td><td>78</td><td>200</td><td>0</td></tr>\n",
"\t<tr><td>11/08/84 </td><td>6</td><td>67</td><td>200</td><td>0</td></tr>\n",
"\t<tr><td>1/24/85 </td><td>6</td><td>53</td><td>200</td><td>2</td></tr>\n",
"\t<tr><td>4/12/85 </td><td>6</td><td>67</td><td>200</td><td>0</td></tr>\n",
"\t<tr><td>4/29/85 </td><td>6</td><td>75</td><td>200</td><td>0</td></tr>\n",
"\t<tr><td>6/17/85 </td><td>6</td><td>70</td><td>200</td><td>0</td></tr>\n",
"\t<tr><td>7/29/85</td><td>6</td><td>81</td><td>200</td><td>0</td></tr>\n",
"\t<tr><td>8/27/85 </td><td>6</td><td>76</td><td>200</td><td>0</td></tr>\n",
"\t<tr><td>10/03/85 </td><td>6</td><td>79</td><td>200</td><td>0</td></tr>\n",
"\t<tr><td>10/30/85 </td><td>6</td><td>75</td><td>200</td><td>2</td></tr>\n",
"\t<tr><td>11/26/85 </td><td>6</td><td>76</td><td>200</td><td>0</td></tr>\n",
"\t<tr><td>1/12/86 </td><td>6</td><td>58</td><td>200</td><td>1</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"A data.frame: 23 × 5\n",
"\\begin{tabular}{r|lllll}\n",
" Date & Count & Temperature & Pressure & Malfunction\\\\\n",
" <fct> & <int> & <int> & <int> & <int>\\\\\n",
"\\hline\n",
"\t 4/12/81 & 6 & 66 & 50 & 0\\\\\n",
"\t 11/12/81 & 6 & 70 & 50 & 1\\\\\n",
"\t 3/22/82 & 6 & 69 & 50 & 0\\\\\n",
"\t 11/11/82 & 6 & 68 & 50 & 0\\\\\n",
"\t 4/04/83 & 6 & 67 & 50 & 0\\\\\n",
"\t 6/18/82 & 6 & 72 & 50 & 0\\\\\n",
"\t 8/30/83 & 6 & 73 & 100 & 0\\\\\n",
"\t 11/28/83 & 6 & 70 & 100 & 0\\\\\n",
"\t 2/03/84 & 6 & 57 & 200 & 1\\\\\n",
"\t 4/06/84 & 6 & 63 & 200 & 1\\\\\n",
"\t 8/30/84 & 6 & 70 & 200 & 1\\\\\n",
"\t 10/05/84 & 6 & 78 & 200 & 0\\\\\n",
"\t 11/08/84 & 6 & 67 & 200 & 0\\\\\n",
"\t 1/24/85 & 6 & 53 & 200 & 2\\\\\n",
"\t 4/12/85 & 6 & 67 & 200 & 0\\\\\n",
"\t 4/29/85 & 6 & 75 & 200 & 0\\\\\n",
"\t 6/17/85 & 6 & 70 & 200 & 0\\\\\n",
"\t 7/29/85 & 6 & 81 & 200 & 0\\\\\n",
"\t 8/27/85 & 6 & 76 & 200 & 0\\\\\n",
"\t 10/03/85 & 6 & 79 & 200 & 0\\\\\n",
"\t 10/30/85 & 6 & 75 & 200 & 2\\\\\n",
"\t 11/26/85 & 6 & 76 & 200 & 0\\\\\n",
"\t 1/12/86 & 6 & 58 & 200 & 1\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"A data.frame: 23 × 5\n",
"\n",
"| Date &lt;fct&gt; | Count &lt;int&gt; | Temperature &lt;int&gt; | Pressure &lt;int&gt; | Malfunction &lt;int&gt; |\n",
"|---|---|---|---|---|\n",
"| 4/12/81 | 6 | 66 | 50 | 0 |\n",
"| 11/12/81 | 6 | 70 | 50 | 1 |\n",
"| 3/22/82 | 6 | 69 | 50 | 0 |\n",
"| 11/11/82 | 6 | 68 | 50 | 0 |\n",
"| 4/04/83 | 6 | 67 | 50 | 0 |\n",
"| 6/18/82 | 6 | 72 | 50 | 0 |\n",
"| 8/30/83 | 6 | 73 | 100 | 0 |\n",
"| 11/28/83 | 6 | 70 | 100 | 0 |\n",
"| 2/03/84 | 6 | 57 | 200 | 1 |\n",
"| 4/06/84 | 6 | 63 | 200 | 1 |\n",
"| 8/30/84 | 6 | 70 | 200 | 1 |\n",
"| 10/05/84 | 6 | 78 | 200 | 0 |\n",
"| 11/08/84 | 6 | 67 | 200 | 0 |\n",
"| 1/24/85 | 6 | 53 | 200 | 2 |\n",
"| 4/12/85 | 6 | 67 | 200 | 0 |\n",
"| 4/29/85 | 6 | 75 | 200 | 0 |\n",
"| 6/17/85 | 6 | 70 | 200 | 0 |\n",
"| 7/29/85 | 6 | 81 | 200 | 0 |\n",
"| 8/27/85 | 6 | 76 | 200 | 0 |\n",
"| 10/03/85 | 6 | 79 | 200 | 0 |\n",
"| 10/30/85 | 6 | 75 | 200 | 2 |\n",
"| 11/26/85 | 6 | 76 | 200 | 0 |\n",
"| 1/12/86 | 6 | 58 | 200 | 1 |\n",
"\n"
],
"text/plain": [
" Date Count Temperature Pressure Malfunction\n",
"1 4/12/81 6 66 50 0 \n",
"2 11/12/81 6 70 50 1 \n",
"3 3/22/82 6 69 50 0 \n",
"4 11/11/82 6 68 50 0 \n",
"5 4/04/83 6 67 50 0 \n",
"6 6/18/82 6 72 50 0 \n",
"7 8/30/83 6 73 100 0 \n",
"8 11/28/83 6 70 100 0 \n",
"9 2/03/84 6 57 200 1 \n",
"10 4/06/84 6 63 200 1 \n",
"11 8/30/84 6 70 200 1 \n",
"12 10/05/84 6 78 200 0 \n",
"13 11/08/84 6 67 200 0 \n",
"14 1/24/85 6 53 200 2 \n",
"15 4/12/85 6 67 200 0 \n",
"16 4/29/85 6 75 200 0 \n",
"17 6/17/85 6 70 200 0 \n",
"18 7/29/85 6 81 200 0 \n",
"19 8/27/85 6 76 200 0 \n",
"20 10/03/85 6 79 200 0 \n",
"21 10/30/85 6 75 200 2 \n",
"22 11/26/85 6 76 200 0 \n",
"23 1/12/86 6 58 200 1 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"data = read.csv(\"shuttle.csv\",header=T)\n",
"data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The data set shows us the date of each test, the number of O-rings (there are 6 on the main launcher), the temperature (in Fahrenheit) and pressure (in psi), and finally the number of identified malfunctions."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Graphical inspection\n",
"Flights without incidents do not provide any information\n",
"on the influence of temperature or pressure on malfunction.\n",
"We thus focus on the experiments in which at least one O-ring\n",
"was defective."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<caption>A data.frame: 7 × 5</caption>\n",
"<thead>\n",
"\t<tr><th></th><th scope=col>Date</th><th scope=col>Count</th><th scope=col>Temperature</th><th scope=col>Pressure</th><th scope=col>Malfunction</th></tr>\n",
"\t<tr><th></th><th scope=col>&lt;fct&gt;</th><th scope=col>&lt;int&gt;</th><th scope=col>&lt;int&gt;</th><th scope=col>&lt;int&gt;</th><th scope=col>&lt;int&gt;</th></tr>\n",
"</thead>\n",
"<tbody>\n",
"\t<tr><th scope=row>2</th><td>11/12/81</td><td>6</td><td>70</td><td> 50</td><td>1</td></tr>\n",
"\t<tr><th scope=row>9</th><td>2/03/84 </td><td>6</td><td>57</td><td>200</td><td>1</td></tr>\n",
"\t<tr><th scope=row>10</th><td>4/06/84 </td><td>6</td><td>63</td><td>200</td><td>1</td></tr>\n",
"\t<tr><th scope=row>11</th><td>8/30/84 </td><td>6</td><td>70</td><td>200</td><td>1</td></tr>\n",
"\t<tr><th scope=row>14</th><td>1/24/85 </td><td>6</td><td>53</td><td>200</td><td>2</td></tr>\n",
"\t<tr><th scope=row>21</th><td>10/30/85</td><td>6</td><td>75</td><td>200</td><td>2</td></tr>\n",
"\t<tr><th scope=row>23</th><td>1/12/86 </td><td>6</td><td>58</td><td>200</td><td>1</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"A data.frame: 7 × 5\n",
"\\begin{tabular}{r|lllll}\n",
" & Date & Count & Temperature & Pressure & Malfunction\\\\\n",
" & <fct> & <int> & <int> & <int> & <int>\\\\\n",
"\\hline\n",
"\t2 & 11/12/81 & 6 & 70 & 50 & 1\\\\\n",
"\t9 & 2/03/84 & 6 & 57 & 200 & 1\\\\\n",
"\t10 & 4/06/84 & 6 & 63 & 200 & 1\\\\\n",
"\t11 & 8/30/84 & 6 & 70 & 200 & 1\\\\\n",
"\t14 & 1/24/85 & 6 & 53 & 200 & 2\\\\\n",
"\t21 & 10/30/85 & 6 & 75 & 200 & 2\\\\\n",
"\t23 & 1/12/86 & 6 & 58 & 200 & 1\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"A data.frame: 7 × 5\n",
"\n",
"| <!--/--> | Date &lt;fct&gt; | Count &lt;int&gt; | Temperature &lt;int&gt; | Pressure &lt;int&gt; | Malfunction &lt;int&gt; |\n",
"|---|---|---|---|---|---|\n",
"| 2 | 11/12/81 | 6 | 70 | 50 | 1 |\n",
"| 9 | 2/03/84 | 6 | 57 | 200 | 1 |\n",
"| 10 | 4/06/84 | 6 | 63 | 200 | 1 |\n",
"| 11 | 8/30/84 | 6 | 70 | 200 | 1 |\n",
"| 14 | 1/24/85 | 6 | 53 | 200 | 2 |\n",
"| 21 | 10/30/85 | 6 | 75 | 200 | 2 |\n",
"| 23 | 1/12/86 | 6 | 58 | 200 | 1 |\n",
"\n"
],
"text/plain": [
" Date Count Temperature Pressure Malfunction\n",
"2 11/12/81 6 70 50 1 \n",
"9 2/03/84 6 57 200 1 \n",
"10 4/06/84 6 63 200 1 \n",
"11 8/30/84 6 70 200 1 \n",
"14 1/24/85 6 53 200 2 \n",
"21 10/30/85 6 75 200 2 \n",
"23 1/12/86 6 58 200 1 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"data = data[data$Malfunction>0,]\n",
"data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We have a high temperature variability but\n",
"the pressure is almost always 200, which should\n",
"simplify the analysis.\n",
"\n",
"How does the frequency of failure vary with temperature?"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0gAAANICAMAAADKOT/pAAAC+lBMVEUAAAABAQECAgIDAwME\nBAQFBQUGBgYHBwcICAgJC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hksgICi3cAlotbUtETxc\nWvBQo2WrWPTUgtgqEVqsgMZdVKBFQLywd2i1anW70b29HbcepFGPp8IRkSpFYQOixeIlokes\nQUESLZdwCXnXOnNLJoT0ncl+f7zv+8TvZy0zz5p5JvzX63xXkrkaB4BnJugBgNaAkAABQgIE\nCAkQICRAgJAAAUICBAgJECAkQICQAAFCAgQICRAgJECAkAABQgIECAkQICRAgJAAAUICBAgJ\nECAkQICQAAFCAgQICRAgJECAkAABQgIECAkQICRAgJAAAUICBAgJECAkQICQAAFCAgQICRAg\nJECAkAABQgIECAkQICRAgJAAAUICBAgJECAkQICQAAFCAgQICRAgJECAkAABQgIECAkQICRA\ngJAAAUICBAgJECAkQICQAAFCAgQICRAgJECAkAABQgIECAkQICRAgJAAAUICBAgJECAkQICQ\nAAFCAgQICRAgJECAkAABQgIECAkQICRAgJAAAUICBAgJECAkQICQAAFCAgQICRAgJECAkAAB\nQgIECAkQICRAgJAAAUICBAgJECAkQICQAAFCAgQICRDwIaQ3NgJWeaPlt/LjH9IGA1hmQ4tv\n5sc/pLXm4HH/NwChg2Zti69DSEAThAQIEBIgQEiAACEBAoQECBASIOB3SHXbVpaXr9qeYRch\nwTL+hlQ1s0fyUeD+C/e77SMkWMbXkCoHmlNL5peVzZ1YYAZVuWwkJFjG15CmRJemVrX3Rkpd\nNhISLONrSL0mp9cT+rlsJCRYxteQorel1wvaumwkJFjG15AKx6fX4wa4bCQkWMbXkEojiw8k\nV3vnmVkuGwkJlvE1pOrBJr+4ZMb0SaPzzKg9LhsJCZbx93Gkg3cU5cQfRooOX1Lrto+QYBnf\nnyJU896mTRWZMiEkWIbn2gEChAQIBBXS+8XFTc45snplg98SEuwSVEibTdPv8kH3rg3yzF7B\nvwH4JqiQarZscbn0fuN25zgQOuH8G4mQYJnAQvq8wuVCQoJlAgtpltt3ISRYhpAAAUICBHwN\naUgjvQgJrYivIbVp065BDiGhFfE1pFn56bvq+NUOrYmvIR0648xD9WtCQmvi750NWztcX78k\nJLQm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MZkJKbml8JagRUlgkQvq04X7wv8Ru\n/ltjZ883L8W+PmCeiIf0dnzjJPP60ds2Jq7/6FknxM8obTak+JbGV4IaIYVFIqQKU7Q8qTp2\n848/HDTfrHEaQvoovnGaeenYbc4cc+ZDf3ztwb8TUnxL4ytBjZDCIvUTqajhjGZCiv+Icn5s\n3jx2W02HfvFf2FY0DWlfOqTGV4IaIYVF8s6Gk9onflzsdJoN6ffxy4aancdu+9BcHD9jTjqk\ni0z80rfSITW+EtqClZMAAAEtSURBVNQIKSxS99qZX8a+7uw1ttmQLogt3418vZlt+yNnxL5u\n7mOucpwyU574Ti/Hvt7YKKRGV4IaIYVFMqTP+psrH769f/SFZkM6Z+z99w2I3wV3zDZnrLnq\niZu6Pp/b9z/2LjNDf/OfzmtmyEvr5ozKT4fU6EpQI6SwSD2zYcfV/XJP+MF6p9mQKq4raHv6\nw81tc3Ze1r3L2Wucmzv12nHohx26PuU4D5/eoefULwpGNmxpdCWoEZI9JpiPgx4Bfw8h2YOQ\nQoyQ7EFIIUZI9iCkECMkQICQAAFCAgQICRAgJECAkAABQgIECAkQICRAgJAAAUICBAgJECAk\nQICQAAFCAgQICRAgJECAkAABQgIECAkQICRAgJAAAUICBAgJECAkQICQAAFCAgT+P9FRuQB/\nRTZ+AAAAAElFTkSuQmCC",
"text/plain": [
"plot without title"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plot(data=data, Malfunction/Count ~ Temperature, ylim=c(0,1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"At first glance, the dependence does not look very important, but let's try to\n",
"estimate the impact of temperature $t$ on the probability of O-ring malfunction."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Estimation of the temperature influence\n",
"\n",
"Suppose that each of the six O-rings is damaged with the same\n",
"probability and independently of the others and that this probability\n",
"depends only on the temperature. If $p(t)$ is this probability, the\n",
"number $D$ of malfunctioning O-rings during a flight at\n",
"temperature $t$ follows a binomial law with parameters $n=6$ and\n",
"$p=p(t)$. To link $p(t)$ to $t$, we will therefore perform a\n",
"logistic regression."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"Call:\n",
"glm(formula = Malfunction/Count ~ Temperature, family = binomial(link = \"logit\"), \n",
" data = data, weights = Count)\n",
"\n",
"Deviance Residuals: \n",
" 2 9 10 11 14 21 23 \n",
"-0.3015 -0.2836 -0.2919 -0.3015 0.6891 0.6560 -0.2850 \n",
"\n",
"Coefficients:\n",
" Estimate Std. Error z value Pr(>|z|)\n",
"(Intercept) -1.389528 3.195752 -0.435 0.664\n",
"Temperature 0.001416 0.049773 0.028 0.977\n",
"\n",
"(Dispersion parameter for binomial family taken to be 1)\n",
"\n",
" Null deviance: 1.3347 on 6 degrees of freedom\n",
"Residual deviance: 1.3339 on 5 degrees of freedom\n",
"AIC: 18.894\n",
"\n",
"Number of Fisher Scoring iterations: 4\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"logistic_reg = glm(data=data, Malfunction/Count ~ Temperature, weights=Count, \n",
" family=binomial(link='logit'))\n",
"summary(logistic_reg)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The most likely estimator of the temperature parameter is 0.0014\n",
"and the standard error of this estimator is 0.122, in other words we\n",
"cannot distinguish any particular impact and we must take our\n",
"estimates with caution."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Estimation of the probability of O-ring malfunction\n",
"\n",
"The expected temperature on the take-off day is 31°F. Let's try to\n",
"estimate the probability of O-ring malfunction at\n",
"this temperature from the model we just built:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0gAAANICAMAAADKOT/pAAAC/VBMVEUAAAABAQECAgIDAwME\nBAQFBQUGBgYHBwcICAgJCQkKCgoLCwsMDAwNDQ0ODg4PDw8QEBARERESEhITExMUFBQVFRUW\nFhYXFxcYGBgZGR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ndu602+C4MPLe+V1/M7LwX5DqvxBz5bH3BcOf8qknzHB\nKUJqBkaZ9Ukv4aBHSM0AISWPkJoBQkoeITUDhJQ8QgIECAkQICRAgJAAAUICBAgJECAkQICQ\nAAFCAgQICRAgJECAkAABQgIECAkQICRAgJAAAUICBAgJECAkQICQAAFCAgQICRAgJECAkAAB\nQgIECAkQICRA4H8AHOKqM1UAAAADSURBVHhzjEM0knQAAAAASUVORK5CYII=",
"text/plain": [
"plot without title"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"tempv = seq(from=30, to=90, by = .5)\n",
"rmv <- predict(logistic_reg,list(Temperature=tempv),type=\"response\")\n",
"plot(tempv,rmv,type=\"l\",ylim=c(0,1))\n",
"points(data=data, Malfunction/Count ~ Temperature)"
]
},
{
"cell_type": "markdown",
"metadata": {
"hideCode": false,
"hidePrompt": false,
"scrolled": true
},
"source": [
"As expected from the initial data, the\n",
"temperature has no significant impact on the probability of failure of the\n",
"O-rings. It will be about 0.2, as in the tests\n",
"where we had a failure of at least one joint. Let's get back\n",
"to the initial dataset to estimate the probability of failure:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"0.0652173913043478"
],
"text/latex": [
"0.0652173913043478"
],
"text/markdown": [
"0.0652173913043478"
],
"text/plain": [
"[1] 0.06521739"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"data_full = read.csv(\"shuttle.csv\",header=T)\n",
"sum(data_full$Malfunction)/sum(data_full$Count)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This probability is thus about $p=0.065$. Knowing that there is\n",
"a primary and a secondary O-ring on each of the three parts of the\n",
"launcher, the probability of failure of both joints of a launcher\n",
"is $p^2 \\approx 0.00425$. The probability of failure of any one of the\n",
"launchers is $1-(1-p^2)^3 \\approx 1.2\\%$. That would really be\n",
"bad luck.... Everything is under control, so the takeoff can happen\n",
"tomorrow as planned.\n",
"\n",
"But the next day, the Challenger shuttle exploded and took away\n",
"with her the seven crew members. The public was shocked and in\n",
"the subsequent investigation, the reliability of the\n",
"O-rings was questioned. Beyond the internal communication problems\n",
"of NASA, which have a lot to do with this fiasco, the previous analysis\n",
"includes (at least) a small problem.... Can you find it?\n",
"You are free to modify this analysis and to look at this dataset\n",
"from all angles in order to to explain what's wrong."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Hide code",
"kernelspec": {
"display_name": "R",
"language": "R",
"name": "ir"
},
"language_info": {
"codemirror_mode": "r",
"file_extension": ".r",
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
#+TITLE: Analysis of the risk of failure of the O-rings on the Challenger shuttle
#+AUTHOR: Arnaud Legrand
#+LANGUAGE: en
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
#+LATEX_HEADER: \usepackage[utf8]{inputenc}
#+LATEX_HEADER: \usepackage[T1]{fontenc}
#+LATEX_HEADER: \usepackage[a4paper,margin=.8in]{geometry}
#+LATEX_HEADER: \usepackage[french]{babel}
# #+PROPERTY: header-args :session :exports both
On January 27, 1986, the day before the takeoff of the shuttle /Challenger/, had
a three-hour teleconference was held between
Morton Thiokol (the manufacturer of one of the engines) and NASA. The
discussion focused on the consequences of the
temperature at take-off of 31°F (just below
0°C) for the success of the flight and in particular on the performance of the
O-rings used in the engines. Indeed, no test
had been performed at this temperature.
The following study takes up some of the analyses carried out that
night with the objective of assessing the potential influence of
the temperature and pressure to which the O-rings are subjected
on their probability of malfunction. Our starting point is
the results of the experiments carried out by NASA engineers
during the six years preceding the launch of the shuttle
Challenger.
* Loading the data
We start by loading this data:
#+begin_src R :results output :session *R* :exports both
data = read.csv("shuttle.csv",header=T)
data
#+end_src
#+RESULTS:
#+begin_example
Date Count Temperature Pressure Malfunction
1 4/12/81 6 66 50 0
2 11/12/81 6 70 50 1
3 3/22/82 6 69 50 0
4 11/11/82 6 68 50 0
5 4/04/83 6 67 50 0
6 6/18/82 6 72 50 0
7 8/30/83 6 73 100 0
8 11/28/83 6 70 100 0
9 2/03/84 6 57 200 1
10 4/06/84 6 63 200 1
11 8/30/84 6 70 200 1
12 10/05/84 6 78 200 0
13 11/08/84 6 67 200 0
14 1/24/85 6 53 200 2
15 4/12/85 6 67 200 0
16 4/29/85 6 75 200 0
17 6/17/85 6 70 200 0
18 7/29/85 6 81 200 0
19 8/27/85 6 76 200 0
20 10/03/85 6 79 200 0
21 10/30/85 6 75 200 2
22 11/26/85 6 76 200 0
23 1/12/86 6 58 200 1
#+end_example
The data set shows us the date of each test, the number of O-rings
(there are 6 on the main launcher), the
temperature (in Fahrenheit) and pressure (in psi), and finally the
number of identified malfunctions.
* Graphical inspection
Flights without incidents do not provide any information
on the influence of temperature or pressure on malfunction.
We thus focus on the experiments in which at least one O-ring was defective.
#+begin_src R :results output :session *R* :exports both
data = data[data$Malfunction>0,]
data
#+end_src
#+RESULTS:
: Date Count Temperature Pressure Malfunction
: 2 11/12/81 6 70 50 1
: 9 2/03/84 6 57 200 1
: 10 4/06/84 6 63 200 1
: 11 8/30/84 6 70 200 1
: 14 1/24/85 6 53 200 2
: 21 10/30/85 6 75 200 2
: 23 1/12/86 6 58 200 1
We have a high temperature variability but
the pressure is almost always 200, which should
simplify the analysis.
How does the frequency of failure vary with temperature?
#+begin_src R :results output graphics :file "freq_temp.png" :exports both :width 600 :height 400 :session *R*
plot(data=data, Malfunction/Count ~ Temperature, ylim=c(0,1))
#+end_src
#+RESULTS:
[[file:freq_temp.png]]
At first glance, the dependence does not look very important, but let's try to
estimate the impact of temperature $t$ on the probability of O-ring malfunction.
* Estimation of the temperature influence
Suppose that each of the six O-rings is damaged with the same
probability and independently of the others and that this probability
depends only on the temperature. If $p(t)$ is this probability, the
number $D$ of malfunctioning O-rings during a flight at
temperature $t$ follows a binomial law with parameters $n=6$ and
$p=p(t)$. To link $p(t)$ to $t$, we will therefore perform a
logistic regression.
#+begin_src R :results output :session *R* :exports both
logistic_reg = glm(data=data, Malfunction/Count ~ Temperature, weights=Count,
family=binomial(link='logit'))
summary(logistic_reg)
#+end_src
#+RESULTS:
#+begin_example
Call:
glm(formula = Malfunction/Count ~ Temperature, family = binomial(link = "logit"),
data = data, weights = Count)
Deviance Residuals:
2 9 10 11 14 21 23
-0.3015 -0.2836 -0.2919 -0.3015 0.6891 0.6560 -0.2850
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.389528 3.195752 -0.435 0.664
Temperature 0.001416 0.049773 0.028 0.977
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 1.3347 on 6 degrees of freedom
Residual deviance: 1.3339 on 5 degrees of freedom
AIC: 18.894
Number of Fisher Scoring iterations: 4
#+end_example
The most likely estimator of the temperature parameter is 0.001416
and the standard error of this estimator is 0.049, in other words we
cannot distinguish any particular impact and we must take our
estimates with caution.
* Estimation of the probability of O-ring malfunction
The expected temperature on the take-off day is 31°F. Let's try to
estimate the probability of O-ring malfunction at
this temperature from the model we just built:
#+begin_src R :results output graphics :file "proba_estimate.png" :exports both :width 600 :height 400 :session *R*
# shuttle=shuttle[shuttle$r!=0,]
tempv = seq(from=30, to=90, by = .5)
rmv <- predict(logistic_reg,list(Temperature=tempv),type="response")
plot(tempv,rmv,type="l",ylim=c(0,1))
points(data=data, Malfunction/Count ~ Temperature)
#+end_src
#+RESULTS:
[[file:proba_estimate.png]]
As expected from the initial data, the
temperature has no significant impact on the probability of failure of the
O-rings. It will be about 0.2, as in the tests
where we had a failure of at least one joint. Let's get back to the initial dataset to estimate the probability of failure:
#+begin_src R :results output :session *R* :exports both
data_full = read.csv("shuttle.csv",header=T)
sum(data_full$Malfunction)/sum(data_full$Count)
#+end_src
#+RESULTS:
: [1] 0.06521739
This probability is thus about $p=0.065$. Knowing that there is
a primary and a secondary O-ring on each of the three parts of the
launcher, the probability of failure of both joints of a launcher
is $p^2 \approx 0.00425$. The probability of failure of any one of the
launchers is $1-(1-p^2)^3 \approx 1.2%$. That would really be
bad luck.... Everything is under control, so the takeoff can happen
tomorrow as planned.
But the next day, the Challenger shuttle exploded and took away
with her the seven crew members. The public was shocked and in
the subsequent investigation, the reliability of the
O-rings was questioned. Beyond the internal communication problems
of NASA, which have a lot to do with this fiasco, the previous analysis
includes (at least) a small problem.... Can you find it?
You are free to modify this analysis and to look at this dataset
from all angles in order to to explain what's wrong.
---
title: "Analysis of the risk of failure of the O-rings on the Challenger shuttle"
author: "Arnaud Legrand"
date: "28 juin 2018"
output: html_document
---
On January 27, 1986, the day before the takeoff of the shuttle _Challenger_, had
a three-hour teleconference was held between
Morton Thiokol (the manufacturer of one of the engines) and NASA. The
discussion focused on the consequences of the
temperature at take-off of 31°F (just below
0°C) for the success of the flight and in particular on the performance of the
O-rings used in the engines. Indeed, no test
had been performed at this temperature.
The following study takes up some of the analyses carried out that
night with the objective of assessing the potential influence of
the temperature and pressure to which the O-rings are subjected
on their probability of malfunction. Our starting point is
the results of the experiments carried out by NASA engineers
during the six years preceding the launch of the shuttle
Challenger.
# Loading the data
We start by loading this data:
```{r}
data = read.csv("shuttle.csv",header=T)
data
```
The data set shows us the date of each test, the number of O-rings
(there are 6 on the main launcher), the
temperature (in Fahrenheit) and pressure (in psi), and finally the
number of identified malfunctions.
# Graphical inspection
Flights without incidents do not provide any information
on the influence of temperature or pressure on malfunction.
We thus focus on the experiments in which at least one O-ring was defective.
```{r}
data = data[data$Malfunction>0,]
data
```
We have a high temperature variability but
the pressure is almost always 200, which should
simplify the analysis.
How does the frequency of failure vary with temperature?
```{r}
plot(data=data, Malfunction/Count ~ Temperature, ylim=c(0,1))
```
At first glance, the dependence does not look very important, but let's try to
estimate the impact of temperature $t$ on the probability of O-ring malfunction.
# Estimation of the temperature influence
Suppose that each of the six O-rings is damaged with the same
probability and independently of the others and that this probability
depends only on the temperature. If $p(t)$ is this probability, the
number $D$ of malfunctioning O-rings during a flight at
temperature $t$ follows a binomial law with parameters $n=6$ and
$p=p(t)$. To link $p(t)$ to $t$, we will therefore perform a
logistic regression.
```{r}
logistic_reg = glm(data=data, Malfunction/Count ~ Temperature, weights=Count,
family=binomial(link='logit'))
summary(logistic_reg)
```
The most likely estimator of the temperature parameter is 0.001416
and the standard error of this estimator is 0.049, in other words we
cannot distinguish any particular impact and we must take our
estimates with caution.
# Estimation of the probability of O-ring malfunction
The expected temperature on the take-off day is 31°F. Let's try to
estimate the probability of O-ring malfunction at
this temperature from the model we just built:
```{r}
# shuttle=shuttle[shuttle$r!=0,]
tempv = seq(from=30, to=90, by = .5)
rmv <- predict(logistic_reg,list(Temperature=tempv),type="response")
plot(tempv,rmv,type="l",ylim=c(0,1))
points(data=data, Malfunction/Count ~ Temperature)
```
As expected from the initial data, the
temperature has no significant impact on the probability of failure of the
O-rings. It will be about 0.2, as in the tests
where we had a failure of at least one joint. Let's get back to the initial dataset to estimate the probability of failure:
```{r}
data_full = read.csv("shuttle.csv",header=T)
sum(data_full$Malfunction)/sum(data_full$Count)
```
This probability is thus about $p=0.065$. Knowing that there is
a primary and a secondary O-ring on each of the three parts of the
launcher, the probability of failure of both joints of a launcher
is $p^2 \approx 0.00425$. The probability of failure of any one of the
launchers is $1-(1-p^2)^3 \approx 1.2%$. That would really be
bad luck.... Everything is under control, so the takeoff can happen
tomorrow as planned.
But the next day, the Challenger shuttle exploded and took away
with her the seven crew members. The public was shocked and in
the subsequent investigation, the reliability of the
O-rings was questioned. Beyond the internal communication problems
of NASA, which have a lot to do with this fiasco, the previous analysis
includes (at least) a small problem.... Can you find it?
You are free to modify this analysis and to look at this dataset
from all angles in order to to explain what's wrong.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analysis of the risk of failure of the O-rings on the Challenger shuttle"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"On January 27, 1986, the day before the takeoff of the shuttle _Challenger_, had\n",
"a three-hour teleconference was held between \n",
"Morton Thiokol (the manufacturer of one of the engines) and NASA. The\n",
"discussion focused on the consequences of the\n",
"temperature at take-off of 31°F (just below\n",
"0°C) for the success of the flight and in particular on the performance of the\n",
"O-rings used in the engines. Indeed, no test\n",
"had been performed at this temperature.\n",
"\n",
"The following study takes up some of the analyses carried out that\n",
"night with the objective of assessing the potential influence of\n",
"the temperature and pressure to which the O-rings are subjected\n",
"on their probability of malfunction. Our starting point is \n",
"the results of the experiments carried out by NASA engineers\n",
"during the six years preceding the launch of the shuttle\n",
"Challenger."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Loading the data\n",
"We start by loading this data:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Date</th>\n",
" <th>Count</th>\n",
" <th>Temperature</th>\n",
" <th>Pressure</th>\n",
" <th>Malfunction</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>4/12/81</td>\n",
" <td>6</td>\n",
" <td>66</td>\n",
" <td>50</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>11/12/81</td>\n",
" <td>6</td>\n",
" <td>70</td>\n",
" <td>50</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3/22/82</td>\n",
" <td>6</td>\n",
" <td>69</td>\n",
" <td>50</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>11/11/82</td>\n",
" <td>6</td>\n",
" <td>68</td>\n",
" <td>50</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>4/04/83</td>\n",
" <td>6</td>\n",
" <td>67</td>\n",
" <td>50</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>6/18/82</td>\n",
" <td>6</td>\n",
" <td>72</td>\n",
" <td>50</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>8/30/83</td>\n",
" <td>6</td>\n",
" <td>73</td>\n",
" <td>100</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>11/28/83</td>\n",
" <td>6</td>\n",
" <td>70</td>\n",
" <td>100</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>2/03/84</td>\n",
" <td>6</td>\n",
" <td>57</td>\n",
" <td>200</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>4/06/84</td>\n",
" <td>6</td>\n",
" <td>63</td>\n",
" <td>200</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>8/30/84</td>\n",
" <td>6</td>\n",
" <td>70</td>\n",
" <td>200</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>10/05/84</td>\n",
" <td>6</td>\n",
" <td>78</td>\n",
" <td>200</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>11/08/84</td>\n",
" <td>6</td>\n",
" <td>67</td>\n",
" <td>200</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>1/24/85</td>\n",
" <td>6</td>\n",
" <td>53</td>\n",
" <td>200</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>4/12/85</td>\n",
" <td>6</td>\n",
" <td>67</td>\n",
" <td>200</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>4/29/85</td>\n",
" <td>6</td>\n",
" <td>75</td>\n",
" <td>200</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>6/17/85</td>\n",
" <td>6</td>\n",
" <td>70</td>\n",
" <td>200</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>7/29/85</td>\n",
" <td>6</td>\n",
" <td>81</td>\n",
" <td>200</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>8/27/85</td>\n",
" <td>6</td>\n",
" <td>76</td>\n",
" <td>200</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>10/03/85</td>\n",
" <td>6</td>\n",
" <td>79</td>\n",
" <td>200</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>10/30/85</td>\n",
" <td>6</td>\n",
" <td>75</td>\n",
" <td>200</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>11/26/85</td>\n",
" <td>6</td>\n",
" <td>76</td>\n",
" <td>200</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>1/12/86</td>\n",
" <td>6</td>\n",
" <td>58</td>\n",
" <td>200</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Date Count Temperature Pressure Malfunction\n",
"0 4/12/81 6 66 50 0\n",
"1 11/12/81 6 70 50 1\n",
"2 3/22/82 6 69 50 0\n",
"3 11/11/82 6 68 50 0\n",
"4 4/04/83 6 67 50 0\n",
"5 6/18/82 6 72 50 0\n",
"6 8/30/83 6 73 100 0\n",
"7 11/28/83 6 70 100 0\n",
"8 2/03/84 6 57 200 1\n",
"9 4/06/84 6 63 200 1\n",
"10 8/30/84 6 70 200 1\n",
"11 10/05/84 6 78 200 0\n",
"12 11/08/84 6 67 200 0\n",
"13 1/24/85 6 53 200 2\n",
"14 4/12/85 6 67 200 0\n",
"15 4/29/85 6 75 200 0\n",
"16 6/17/85 6 70 200 0\n",
"17 7/29/85 6 81 200 0\n",
"18 8/27/85 6 76 200 0\n",
"19 10/03/85 6 79 200 0\n",
"20 10/30/85 6 75 200 2\n",
"21 11/26/85 6 76 200 0\n",
"22 1/12/86 6 58 200 1"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"data = pd.read_csv(\"shuttle.csv\")\n",
"data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The data set shows us the date of each test, the number of O-rings (there are 6 on the main launcher), the temperature (in Fahrenheit) and pressure (in psi), and finally the number of identified malfunctions."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Graphical inspection\n",
"Flights without incidents do not provide any information\n",
"on the influence of temperature or pressure on malfunction.\n",
"We thus focus on the experiments in which at least one O-ring\n",
"was defective."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Date</th>\n",
" <th>Count</th>\n",
" <th>Temperature</th>\n",
" <th>Pressure</th>\n",
" <th>Malfunction</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>11/12/81</td>\n",
" <td>6</td>\n",
" <td>70</td>\n",
" <td>50</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>2/03/84</td>\n",
" <td>6</td>\n",
" <td>57</td>\n",
" <td>200</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>4/06/84</td>\n",
" <td>6</td>\n",
" <td>63</td>\n",
" <td>200</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>8/30/84</td>\n",
" <td>6</td>\n",
" <td>70</td>\n",
" <td>200</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>1/24/85</td>\n",
" <td>6</td>\n",
" <td>53</td>\n",
" <td>200</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>10/30/85</td>\n",
" <td>6</td>\n",
" <td>75</td>\n",
" <td>200</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>1/12/86</td>\n",
" <td>6</td>\n",
" <td>58</td>\n",
" <td>200</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Date Count Temperature Pressure Malfunction\n",
"1 11/12/81 6 70 50 1\n",
"8 2/03/84 6 57 200 1\n",
"9 4/06/84 6 63 200 1\n",
"10 8/30/84 6 70 200 1\n",
"13 1/24/85 6 53 200 2\n",
"20 10/30/85 6 75 200 2\n",
"22 1/12/86 6 58 200 1"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = data[data.Malfunction>0]\n",
"data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We have a high temperature variability but\n",
"the pressure is almost always 200, which should\n",
"simplify the analysis.\n",
"\n",
"How does the frequency of failure vary with temperature?"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAFaNJREFUeJzt3X2QZXV95/H3p2cGGASFwGZiMSAQWFdKCWALGtxkiMRCqxzWwgfYSjRGnWwJlTImRuK6hLCmaiUxJlaIOroaYUuRh1Vnd3ERNK3REmHUCY/BzCJCgwHFUWkY5oH+7h/3zvFOd0/37aHPvUz3+1XVNfec+zvnfvvL4X76PNxzU1VIkgQwMuwCJElPH4aCJKlhKEiSGoaCJKlhKEiSGoaCJKnRWigk+XiSh5Pcvofnk+SDSTYnuTXJKW3VIknqT5t7Cn8PnDXL868Aju/+rAM+1GItkqQ+tBYKVfVV4MezDDkbuLw6bgIOSfLstuqRJM1t+RBf+wjg/p7p8e68H0wdmGQdnb0JVq5c+cIjjzxyIAU+VZOTk4yMeNqmlz2Zzp5MZ09m9lT68t3vfvdHVfVv5ho3zFDIDPNmvOdGVa0H1gOMjo7Wxo0b26xrwYyNjbFmzZphl/G0Yk+msyfT2ZOZPZW+JPl+P+OGGcXjQO+f/KuBB4dUiySJ4YbCBuAN3auQXgz8tKqmHTqSJA1Oa4ePknwaWAMcnmQc+FNgBUBVf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t4OQ9pqhoKUgwMer6r/sNjNZTufNe5dJYFvP497/P6aefKs51ru1uifsuvew+Vs6d0N9IMl76YTDTHby8z34qWMem/I7va2qvoS0gDx8pKXgRuB1SQ6HzlVKe3Go5eXpfLfygXS+Eezr81jvSjoh86Pu3XTP6XnuUeDgnul7gRd2H/eOm+p64G3dANr1nb4r5/k7SdO4p6BFr6puS/JnwI1JRoAdwH8CHpzHar4GfIrOF5xcsetqoX7WW1WPpPO9zLcD3we+2fP0J4CPJdlK57zFxcBHk/wrcPMs9XyEzt1DN3UPXT1MJ6ykp8RLUqU5dK/seX5VvX3YtUht8/CRJKnhnoIkqeGegiSpYShIkhqGgiSpYShIkhqGgiSp8f8B+Q9eu+sB8EwAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"pd.set_option('mode.chained_assignment',None) # this removes a useless warning from pandas\n",
"import matplotlib.pyplot as plt\n",
"\n",
"data[\"Frequency\"]=data.Malfunction/data.Count\n",
"data.plot(x=\"Temperature\",y=\"Frequency\",kind=\"scatter\",ylim=[0,1])\n",
"plt.grid(True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"At first glance, the dependence does not look very important, but let's try to\n",
"estimate the impact of temperature $t$ on the probability of O-ring malfunction."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Estimation of the temperature influence\n",
"\n",
"Suppose that each of the six O-rings is damaged with the same\n",
"probability and independently of the others and that this probability\n",
"depends only on the temperature. If $p(t)$ is this probability, the\n",
"number $D$ of malfunctioning O-rings during a flight at\n",
"temperature $t$ follows a binomial law with parameters $n=6$ and\n",
"$p=p(t)$. To link $p(t)$ to $t$, we will therefore perform a\n",
"logistic regression."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"simpletable\">\n",
"<caption>Generalized Linear Model Regression Results</caption>\n",
"<tr>\n",
" <th>Dep. Variable:</th> <td>Frequency</td> <th> No. Observations: </th> <td> 7</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Model:</th> <td>GLM</td> <th> Df Residuals: </th> <td> 5</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Model Family:</th> <td>Binomial</td> <th> Df Model: </th> <td> 1</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Link Function:</th> <td>logit</td> <th> Scale: </th> <td> 1.0000</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Method:</th> <td>IRLS</td> <th> Log-Likelihood: </th> <td> -2.5250</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Date:</th> <td>Sat, 13 Apr 2019</td> <th> Deviance: </th> <td> 0.22231</td> \n",
"</tr>\n",
"<tr>\n",
" <th>Time:</th> <td>19:12:05</td> <th> Pearson chi2: </th> <td> 0.236</td> \n",
"</tr>\n",
"<tr>\n",
" <th>No. Iterations:</th> <td>4</td> <th> Covariance Type: </th> <td>nonrobust</td>\n",
"</tr>\n",
"</table>\n",
"<table class=\"simpletable\">\n",
"<tr>\n",
" <td></td> <th>coef</th> <th>std err</th> <th>z</th> <th>P>|z|</th> <th>[0.025</th> <th>0.975]</th> \n",
"</tr>\n",
"<tr>\n",
" <th>Intercept</th> <td> -1.3895</td> <td> 7.828</td> <td> -0.178</td> <td> 0.859</td> <td> -16.732</td> <td> 13.953</td>\n",
"</tr>\n",
"<tr>\n",
" <th>Temperature</th> <td> 0.0014</td> <td> 0.122</td> <td> 0.012</td> <td> 0.991</td> <td> -0.238</td> <td> 0.240</td>\n",
"</tr>\n",
"</table>"
],
"text/plain": [
"<class 'statsmodels.iolib.summary.Summary'>\n",
"\"\"\"\n",
" Generalized Linear Model Regression Results \n",
"==============================================================================\n",
"Dep. Variable: Frequency No. Observations: 7\n",
"Model: GLM Df Residuals: 5\n",
"Model Family: Binomial Df Model: 1\n",
"Link Function: logit Scale: 1.0000\n",
"Method: IRLS Log-Likelihood: -2.5250\n",
"Date: Sat, 13 Apr 2019 Deviance: 0.22231\n",
"Time: 19:12:05 Pearson chi2: 0.236\n",
"No. Iterations: 4 Covariance Type: nonrobust\n",
"===============================================================================\n",
" coef std err z P>|z| [0.025 0.975]\n",
"-------------------------------------------------------------------------------\n",
"Intercept -1.3895 7.828 -0.178 0.859 -16.732 13.953\n",
"Temperature 0.0014 0.122 0.012 0.991 -0.238 0.240\n",
"===============================================================================\n",
"\"\"\""
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import statsmodels.api as sm\n",
"\n",
"data[\"Success\"]=data.Count-data.Malfunction\n",
"data[\"Intercept\"]=1\n",
"\n",
"logmodel=sm.GLM(data['Frequency'], data[['Intercept','Temperature']], family=sm.families.Binomial(sm.families.links.logit)).fit()\n",
"\n",
"logmodel.summary()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The most likely estimator of the temperature parameter is 0.0014\n",
"and the standard error of this estimator is 0.122, in other words we\n",
"cannot distinguish any particular impact and we must take our\n",
"estimates with caution."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Estimation of the probability of O-ring malfunction\n",
"\n",
"The expected temperature on the take-off day is 31°F. Let's try to\n",
"estimate the probability of O-ring malfunction at\n",
"this temperature from the model we just built:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEKCAYAAAAcgp5RAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAGyFJREFUeJzt3X2UVPWd5/H3pxuQBhEjkhkFDWSWtHF9ABRQWZ3WqGhORLPrE2vGMRNCdmeMk83Knng2E43Rc2YHd2I26zgy6jgxiUo8iiSHCahjT2Y8PoCCILAIY4g2J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lwH8g2w+6W+5H7B0CAuAzkhYCI4EjyYbF/cde9uOxiNid3z4f+LSkwheWKWQfbTerCAe9VRMB90bEX3SZmY1UWHgU3U72rWYdtwv/zovflIoeltsS+RtZ+Zgx/xeYHhHbJd1CFviltLL3P+biNu8X9elPI+JJzPqJT91YNXkCuFzSkZBdndOH0xznK/uO2FFkY5k/3Yvl1pG9cLyZj+j5nwru2wWMKZjeRvbVfRS1K7YC+NOOYXWVfcdrXS/7ZLZfPqK3qhER6/PRCp+QVEM2ot9/oXfjjf8r8GPgD4D7O66SKWe5EfGWpH8gG6b5V8BzBXf/PXC3pBay9wFuAv5O0m+A5/dTz11koxCuzU8b7SR7ATKrGF9eaQeN/IqWEyLia4Ndi9lA8qkbM7PE+YjezCxxPqI3M0ucg97MLHEOejOzxDnozcwS56A3M0vc/wcowwoTqhaBUgAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"%matplotlib inline\n",
"data_pred = pd.DataFrame({'Temperature': np.linspace(start=30, stop=90, num=121), 'Intercept': 1})\n",
"data_pred['Frequency'] = logmodel.predict(data_pred[['Intercept','Temperature']])\n",
"data_pred.plot(x=\"Temperature\",y=\"Frequency\",kind=\"line\",ylim=[0,1])\n",
"plt.scatter(x=data[\"Temperature\"],y=data[\"Frequency\"])\n",
"plt.grid(True)"
]
},
{
"cell_type": "markdown",
"metadata": {
"hideCode": false,
"hidePrompt": false,
"scrolled": true
},
"source": [
"As expected from the initial data, the\n",
"temperature has no significant impact on the probability of failure of the\n",
"O-rings. It will be about 0.2, as in the tests\n",
"where we had a failure of at least one joint. Let's get back\n",
"to the initial dataset to estimate the probability of failure:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.06521739130434782\n"
]
}
],
"source": [
"data = pd.read_csv(\"shuttle.csv\")\n",
"print(np.sum(data.Malfunction)/np.sum(data.Count))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This probability is thus about $p=0.065$. Knowing that there is\n",
"a primary and a secondary O-ring on each of the three parts of the\n",
"launcher, the probability of failure of both joints of a launcher\n",
"is $p^2 \\approx 0.00425$. The probability of failure of any one of the\n",
"launchers is $1-(1-p^2)^3 \\approx 1.2%$. That would really be\n",
"bad luck.... Everything is under control, so the takeoff can happen\n",
"tomorrow as planned.\n",
"\n",
"But the next day, the Challenger shuttle exploded and took away\n",
"with her the seven crew members. The public was shocked and in\n",
"the subsequent investigation, the reliability of the\n",
"O-rings was questioned. Beyond the internal communication problems\n",
"of NASA, which have a lot to do with this fiasco, the previous analysis\n",
"includes (at least) a small problem.... Can you find it?\n",
"You are free to modify this analysis and to look at this dataset\n",
"from all angles in order to to explain what's wrong."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Hide code",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
#+TITLE: Analysis of the risk of failure of the O-rings on the Challenger shuttle
#+AUTHOR: Arnaud Legrand
#+LANGUAGE: en
#+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: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.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>
#+LATEX_HEADER: \usepackage{a4}
#+LATEX_HEADER: \usepackage[french]{babel}
# #+PROPERTY: header-args :session :exports both
On January 27, 1986, the day before the takeoff of the shuttle /Challenger/, had
a three-hour teleconference was held between
Morton Thiokol (the manufacturer of one of the engines) and NASA. The
discussion focused on the consequences of the
temperature at take-off of 31°F (just below
0°C) for the success of the flight and in particular on the performance of the
O-rings used in the engines. Indeed, no test
had been performed at this temperature.
The following study takes up some of the analyses carried out that
night with the objective of assessing the potential influence of
the temperature and pressure to which the O-rings are subjected
on their probability of malfunction. Our starting point is
the results of the experiments carried out by NASA engineers
during the six years preceding the launch of the shuttle
Challenger.
* Loading the data
We start by loading this data:
#+begin_src python :results value :session *python* :exports both
import numpy as np
import pandas as pd
data = pd.read_csv("shuttle.csv")
data
#+end_src
#+RESULTS:
#+begin_example
Date Count Temperature Pressure Malfunction
0 4/12/81 6 66 50 0
1 11/12/81 6 70 50 1
2 3/22/82 6 69 50 0
3 11/11/82 6 68 50 0
4 4/04/83 6 67 50 0
5 6/18/82 6 72 50 0
6 8/30/83 6 73 100 0
7 11/28/83 6 70 100 0
8 2/03/84 6 57 200 1
9 4/06/84 6 63 200 1
10 8/30/84 6 70 200 1
11 10/05/84 6 78 200 0
12 11/08/84 6 67 200 0
13 1/24/85 6 53 200 2
14 4/12/85 6 67 200 0
15 4/29/85 6 75 200 0
16 6/17/85 6 70 200 0
17 7/29/85 6 81 200 0
18 8/27/85 6 76 200 0
19 10/03/85 6 79 200 0
20 10/30/85 6 75 200 2
21 11/26/85 6 76 200 0
22 1/12/86 6 58 200 1
#+end_example
The data set shows us the date of each test, the number of O-rings
(there are 6 on the main launcher), the
temperature (in Fahrenheit) and pressure (in psi), and finally the
number of identified malfunctions.
* Graphical inspection
Flights without incidents do not provide any information
on the influence of temperature or pressure on malfunction.
We thus focus on the experiments in which at least one O-ring was defective.
#+begin_src python :results value :session *python* :exports both
data = data[data.Malfunction>0]
data
#+end_src
#+RESULTS:
: Date Count Temperature Pressure Malfunction
: 1 11/12/81 6 70 50 1
: 8 2/03/84 6 57 200 1
: 9 4/06/84 6 63 200 1
: 10 8/30/84 6 70 200 1
: 13 1/24/85 6 53 200 2
: 20 10/30/85 6 75 200 2
: 22 1/12/86 6 58 200 1
We have a high temperature variability but
the pressure is almost always 200, which should
simplify the analysis.
How does the frequency of failure vary with temperature?
#+begin_src python :results output file :var matplot_lib_filename="freq_temp_python.png" :exports both :session *python*
import matplotlib.pyplot as plt
plt.clf()
data["Frequency"]=data.Malfunction/data.Count
data.plot(x="Temperature",y="Frequency",kind="scatter",ylim=[0,1])
plt.grid(True)
plt.savefig(matplot_lib_filename)
print(matplot_lib_filename)
#+end_src
#+RESULTS:
[[file:freq_temp_python.png]]
At first glance, the dependence does not look very important, but let's try to
estimate the impact of temperature $t$ on the probability of O-ring malfunction.
* Estimation of the temperature influence
Suppose that each of the six O-rings is damaged with the same
probability and independently of the others and that this probability
depends only on the temperature. If $p(t)$ is this probability, the
number $D$ of malfunctioning O-rings during a flight at
temperature $t$ follows a binomial law with parameters $n=6$ and
$p=p(t)$. To link $p(t)$ to $t$, we will therefore perform a
logistic regression.
#+begin_src python :results value :session *python* :exports both
import statsmodels.api as sm
data["Success"]=data.Count-data.Malfunction
data["Intercept"]=1
# logit_model=sm.Logit(data["Frequency"],data[["Intercept","Temperature"]]).fit()
logmodel=sm.GLM(data['Frequency'], data[['Intercept','Temperature']], family=sm.families.Binomial(sm.families.links.logit)).fit()
logmodel.summary()
#+end_src
#+RESULTS:
#+begin_example
Generalized Linear Model Regression Results
==============================================================================
Dep. Variable: Frequency No. Observations: 7
Model: GLM Df Residuals: 5
Model Family: Binomial Df Model: 1
Link Function: logit Scale: 1.0
Method: IRLS Log-Likelihood: -3.6370
Date: Fri, 20 Jul 2018 Deviance: 3.3763
Time: 16:56:08 Pearson chi2: 0.236
No. Iterations: 5
===============================================================================
coef std err z P>|z| [0.025 0.975]
-------------------------------------------------------------------------------
Intercept -1.3895 7.828 -0.178 0.859 -16.732 13.953
Temperature 0.0014 0.122 0.012 0.991 -0.238 0.240
===============================================================================
#+end_example
The most likely estimator of the temperature parameter is 0.0014
and the standard error of this estimator is 0.122, in other words we
cannot distinguish any particular impact and we must take our
estimates with caution.
* Estimation of the probability of O-ring malfunction
The expected temperature on the take-off day is 31°F. Let's try to
estimate the probability of O-ring malfunction at
this temperature from the model we just built:
#+begin_src python :results output file :var matplot_lib_filename="proba_estimate_python.png" :exports both :session *python*
import matplotlib.pyplot as plt
data_pred = pd.DataFrame({'Temperature': np.linspace(start=30, stop=90, num=121), 'Intercept': 1})
data_pred['Frequency'] = logmodel.predict(data_pred[['Intercept','Temperature']])
data_pred.plot(x="Temperature",y="Frequency",kind="line",ylim=[0,1])
plt.scatter(x=data["Temperature"],y=data["Frequency"])
plt.grid(True)
plt.savefig(matplot_lib_filename)
print(matplot_lib_filename)
#+end_src
#+RESULTS:
[[file:proba_estimate_python.png]]
As expected from the initial data, the
temperature has no significant impact on the probability of failure of the
O-rings. It will be about 0.2, as in the tests
where we had a failure of at least one joint. Let's get back to the initial dataset to estimate the probability of failure:
#+begin_src python :results output :session *python* :exports both
data = pd.read_csv("shuttle.csv")
print(np.sum(data.Malfunction)/np.sum(data.Count))
#+end_src
#+RESULTS:
: 0.06521739130434782
This probability is thus about $p=0.065$. Knowing that there is
a primary and a secondary O-ring on each of the three parts of the
launcher, the probability of failure of both joints of a launcher
is $p^2 \approx 0.00425$. The probability of failure of any one of the
launchers is $1-(1-p^2)^3 \approx 1.2%$. That would really be
bad luck.... Everything is under control, so the takeoff can happen
tomorrow as planned.
But the next day, the Challenger shuttle exploded and took away
with her the seven crew members. The public was shocked and in
the subsequent investigation, the reliability of the
O-rings was questioned. Beyond the internal communication problems
of NASA, which have a lot to do with this fiasco, the previous analysis
includes (at least) a small problem.... Can you find it?
You are free to modify this analysis and to look at this dataset
from all angles in order to to explain what's wrong.
# -*- mode: org -*-
#+TITLE: Emacs/org-mode
#+DATE: Février 2020
#+STARTUP: overview indent
#+OPTIONS: num:nil toc:t
#+PROPERTY: header-args :eval never-export
Ce document explique comment installer Emacs et Org-mode sur votre
machine et recense un certain nombre d'autres références utiles sur
cet environnement.
*Attention:* Les sections [[#une-configuration-emacs-adaptée-à-la-recherche-reproductible][Une configuration Emacs adaptée à la
"recherche reproductible"]] et [[#un-mod%C3%A8le-darticle-r%C3%A9plicable][Un modèle d'article réplicable]]
expliquent comment configurer Emacs/Org-Mode pour ce MOOC. Ce sont donc
des sections très *importantes* qui sont *illustrées dans [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+self-paced/jump_to_id/9cfc7500f0ef46d288d2317ec7b037b4][deux des trois
tutoriels vidéo de cette page]]*. *Nous vous encourageons vivement à
suivre attentivement ces sections* *et ces vidéos avant de vous lancer
dans les exercices*. De même, nous vous encourageons vivement à
regarder la vidéo [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+self-paced/jump_to_id/9cfc7500f0ef46d288d2317ec7b037b4]["utilisation Emacs/git" disponible sur la même page]].
* Table des matières :TOC:
- [[#installation-demacs-python-et-r][Installation d'Emacs, Python et R]]
- [[#latex-pour-la-génération-de-pdf][LaTeX pour la génération de PDF]]
- [[#une-configuration-emacs-adaptée-à-la-recherche-reproductible][Une configuration Emacs adaptée à la "recherche reproductible"]]
- [[#etape-0--sauvegarder-et-supprimer-votre-configuration-précédente][Etape 0 : Sauvegarder et supprimer votre configuration précédente]]
- [[#etape-1--télécharger-notre-configuration][Etape 1 : Télécharger notre configuration]]
- [[#étape-2--préparez-votre-journal][Étape 2 : Préparez votre journal]]
- [[#étape-3--placez-le-fichier-de-configuration-emacs-au-bon-endroit][Étape 3 : Placez le fichier de configuration Emacs au bon endroit]]
- [[#étape-4--adapter-la-configuration-à-vos-besoins-spécifiques-si-nécessaire][Étape 4 : Adapter la configuration à vos besoins spécifiques si nécessaire]]
- [[#etape-5--vérifier-si-linstallation-fonctionne-ou-non][Etape 5 : Vérifier si l'installation fonctionne ou non]]
- [[#étape-6--ouvrez-et-commencez-à-utiliser-votre-journal][Étape 6 : Ouvrez et commencez à utiliser votre journal]]
- [[#un-modèle-darticle-réplicable][Un modèle d'article réplicable]]
- [[#emacs-trucs-et-astuces][Emacs trucs et astuces]]
- [[#pense-bêtes][Pense-bêtes]]
- [[#tutoriels-vidéo][Tutoriels vidéo]]
- [[#paquets-emacs-utiles-supplémentaires][Paquets emacs utiles supplémentaires]]
- [[#autres-ressources][Autres ressources]]
* Installation d'Emacs, Python et R
Il y a beaucoup de façons différentes pour installer Emacs ainsi que
les langages Python et R sur votre ordinateur. Celle que nous
recommandons et décrivons par la suite est basée sur le gestionnaire de
paquets [[https://conda.io/][conda]]. Elle a l'avantage de fonctionner de façon à peu près
identique sous Linux, Windows, et macOS. Son deuxième avantage est que
l'univers conda propose un grand choix de logiciels scientifiques, qui
pourraient vous être utiles pour vos propres projets. Les aguerris en
administration système sont bien sûr libres de choisir une autre
approche, c'est seulement le résultat qui compte !
Téléchargez d'abord la [[https://conda.io/miniconda.html][dernière version de Miniconda]]. Miniconda est
une version légère d'Anaconda, une suite logicielle incluant Python,
Jupyter, R ainsi que les bibliothèques les plus couramment utilisées
en calcul scientifique et en science des données.
Installez Miniconda en suivant les instructions fournies. Si le
logiciel d'installation (ce n'est pas systématique) vous pose la question
#+begin_quote
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
#+end_quote
acceptez avec =yes=. Puis vous verrez le conseil
#+begin_quote
==> For changes to take effect, close and re-open your current shell. <==
#+end_quote
qu'il faut absolument suivre pour que la suite se passe bien.
*Important:* il vous faudra lancer les commandes suivantes
dans le shell conda. Comme expliqué dans la [[https://docs.anaconda.com/anaconda/install/verify-install/][documentation Anaconda]],
pour ouvrir ce shell
- Windows: Click Start, search, ou bien sélectionnez Anaconda Prompt dans le menu.
[[file:Conda_images/win-anaconda-prompt.png]]
- macOS: Cmd+Space pour ouvrir Spotlight Search et tapez “terminal”
pour ouvrir le shell.
- Linux–CentOS: Open Applications - System Tools - terminal.
- Linux–Ubuntu: Open the Dash by clicking the upper left Ubuntu icon, then type “terminal”.
La première commande à lancer est
#+begin_src shell :results output :exports both
conda update -n base -c defaults conda
#+end_src
pour mettre à jour tous les logiciels dans la distribution =conda=.
Nous pouvons maintenant créer un environnement =conda= pour le parcours Emacs/Org-Mode de ce MOOC :
#+begin_src shell :results output :exports both
conda create -n mooc-rr-emacs
#+end_src
et l'activer :
#+begin_src shell :results output :exports both
conda activate mooc-rr-emacs
#+end_src
Il n'est pas strictement nécessaire d'activer un environnement pour
s'en servir, mais c'est la façon la plus facile qui suscite le moins
d'erreurs. *Vous devez répéter cette activation chaque fois que vous ouvrez un nouveau terminal, avant de pouvoir utiliser cet
environnement.*
Le prochain pas est l'installation de tous les logiciels dont nous
avons besoin et qui font partie de la distribution Miniconda :
#+begin_src shell :results output :exports both
conda install python numpy matplotlib r r-ggplot2 r-dplyr r-hmisc
#+end_src
Nous avons également besoin d'un paquet que ne fait pas partie de
Miniconda. Nous le récupérons de la source indépendante [[https://conda-forge.org/][conda-forge]] :
#+begin_src shell :results output :exports both
conda install -c conda-forge emacs r-parsedate
#+end_src
Vous pouvez maintenant lancer =emacs= directement de la ligne de
commande :
#+begin_src shell :results output :exports both
emacs
#+end_src
Sous Windows et macOS, vous êtes peut-être tenté de lancer Emacs directement de l'interface graphique. Il n'est en effet pas difficile de trouver =Emacs.app= dans l'environnement =conda= et de le lancer en direct. Résistez à la tentation. Il faut bien lancer Emacs de la ligne de commande pour qu'il puisse détecter l'environnement que vous avez activé.
* LaTeX pour la génération de PDF
Si vous voulez convertir vos notebooks en PDF, vous devez aussi
installer LaTeX sur votre ordinateur. Nous expliquons cette procédure
dans une [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+self-paced/jump_to_id/19c2b1de7766484bae73f3ab133463c6][ressource spécifique]].
* Une configuration Emacs adaptée à la "recherche reproductible"
Cette section est illustrée dans une [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+self-paced/jump_to_id/9cfc7500f0ef46d288d2317ec7b037b4][vidéo de démonstration]] (/Mise en place en place Emacs/Orgmode/). Nous vous suggérons de la regarder avant de suivre les instructions données dans cette section.
Emacs s'installe avec une configuration par défaut très basique que
chacun va donc vouloir personnaliser. Compte tenu de la flexibilité
d'Emacs, sa configuration peut vite devenir assez complexe et pourrait
même faire l'objet d'un paquet à part entière (voir par exemple les
différents Emacs Starter Kits [[https://kieranhealy.org/resources/emacs-starter-kit/][ici]] ou [[https://www.emacswiki.org/emacs/StarterKits][ici]]). Dans le contexte de ce
MOOC, nous vous proposons une configuration relativement minimaliste
orientée "/recherche reproductible/" avec Org-Mode. Si vous êtes peu
familier d'Emacs, nous vous recommandons fortement de l'utiliser et de
la modifier le moins possible. Il vous suffira de suivre les
instructions données dans cette section. Si vous êtes un utilisateur
Emacs plus expérimenté, vous pouvez vous contenter de regarder nos
instructions et de ne récupérer que les parties qui vous sembleront
utiles.
Quand vous lancez Emacs la première fois avec cette configuration, il téléchargera quelques extensions que nous utilisons dans ce MOOC. Ceci peut prendre un peu de temps (quelques minutes), et peut provoquer des messages d'erreur en cas de difficultés de connexion réseau. En ce cas, il suffit de quitter Emacs et de le relancer. Une fois que tout est correctement installé, Emacs n'affiche plus aucun message d'erreur au démarrage, et n'a plus besoin de connexion réseau.
Il est malheureusement assez probable que certains d'entre vous
rencontreront des problèmes que nous n'avons pas anticipés. Si c'est
votre cas, posez la question sur le forum. Nous ferons de notre mieux
pour vous aider.
** Etape 0 : Sauvegarder et supprimer votre configuration précédente
Si vous avez déjà utilisé Emacs auparavant, il se peut que vous ayez
déjà un fichier de configuration personnel. Et même si ce n'est pas
le cas, il se peut que vous en ayez un sans même le savoir puisque
certains paquets peuvent créer ou modifier les fichiers de
configuration d'Emacs. Afin d'éviter tout problème, nous vous
recommandons donc d'enlever ces anciennes configurations.
Les fichiers que vous devez sauvegarder puis supprimer (s'ils existent) sont :
1. =~/.emacs=
2. =~/.emacs.el=
3. =~/.emacs.elc=
Il y a aussi un répertoire que vous devez sauvegarder puis supprimer (s'il existe), avec tout ce qu'il peut contenir :
4. =~/.emacs.d=
Dans les noms de fichiers ci-dessus, =~/= représente votre répertoire
personnel. Sous Windows, les utilisateurs doivent le remplacer par
=C:\Users\MonNom=, remplaçant MonNom par leur nom d'utilisateur.
** Etape 1 : Télécharger notre configuration
#+begin_src shell :results output :exports none
export FILE_LIST="rr_org/init.el rr_org/journal.org rr_org/init.org"
tar zcf rr_org_archive.tgz $FILE_LIST
#+end_src
Télécharger [[file:rr_org_archive.tgz][cette archive]] et décompressez la. Elle contient les fichiers
suivants et nous y ferons référence par la suite :
#+begin_src shell :results output :exports results
tar tzf rr_org_org_archive.tgz
#+end_src
#+RESULTS:
: rr_org/init.el
: rr_org/journal.org
: rr_org/init.org
Si vous avez des problèmes avec cette archive, [[file:rr_org/][les fichiers dont vous
aurez besoin sont également disponibles ici]]. Vous allez vite réaliser
que la configuration (=init.el= en emacs lisp) est assez difficile à
suivre. C'est pourquoi nous le gérons via un fichier =init.org=, qui
bien plus lisible. C'est une astuce que vous voudrez peut-être aussi
adopter (pour cela, modifiez le =init.org= et régénérez le =init.el= en
/tanglant/ le fichier avec =M-x org-babel-tangle= comme expliqué dans les
instructions au début de =init.org=).
Si vous utilisez Windows, et si vous utilisez un raccourci du bureau pour démarrer Emacs,
il vous faudra inclure le chemin d'accès au fichier =init.el= dans la commande pour le fichier
raccourci. Par exemple, si vous avez installé Emacs en tant que
=C:\Users\MonNom\emacs=, votre raccourci de bureau devrait exécuter la commande
commande =C:\Users\MonNom\emacs\bin\runemacs.exe -l .emacs.d/init.el=.
** Étape 2 : Préparez votre journal
Créez un répertoire =org/= à la racine de votre répertoire personnel:
#+begin_src shell :results output :exports both
mkdir -p ~/org/g/
# sous Windows, utilisez l'explorateur de fichiers pour créer le répertoire C:\Users\MonNom\org
#+end_src
Copiez ensuite le fichier =rr_org/journal.org= dans votre répertoire
=~/org/=. Ce sera votre cahier de laboratoire et toutes les notes que
vous prendrez dans ce dossier avec =C-c c= iront automatiquement dans ce
fichier. La première entrée de ce carnet est remplie de [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/rr_org/journal.org][nombreux de
raccourcis claviers Emacs]] que nous vous encourageons à essayer.
** Étape 3 : Placez le fichier de configuration Emacs au bon endroit
Créez le répertoire =~/.emacs.d/= et copiez =rr_org/init.el= dedans.
** Étape 4 : Adapter la configuration à vos besoins spécifiques si nécessaire
Il y a deux situations dans lesquelles il peut être nécessaire de modifier
=init.el= :
1. Votre environnement réseau vous oblige à utiliser un proxy accéder à internet (protocole HTTP(S)).
2. Vous avez plusieurs installations de Python ou R sur votre ordinateur, ou bien elles se trouvent dans des endroits inhabituels ou ne sont pas entièrement configurées.
Voici comment évaluer votre installation :
1. Ouvrez un nouveau terminal. Si vous utilisez =conda= (comme nous le recommandons), activez l'environnement que vous avez créé pour ce MOOC. Puis essayez d'exécuter les commandes suivantes:
- =python3= et =R= sous Linux et macOS
- =Python= et =R= sous Windows
Si vous n'obtenez pas de message d'erreur, tout va bien et vous ne devriez pas avoir à faire quoi que ce soit pour accéder à Python et R sous Emacs.
2. Si vous avez eu un message d'erreur, il va falloir trouver où vous avez installé Python et/où R. Notez le chemin complet à chaque exécutable - c'est ce qu'il faut insérer dans votre =init.el=.
Si vous devez modifier =init.el=, regardez bien les commentaires dans le fichier =init.org= pour comprendre comment ça marche.
** Etape 5 : Vérifier si l'installation fonctionne ou non
Quittez Emacs s'il est en cours d'exécution, et redémarrez-le. Ce premier lancement devrait
prendre un peu de temps parce qu'Emacs va télécharger quelques paquets supplémentaires. Il vous faudra donc vous assurer que votre ordinateur a une connexion internet pour cette étape. Notez également que le téléchargement peut
échouer pour diverses raisons (surcharge des serveurs de paquets, connexion trop lente, ...).
Ces situations durent rarement bien longtemps. C'est pourquoi si cela arrive, nous vous recommandons de vous contenter de
quittez Emacs (=C-x C-c=, c'est-à-dire =Ctrl + x= suivi de =Ctrl + c=) et
redémarrez-le. Au pire, répétez cette opération jusqu'à ce que vous n'obteniez plus d'erreur au
démarrage.
Ensuite, créez un fichier =foo.org=. Copiez les lignes suivantes dans ce fichier :
: #+begin_src shell :session foo :results output :exports both
: ls -la # ou dir sous Windows
: #+end_src
Placez votre curseur à l'intérieur de ce bloc de code et exécutez-le
avec le raccourci clavier suivante : =C-c C-c= (cela signifie faire
=Ctrl + c= deux fois de suite rapidement).
Un bloc =#+RESULTS:= avec le résultat de la commande devrait alors apparaître.
Dans la vidéo, nous avons déjà fait une petite démonstration des
principales fonctionnalités d'emacs/org-mode qui vous aideront à tenir
à jour un journal et à faire de la programmation lettrée. Une liste des
principales fonctionnalités et des raccourcis est donnée dans le [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/rr_org/journal.org][première
entrée de votre labbook]]. N'hésitez pas à également suivre [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+self-paced/jump_to_id/b031e4067cf8410c86adbeba2f30c92f][cette ressource]] pour découvrir ces raccourcis.
** Étape 6 : Ouvrez et commencez à utiliser votre journal
À l'étape 2, nous vous avons demandé de créer un journal dans le
fichier =~org/journal.org=. C'est dans ce fichier que les notes prises
avec le raccourci =C-c c= (=Ctrl + c= puis =c=) atterrissent. Nous vous
conseillons fortement de vous assurer que ce fichier est stocké dans
un système de contrôle de version comme git. Nous vous laissons la
responsabilité de mettre tout ceci en place mais si vous avez des
problèmes, n'hésitez pas à poser des questions sur le forum du MOOC.
* Un modèle d'article réplicable
Cette section est illustrée dans une [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+self-paced/jump_to_id/9cfc7500f0ef46d288d2317ec7b037b4#tuto3][vidéo]] (/"Écrire un article
réplicable avec Emacs/Orgmode"/). Nous vous suggérons de la regarder avant de suivre les instructions données dans cette section.
Pour travailler avec ce modèle d'article, vous aurez besoin d'installations fonctionnelles de LaTeX, R, et Python. Si vous ne pouvez pas ouvrir un terminal et exécuter les commandes =R=, =pdflatex=, et =python3=, vous ne pourrez pas générer ce document.
Lors de la compilation, l'article télécharge les paquets LaTeX correspondants. Vous devrez donc également disposer d'une connexion réseau fonctionnelle.
Note pour les utilisateurs de macOS : Puisque l'article est compilé à l'aide de =make=, il vous faudra mettre l'exécutable Emacs dans le chemin de recherche de votre shell (voir [[#rendre-r-et-python-disponible-dans-une-console][la section dédiée à ce sujet]]).
#+begin_src shell :results output :exports none
export FILE_LIST="replicable_article/Makefile replicable_article/article.org replicable_article/biblio.bib replicable_article/article.pdf"
make -C replicable_article/ article.pdf
tar zcf replicable_article.tgz $FILE_LIST
#+end_src
#+RESULTS:
Téléchargez l'[[file:replicable_article.tgz][archive]] suivante et décompressez-la. L'archive contient l'article compilé, vous pouvez donc commencer par le consulter.
Pour reconstruire l'article, supprimez =article.pdf=, ou renommez-le en autre chose. Sinon, la procédure de reconstruction vous indiquera simplement que l'article est déjà à jour. Tapez ensuite =make= pour tout construire à partir de zéro. Ouvrez l'article fraîchement construit =article.pdf= pour voir s'il a l'air correct.
Si vous en avez assez de toujours réexécuter tout le code source lors de l'exportation, recherchez la ligne suivante dans [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/replicable_article/article.org][article.org]] :
#+BEGIN_EXAMPLE
# #+PROPERTY: header-args :eval never-export
#+END_EXAMPLE
Si vous supprimez le =#= au début de la ligne qui indique un commentaire, org-mode arrêtera d'évaluer chaque morceau de code à chaque exportation.
* Emacs trucs et astuces
** Pense-bêtes
L'apprentissage d'Emacs et d'Org-Mode peut être difficile car il y a quantité de raccourcis clavier assez inhumaine.
On trouve donc de nombreux pense-bêtes dont voici une sélection à toute fin utile :
*** Emacs
- [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/rr_org/journal.org][Notre liste des raccourcis Emacs les plus utiles dans le contexte de notre configuration emacs /recherche reproductible/.]]
- [[https://www.gnu.org/software/emacs/refcards/pdf/fr-refcard.pdf][Le pense-bête officiel de GNU emacs]]
- Deux superbes pense-bêtes par Sacha Chua sur [[http://sachachua.com/blog/wp-content/uploads/2013/05/How-to-Learn-Emacs-v2-Large.png][comment apprendre Emacs]]
et sur [[http://sachachua.com/blog/wp-content/uploads/2013/08/20130830-Emacs-Newbie-How-to-Learn-Emacs-Keyboard-Shortcuts.png][comment apprendre les raccourcis d'Emacs]].
*** Org-mode
- [[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/rr_org/journal.org][Notre liste des raccourcis Emacs les plus utiles dans le contexte de notre configuration emacs /recherche reproductible/.]]
- [[https://orgmode.org/worg/orgcard.html][Le pense-bête officiel d'org-mode]] ([[https://www.gnu.org/software/emacs/refcards/pdf/orgcard.pdf][en pdf]]).
- [[https://orgmode.org/worg/dev/org-syntax.html][La description officielle de la syntaxe org-mode]] et une [[https://gist.github.com/hoeltgman/3825415][description relativement concise]].
** Tutoriels vidéo
Pour ceux d'entre vous qui préfèrent des explications vidéo, voici une
[[https://www.youtube.com/playlist?list=PL9KxKa8NpFxIcNQa9js7dQIHc81b0-Xg][chaîne Youtube avec de nombreux tutoriels emacs]].
Pour des informations générales sur un certain nombre de paquets, vous pouvez également
vouloir jeter un œil au blog [[https://cestlaz.github.io/stories/emacs/][Using Emacs]].
** Paquets emacs utiles supplémentaires
*** Company-mode
[[http://company-mode.github.io/][Company-mode]] est un paquet permettant d'améliorer les capacités de complétion de texte pour Emacs.
Il offre des capacités de complétion intelligente (et pas uniquement syntaxique) pour la plupart des langages. Si ce type de fonctionnalité vous parait utile, nous vous encourageons à suivre les instructions d'installation du site web officiel:
page Web officielle : [[http://company-mode.github.io/][http://company-mode.github.io/]].
*** Magit
[[https://magit.vc/][Magit]] est une interface Emacs pour Git. Son utilisation est brièvement
illustrée dans le contexte de ce MOOC dans un [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+self-paced/jump_to_id/9cfc7500f0ef46d288d2317ec7b037b4][tutoriel vidéo]].
("/Utilisation Emacs/git/").
C'est un outil vraiment très puissant et nous l'utilisons quotidiennement mais il est nécessaire de
vraiment comprendre ce que fait git dans les coulisses. Si
vous pensez que cela vous serait utile, vous devriez suivre [[https://magit.vc/screenshots/][ce petit tour du propriétaire]] ou bien [[https://www.emacswiki.org/emacs/Magit][cette brève introduction]].
Si vous avez installé notre configuration "/recherche reproductible/",
vous pouvez facilement invoquer magit en utilisant ~C-x g~. Si vous n'êtes pas déjà dans un répertoire sous contrôle de version avec git, Magit vous demandera le chemin de votre copie local du dépôt git
(le chemin vers mooc-rr dans le contexte de ce MOOC).
[[file:emacs_orgmode_images/git1.png]]
Si vous n'utilisez pas notre configuration, vous devriez jeter un coup d'œil à [[https://magit.vc/manual/magit/Installing-from-an-Elpa-Archive.html][comment installer magit à partir d'une archive ELPA]].
La méthode suivante a été testée avec Windows et a fonctionné sans encombre :
- Ajoutez le texte suivant dans votre fichier =.emacs.d/init.el= :
#+begin_src emacs-lisp
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
#+end_src
- Lancez Emacs et exécutez les commandes suivantes :
#+BEGIN_EXAMPLE
M-x package-refresh-contents RET
M-x package-install RET magit RET
#+END_EXAMPLE
NB : =M-= (Meta) correspond à la touche =<Alt>= et =RET= correspond à la touche
=<Entrée>=.
** Autres ressources
- The compact Org-mode Guide ([[https://orgmode.org/orgguide.pdf][lien vers le pdf]])
- Une source inépuisable de magie emacs/org-mode: le site web de Bernt Hansen "[[http://doc.norang.ca/org-mode.html][Organisez votre vie en texte brute]]", dont les sources sont évidemment eux-mêmes un [[http://doc.norang.ca/org-mode.org][document org-mode]].
- [[https://github.com/dfeich/org-babel-examples][De nombreux exemples illustrant l'utilisation de différents langages]].
# -*- mode: org -*-
#+TITLE: Jupyter : Trucs et astuces, installation et configuration
#+AUTHOR: Arnaud Legrand, Benoit Rospars, Konrad Hinsen
#+DATE: Février 2020
#+STARTUP: overview indent
#+OPTIONS: num:nil toc:t
#+PROPERTY: header-args :eval never-export
Quand vous aurez suivi les instructions suivantes, vous
pourrez ouvrir des notebooks Jupyter en tapant une commande shell/DOS :
#+begin_src shell :results output :exports both
jupyter notebook
#+end_src
* Table des matières :TOC:
- [[#jupyter-trucs-et-astuces][Jupyter : Trucs et astuces]]
- [[#création-ou-import-dun-notebook][Création ou import d'un notebook]]
- [[#exécuter-du-code-r-et-du-code-python-dans-le-même-notebook][Exécuter du code R et du code Python dans le même notebook]]
- [[#autres-langages-que-python-et-r][Autres langages que Python et R]]
- [[#améliorer-la-lisibilité-dun-notebook][Améliorer la lisibilité d'un notebook]]
- [[#installation-et-configuration-de-jupyter-sur-votre-ordinateur][Installation et configuration de Jupyter sur votre ordinateur]]
- [[#installation-de-jupyter-et-de-python-r][Installation de Jupyter (et de Python, R...)]]
- [[#latex-pour-la-génération-de-pdf][LaTeX pour la génération de PDF]]
- [[#jupyterlab][JupyterLab]]
- [[#interaction-avec-gitlab-et-git][Interaction avec GitLab et git]]
* Jupyter : Trucs et astuces
Cette [[https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/][page web]] (en anglais) recense un certain nombre d'astuces
relatives à l'utilisation de Jupyter (et en particulier des
illustrations des nombreuses commandes magiques =IPython magic=)
susceptibles d'améliorer votre efficacité (notez bien que ce billet a
plus de deux ans que Jupyter évoluant très rapidement, certaines de
ces astuces ou de ces modules complémentaires font maintenant partie
du comportement par défaut des versions les plus récentes de Jupyter).
** Création ou import d'un notebook
L'environnement Jupyter que nous avons déployé dans le cadre de ce
MOOC vous permettra d'accéder très simplement à tout fichier (et en
particulier les notebooks des différents exercices que nous avons
créés pour vous) de votre projet Gitlab par défaut. Il y a néanmoins
des situations où vous pouvez vouloir utiliser d'autres notebooks que
ceux du MOOC.
- Créer un notebook tout neuf dans un répertoire donné ::
1. À partir du menu : =File -> Open=. Ceci vous permet d'accéder au
gestionnaire de fichiers de Jupyter.
2. Naviguez jusque dans le répertoire dans lequel vous souhaitez
créer votre notebook.
3. Utilisez le bouton en haut à droite : =New -> Notebook: Python 3=.
4. Donnez un nom à votre notebook à partir du menu : =File -> Rename=.
N.B. : Si vous créez un notebook à partir du menu ~File -> New Notebook -> Python 3~,
il sera créé dans le répertoire courant. Le
déplacer après coup est un peu pénible. Il vous faudra aller dans
le gestionnaire de fichiers de Jupyter (menu =File -> Open=),
sélectionner le notebook, l'arrêter (=Shutdown=), puis le déplacer
(=Move=) et/ou le renommer (=Rename=).
- Importer un notebook déjà existant :: Si le notebook qui vous
intéresse est déjà dans votre projet GitLab, il vous suffit de
synchroniser la copie de votre Jupyter à l'aide du bouton =Git pull=
et d'utiliser le menu =File -> Open=. Dans le cas contraire,
par exemple si souhaitez importer cet
[[https://app-learninglab.inria.fr/gitlab/moocrr-session2/moocrr-reproducibility-study/blob/master/src/Python3/challenger.ipynb][autre notebook]]
rédigé par quelqu'un d'autre, procédez de la façon suivante :
1. Téléchargez le fichier sur votre répertoire. Pour ce [[https://app-learninglab.inria.fr/gitlab/moocrr-session2/moocrr-reproducibility-study/blob/master/src/Python3/challenger.ipynb][Notebook
hébergé sur un GitLab]], cliquez sur =Open raw= (l'icône avec
un petit =</>= ) et sauvegardez (=Ctrl-S= sur la plupart des
navigateurs) son contenu (un long fichier texte au format JSON).
2. Ouvrez le gestionnaire de fichiers de Jupyter via le menu =File -> Open=
et naviguez jusqu'au répertoire où vous souhaitez déposer votre notebook.
3. Utilisez le bouton en haut à droite =Upload= pour transférer le
document de votre ordinateur vers le serveur Jupyter et confirmez
l'upload.
4. Vous pouvez maintenant ouvrir le notebook fraîchement récupéré
à l'aide du navigateur de fichiers de Jupyter et réexécuter le
code correspondant.
** Exécuter du code R et du code Python dans le même notebook
C'était impossible avec les premières versions de Jupyter mais c'est
désormais très facile grâce à la bibliothèque Python =rpy2= (les détails
d'installation sont donnés plus bas dans ce document). Il vous
faut tout d'abord ouvrir un notebook Python.
1. Chargez la bibliothèque =rpy2=. Le =%load_ext= est une commande magique
Jupyter qui charge cette bibliothèque et vous donne accès à de
nouvelles commandes magiques.
#+begin_src python :results output :exports both
%load_ext rpy2.ipython
#+end_src
2. Utilisez la (nouvellement activée) commande magique =%R= :
#+begin_src python :results output :exports both
%%R
summary(cars)
#+end_src
Les objets Python peuvent même être passé à R de la façon suivante
(ici, on suppose que =df= est une dataframe pandas) :
#+begin_src python :results output :exports both
%%R -i df
plot(df)
#+end_src
Cette notation =%%R= indique à Python et à Jupyter et que le langage R
doit être utilisé pour évaluer l'ensemble de la cellule. En interne,
Python (=rpy2=) maintient une session R, lui passe le code de la cellule
et récupère le résultat. Jupyter fait alors le nécessaire pour
l'afficher correctement. Il est également possible d'utiliser =%R= pour
avoir une seule ligne de R au sein d'une cellule Python.
Un exemple de notebook utilisant R et Python est proposé [[file:../../documents/notebooks/notebook_Jupyter_Python_R.ipynb][ici]].
** Autres langages que Python et R
Jupyter tire son nom des langages Julia, Python, et R. Il ne se limite
donc pas aux langages Python et R. De nombreux autres langages de
programmation sont disponibles :
[[https://github.com/jupyter/jupyter/wiki/Jupyter-kernels][https://github.com/jupyter/jupyter/wiki/Jupyter-kernels]], et en
particulier des langages non libres comme SAS, Mathematica,
Matlab... Notez que la maturité de ces noyaux est très variable.
Nous n'avons déployé aucun de ces autres langages dans le cadre du
MOOC mais nous vous invitons à lire les sections suivantes pour
apprendre à déployer votre propre instance de Jupyter et activer
certaines de ses extensions.
Vous trouverez [[file:../../documents/notebooks/][ici]] une liste de notebooks Jupyter illustrant comment
différents langages (Python, R, SAS) peuvent être utilisés dans Jupyter.
*** SAS
SAS est un logiciel de statistiques propriétaires qui est très
couramment utilisé dans le domaine de la santé. Puisque la question
est posée de façon récurrente, si vous avez besoin d'utiliser le
langage SAS plutôt que le langage R, il y a deux façons d'utiliser SAS
avec Jupyter : soit avec le noyau [[https://sassoftware.github.io/sas_kernel/][Python SASKernel]] (l'équivalent du
=IRKernel=), soit avec la bibliothèque [[https://sassoftware.github.io/saspy/][Python SASPy]] (l'équivalent de
=rpy2=).
Malgré la qualité et la stabilité de ce langage, SAS n'en reste pas
moins un langage propriétaire, ce qui rend l'inspection de ses
procédures très difficile et limite la réutilisation des procédures
produites par d'autres chercheurs. Nous le déconseillons donc dans un
objectif de recherche reproductible mais il faut aussi savoir ne pas
être dogmatique. La perfection n'existe pas ;) et, même en utilisant
SAS, l'utilisation de la programmation lettrée de Jupyter et d'un
contrôle de version (avec GitLab) et d'environnement (avec Docker par
exemple) se révélera très certainement précieux.
*[[https://sassoftware.github.io/saspy/][SASPy]]*
- Installer =saspy= via =pip=, par exemple comme ceci :
#+begin_src shell :results output :exports both
python -m pip install saspy
#+end_src
- Sous Windows, il vous faudra probablement modifier le fichier
=C:\Program Files\Python\Python37\Lib\site-packages\saspy\sascfg.py=
et l'adapter à votre propre système. Dans les deux captures d'écran
suivantes, la fenêtre de gauche correspond à la version originale du
fichier et celle de droite à la version modifiée :
#+BEGIN_CENTER
[[file:jupyter_images/sascfg1.png]]
#+END_CENTER
#+BEGIN_CENTER
[[file:jupyter_images/sascfg2.png]]
#+END_CENTER
- Voici un [[file:../../documents/notebooks/notebook_Jupyter_Python_SAS.ipynb][exemple de notebook Python/SAS]].
- N.B. : L'export du format HTML (et donc SAS) vers le format PDF via LaTeX ne fonctionne pas
([[file:../../documents/notebooks/notebook_html_export_pdf_via_latex.pdf][notebook_html_export_pdf_via_latex.pdf]]).
Jusqu'à présent il était possible de faire l'export depuis Pandoc. Une façon de faire était
d'exporter le notebook au format HTML (ou Markdown) dans Jupyter puis d'exécuter la commande suivante :
#+begin_src shell :results output :exports both
pandoc --variable=geometry:a4paper --variable=geometry:margin=1in notebook_sas.html -o notebook_sas.pdf
#+end_src
L’extension [[https://pypi.org/project/notebook-as-pdf/][notebook-as-pdf]] permet maintenant l’export
direct du format HTML vers le format PDF
([[file:../../documents/notebooks/notebook_html_export_pdf_via_html.pdf][notebook_html_export_pdf_via_html.pdf]])
et donc l’export des notebooks SAS au format PDF
([[file:../../documents/notebooks/notebook_Jupyter_SAS.pdf][notebook_Jupyter_SAS.pdf]]).
(Choisir l'export PDF via HTML.)
- Une référence, plus complète, et bien utile en cas de difficultés :
[[https://sassoftware.github.io/saspy/]]
*[[https://sassoftware.github.io/sas_kernel/install.html][SASKernel]]*
- Le =sas_kernel= utilise =saspy= donc la première chose à faire est
d'installer =saspy= en suivant les instructions précédentes.
- Installez =sas_kernel= à l'aide de =pip=, par exemple comme ceci :
#+begin_src shell :results output :exports both
python -m pip install sas_kernel
#+end_src
- Yous pourrez alors créer des notebooks utilisant SAS nativement :
#+BEGIN_CENTER
[[file:jupyter_images/new_notebook.png]]
#+END_CENTER
#+BEGIN_CENTER
[[file:jupyter_images/notebook_SAS.png]]
#+END_CENTER
Vous pouvez remarquer la petite icône SAS en haut à droite.
- À toute fin utile, voici un [[file:../../documents/notebooks/notebook_Jupyter_SAS.ipynb][exemple de notebooks SAS]].
- Une référence, plus complète, et bien utile en cas de difficultés :
[[https://sassoftware.github.io/sas_kernel/install.htmlxo]].
** Améliorer la lisibilité d'un notebook
Lorsque les notebooks s'allongent, ils deviennent vite difficiles à
lire. Voici quelques extensions (la liste officielle de ces extensions
est [[https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions.html][ici]]) qui peuvent vous faciliter un peu la
vie :
- Il est possible [[https://stackoverflow.com/questions/33159518/collapse-cell-in-jupyter-notebook][plier/déplier votre code]] :
#+begin_src shell :results output :exports both
pip3 install jupyter_contrib_nbextensions
# jupyter contrib nbextension install --user # not done yet
#+end_src
- Il est aussi possible de [[https://github.com/kirbs-/hide_code][contrôler la visibilité des cellules]], ce
qui peut être très utile si on exporte le notebook :
#+begin_src sh :results output :exports both
sudo pip3 install hide_code
sudo jupyter-nbextension install --py hide_code
jupyter-nbextension enable --py hide_code
jupyter-serverextension enable --py hide_code
#+end_src
Vous pourrez alors choisir =Hide_code= dans le menu de Jupyter :
#+BEGIN_CENTER
[[file:jupyter_images/menu_hide_code.png]]
#+END_CENTER
Cela devrait vous permettre d'obtenir ce genre de panneau de
configuration pour chaque cellule :
#+BEGIN_CENTER
[[file:jupyter_images/hide_code.png]]
#+END_CENTER
Il vous faudra utiliser les icônes pour faire l'export en pdf ou en
html plutôt que de passer par le menu.
#+BEGIN_CENTER
[[file:jupyter_images/export_hide_code.png]]
#+END_CENTER
N.B. : Dans la première édition de ce MOOC, certains participants nous
ont rapporté avoir eu des difficultés à faire fonctionner cette
extension sous Windows.
- Table des matières: L'extention [[https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/toc2/README.html][toc(2)]] améliore également beaucoup la navigation et la capacité à avoir une vue d'ensemble du notebook.
* Installation et configuration de Jupyter sur votre ordinateur
Dans cette section, nous expliquons comment installer, sur votre
ordinateur, un environnement Jupyter similaire à celui que nous avons
déployé pour ce MOOC.
** Installation de Jupyter (et de Python, R...)
Téléchargez d'abord la [[https://conda.io/miniconda.html][dernière version de Miniconda]]. Miniconda
est une version légère d'Anaconda, une suite logicielle incluant
Python, Jupyter, R ainsi que les bibliothèques les plus couramment
utilisées en calcul scientifique et en science des données.
Sur notre serveur, nous utilisons la version =4.5.4= de Miniconda et
la version =3.6= de Python. En théorie, vous pourriez télécharger le
[[https://gist.github.com/brospars/4671d9013f0d99e1c961482dab533c57][fichier d'environnement =mooc_rr= ]] et reproduire un environnement
identique sur votre ordinateur. Malheureusement, notre serveur date de
2018 et conda a beaucoup changé entretemps, au point que la
reconstruction de cet environnement n'est plus possible. Nous vous
montrons par la suite comment obtenir un environnement équivalent mais
avec des versions plus récentes de tous les logiciels.
Installez Miniconda en suivant les instructions fournies. Si le
logiciel d'installation (ce n'est pas systématique) vous pose la question
#+begin_quote
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
#+end_quote
acceptez avec =yes=. Puis vous verrez le conseil
#+begin_quote
==> For changes to take effect, close and re-open your current shell. <==
#+end_quote
qu'il faut absolument suivre pour que la suite se passe bien.
*Important :* il vous faudra exécuter plusieurs commandes dans le shell conda.
Voici d'abord comment ouvrir ce shell (comme expliqué dans la
[[https://docs.anaconda.com/anaconda/install/verify-install/][documentation Anaconda]]) :
- Windows : Click Start, search, ou bien sélectionnez Anaconda Prompt dans le menu.
[[file:Conda_images/win-anaconda-prompt.png]]
- macOS : Cmd+Space pour ouvrir Spotlight Search et tapez “terminal”
pour ouvrir le shell.
- Linux–CentOS : Open Applications - System Tools - terminal.
- Linux–Ubuntu : Open the Dash by clicking the upper left Ubuntu icon, then type “terminal”.
La première commande à exécuter dans le shell est
#+begin_src shell :results output :exports both
conda update -n base -c defaults conda
#+end_src
pour mettre à jour tous les logiciels dans la distribution =conda=.
Nous pouvons maintenant créer un environnement =conda= pour le
parcours Jupyter de ce MOOC :
#+begin_src shell :results output :exports both
conda create -n mooc-rr-jupyter
#+end_src
et l'activer :
#+begin_src shell :results output :exports both
conda activate mooc-rr-jupyter
#+end_src
Il n'est pas strictement nécessaire d'activer un environnement pour
s'en servir, mais c'est la façon la plus facile qui suscite le moins
d'erreurs. *Vous devez répéter cette activation chaque fois que vous ouvrez un
nouveau terminal, avant de pouvoir utiliser cet environnement.*
Le prochain pas est l'installation de tous les logiciels dont nous
avons besoin et qui font partie de la distribution Miniconda :
#+begin_src shell :results output :exports both
conda install jupyter python numpy matplotlib pandas r r-irkernel rpy2 tzlocal simplegeneric
#+end_src
Il reste deux paquets que ne font pas partie de Miniconda. Nous
récupérons le premier de la source indépendante [[https://conda-forge.org/][conda-forge]] :
#+begin_src shell :results output :exports both
conda install -c conda-forge r-parsedate
#+end_src
et le deuxième du dépôt principal du langage Python, [[https://pypi.org/][PyPI]] :
#+begin_src shell :results output :exports both
pip install isoweek
#+end_src
Vous pouvez maintenant lancer Jupyter :
#+begin_src shell :results output :exports both
jupyter notebook
#+end_src
et travailler avec nos exemples et exercices.
** LaTeX pour la génération de PDF
Si vous voulez convertir vos notebooks en PDF, vous devez aussi
installer LaTeX sur votre ordinateur. Nous expliquons cette procédure
dans une [[https://www.fun-mooc.fr/courses/course-v1:inria+41016+self-paced/jump_to_id/19c2b1de7766484bae73f3ab133463c6][ressource spécifique]].
** JupyterLab
Notez que les notebooks Jupyter ne constituent qu'une petite partie de
l'écosystème et que Jupyter fait maintenant partie d'un projet plus
large, [[https://blog.jupyter.org/jupyterlab-is-ready-for-users-5a6f039b8906][JupyterLab]], qui permet d'assembler différents composants (dont
les notebooks) dans votre navigateur. Dans le cadre de ce MOOC, nous
avons manqué de temps pour bénéficier de tout JupyterLab qui était
toujours en développement actif. À l'heure actuelle, vous pouvez
cependant avoir intérêt à installer JupyterLab sur votre ordinateur
(avec l'environnement =mooc-rr-jupyter= activé) :
#+begin_src shell :results output :exports both
conda install jupyterlab
#+end_src
Pour le lancer :
#+begin_src shell :results output :exports both
jupyter lab
#+end_src
** Interaction avec GitLab et git
Pour vous simplifier la vie, nous avons rajouté des boutons
=pull/push= dans Jupyter qui vous permettent de synchroniser vos
modifications avec GitLab. Ce développement spécifique pour ce MOOC
s'est inspiré d'une [[https://github.com/Lab41/sunny-side-up][preuve de concept]] précédente mais est vraiment /ad
hoc/. Indépendemment et à peu près au même moment, une autre personne a
développé un [[https://github.com/sat28/githubcommit][Plugin Jupyter assez générique permettant de se
synchroniser avec Gitlab ou Github]]. Si cette fonctionnalité vous
intéresse, c'est donc une piste intéressante à explorer. Sinon,
souvenez-vous qu'il est très simple d'insérer une cellule shell dans
Jupyter et vous pouvez facilement y insérer des commandes
Git. C'est la façon dont nous travaillons en pratique la majorité du
temps. Si vous optez pour cette solution, il vous faudra configurer Git sur votre
ordinateur. Pour ce faire, vous pouvez suivre la vidéo
[[https://www.fun-mooc.fr/courses/course-v1:inria+41016+self-paced/jump_to_id/7508aece244548349424dfd61ee3ba85][configurer Git pour Gitlab]] et le document
[[https://gitlab.inria.fr/learninglab/mooc-rr/mooc-rr-ressources/blob/master/module2/ressources/gitlab_fr.org][Git et Gitlab]] correspondant.
Ceci étant dit, vous avez certainement remarqué que Jupyter conserve
une trace parfaite de l'ordre dans lequel les cellules ont été
exécutées en incrémentant leur "indice". C'est une très bonne
propriété d'un point de vue reproductibilité mais il se peut, selon
votre usage, que cela s'avère peu pratique du point de vue du suivi de
version. Certaines personnes ont donc développé des
[[https://gist.github.com/pbugnion/ea2797393033b54674af][git hooks spécifiques]]
permettant d'ignorer ces numéros lorsque l'on commite des
notebooks Jupyter. Il y eu de longues discussions à ce sujet sur
[[https://stackoverflow.com/questions/18734739/using-ipython-notebooks-under-version-control][StackOverflow]], [[https://discourse.jupyter.org/t/how-to-version-control-jupyter-notebooks/566/14][the Jupyter Forum]], et [[https://nextjournal.com/schmudde/how-to-version-control-jupyter][NextJournal]], qui détaillent différentes options.
Enfin, pour ceux qui utilisent [[https://blog.jupyter.org/jupyterlab-is-ready-for-users-5a6f039b8906][JupyterLab]] plutôt que le Jupyter de
base, un [[https://github.com/jupyterlab/jupyterlab-git][plugin Git pour JupyterLab]] a été développé et offre des
fonctionnalités de suivi de version dignes d'un IDE classique.
# -*- mode: org -*-
#+TITLE: Ressources externes pour découvrir git
#+DATE: June, 2018
#+STARTUP: overview indent
#+OPTIONS: num:nil toc:t
#+PROPERTY: header-args :eval never-export
Pour les débutants Git, voici quelques liens qui vous permettront de vous familiariser avec cet outil très puissant :
- Pour apprendre à utiliser Git en ligne de commande , voici [[http://swcarpentry.github.io/git-novice/][le cours proposé par Software Carpentry]], sous forme de TP avec des explications très progressives (cours en anglais).
- Le livre [[https://git-scm.com/book/fr/v2][Pro Git]] est disponible, gratuitement, légalement. La lecture des deux premiers chapitres vous suffira pour démarrer (livre en français)
- [[https://learngitbranching.js.org/][Learn Git Branching]] vous permettra d'apprendre Git de façon interactive et de bien comprendre les notions de branches (cours en français)