Commit 118ced84 authored by MEULE Samuel's avatar MEULE Samuel
Browse files

Modification de tout les jupyters

# Historique
* [X] ajouts des fichiers data NKE
* [X] retrait du fichier scriptNKE jupyter
* [X] ajout de la théorie linéaire dans spectral analysis
* [X] Modif TD7 vierge
* [X] Ajout TD lecture aquadopp
* [X] script NKE: Modification de la figure avec le temps pour que cela fontionne sur une ancienne version de matplotlib (sur les serveurs AMU)
* [X] Ajout package latex pour Mybinder dans requirements: ne marche pas
* [X] Ajout du fichier .ipynb pour TD NKE + fichier NKE
* [X] TD lecture de fichier NKE
* [X] Mise en place sous gitlab.osupytheas.fr
* [X] Ajout d'un debut de script TD7 (a remplir) + ajout des fichiers 2 à 10.txt (différentes series temporelles)
* [X] Ajout des notebooks TD2 à TD8 + ajout des fichiers
* [X] Ajout de requirements.txt pour gestion des dépendances
* [X] Ajout du fichier .py et du notebook jupyter .ipynb pour TD1
* [X] Création d'un git pour Stat
parent 6fa818bc
Modification des jupyter
Modification de tout les jupyters
# Historique
* [X] ajouts des fichiers data NKE
* [X] retrait du fichier scriptNKE jupyter
......
......@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Entete"
"# Entête"
]
},
{
......@@ -137,12 +137,12 @@
"plt.ylabel(\"u\")\n",
"plt.axis([0,2,-2,2])\n",
"plt.grid()\n",
"plt.show()\n",
"\n",
"\n",
"# Save the figure\n",
"fig1.savefig('Figure_TD1',dpi=200)\n",
"# Show the figure\n",
"plt.show()\n"
"# Show the figure\n"
]
}
],
......
%% Cell type:markdown id: tags:
# Entete
# Entête
%% Cell type:markdown id: tags:
Cette entête permet d'indiquer que le script contient du langage python et que l'encodage est en utf-8 (encodage classique respectant des normes iso)
%% Cell type:code id: tags:
``` python
#!/usr/bin/python
# coding: utf-8
```
%% Cell type:markdown id: tags:
# Importation des modules
%% Cell type:markdown id: tags:
Permet d'importer les modules python nécessaires à la réalisation du code
%% Cell type:code id: tags:
``` python
#################################################"
## MODULES #####"
#################################################"
import matplotlib.pyplot as plt
import numpy as np
#################################################"
```
%% Cell type:markdown id: tags:
# Mise en place des paramètres
%% Cell type:markdown id: tags:
Il s'agit ici des paramètres liés aux différentes fonctions
%% Cell type:code id: tags:
``` python
# Parameters
N = 500 # Number of sampling
Tmax = 2.0 # Max time
Te = Tmax/N # Delta time between each measurements
f1=1 # Acquisition frequency
t = np.arange(0, Tmax, Te) # Time vector
```
%% Cell type:markdown id: tags:
# Définition des fonctions
%% Cell type:code id: tags:
``` python
# Functions
u1=0.5*1.0*np.cos(2*np.pi*f1*t)
u2=0.3*np.cos(2*2*np.pi*f1*t-np.pi/3)
u=u1+u2
```
%% Cell type:markdown id: tags:
# Figures
%% Cell type:code id: tags:
``` python
# Figure
fig1=plt.figure(figsize=(10,5))
plt.plot(t,u, 'k', label='u')
#plt.hold(True)
plt.plot(t,u1, 'r--', label='u1')
plt.plot(t,u2, 'g--', label='u2')
plt.legend()
plt.xlabel("t")
plt.ylabel("u")
plt.axis([0,2,-2,2])
plt.grid()
plt.show()
# Save the figure
fig1.savefig('Figure_TD1',dpi=200)
# Show the figure
plt.show()
```
%%%% Output: display_data
......
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Entête"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Cette entête permet d'indiquer que le script contient du langage python et que l'encodage est en utf-8 (encodage classique respectant des normes iso)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"#!/usr/bin/python\n",
"# coding: utf-8\n",
"\n",
"# coding: utf-8"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Importation des modules"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Permet d'importer les modules python nécessaires à la réalisation du code"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"#################################################\" \n",
"## MODULES #####\"\n",
"#################################################\"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"#################################################\"\n",
"\n",
"#################################################\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Mise en place des paramètres"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Il s'agit ici des paramètres liés aux différentes fonctions "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# Parameters\n",
"\n",
"N = 500 # Number of sampling\n",
"Tmax = 2.0 # Max time\n",
"Te = Tmax/N # Delta time between each measurements\n",
"f1=1 # Acquisition frequency\n",
"t = np.arange(0, Tmax, Te) # Time vector\n",
"\n",
"t = np.arange(0, Tmax, Te) # Time vector\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Définition des fonctions"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Functions\n",
"u1=0.5*1.0*np.cos(2*np.pi*f1*t)\n",
"u2=0.3*np.cos(2*2*np.pi*f1*t-np.pi/3)\n",
"u=u1+u2\n",
"\n",
"u=u1+u2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analyse de fourrier"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# fft analysis\n",
"Puu=np.abs(np.fft.fft(u,N)/N)**2 # Density spectrum\n",
"freqs=np.linspace(0,1/Te,len(Puu)) # frequencies\n",
"\n",
"freqs=np.linspace(0,1/Te,len(Puu)) # frequencies"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Figures"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmcAAAFBCAYAAAAyrwinAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAuw0lEQVR4nO3deZhc1Xnv+++r1jwgJCEmIdFCrW4u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re9cuI+Cs6/3nM7bL5ReBwDGdS3TKcSRoItnR5H8D/m1K6rusOEfGZfRy/izce4xje7Vx/nlK6p9u5ZgDbu2zazT7+vkwpbY2InwJn07nW37t62G1bt7b3KSL+CPgY8IfdvhpePJekOuUzZ5IGmnuASyNiNEBETIqIg4H/BM6JiBHF57v+uMsxK3kjMJ3b7VxXRsSQ4rlaI2LUPtruAA6LiBOL+4/p8vzXDcD/BzySUnqlh2OfothtuT8RcSQwF/hYSql7EGvlrd2jkuqId84kDSgppXsj4v8CHiw+o78ZuDCl9FhE3AE8TmfX3yNdDvtH4M6ImAX8qMv2G+jsrnys+MD/S8A5+2h7R0ScB/xLRIyg8w7WHwGbU0q/johNwLf2cuzTETE2IsaklF7dz8/8M2AC8MPib3w2pfRfI+IQOrs5n9/P8ZIGsEgp1boGSaq4iPgSnaHpH6vU3uFAO3D03qb6iIjPAq+mlG7oYxufBTallG7sc6GScs9uTUnqp4i4CHgIuGo/c7DN583PsvXWBuDmfhwvaQDwzpkkSVKOeOdMkiQpRwxnkiRJOWI4kyRJyhHDmSRJUo4YziRJknLEcCZJkpQj/wcIsOp32eW+sAAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 720x360 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Figure\n",
"fig1=plt.figure(figsize=(10,5))\n",
"plt.plot(freqs,Puu, 'ko-', label='u')\n",
......@@ -49,9 +159,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "myenv",
"language": "python",
"name": "python3"
"name": "myenv"
},
"language_info": {
"codemirror_mode": {
......
%% Cell type:markdown id: tags:
# Entête
%% Cell type:markdown id: tags:
Cette entête permet d'indiquer que le script contient du langage python et que l'encodage est en utf-8 (encodage classique respectant des normes iso)
%% Cell type:code id: tags:
``` python
#!/usr/bin/python
# coding: utf-8
```
%% Cell type:markdown id: tags:
# Importation des modules
%% Cell type:markdown id: tags:
Permet d'importer les modules python nécessaires à la réalisation du code
%% Cell type:code id: tags:
``` python
#################################################"
## MODULES #####"
#################################################"
import matplotlib.pyplot as plt
import numpy as np
#################################################"
```
# Parameters
%% Cell type:markdown id: tags:
# Mise en place des paramètres
%% Cell type:markdown id: tags:
Il s'agit ici des paramètres liés aux différentes fonctions
%% Cell type:code id: tags:
``` python
# Parameters
N = 500 # Number of sampling
Tmax = 2.0 # Max time
Te = Tmax/N # Delta time between each measurements
f1=1 # Acquisition frequency
t = np.arange(0, Tmax, Te) # Time vector
```
%% Cell type:markdown id: tags:
# Définition des fonctions
%% Cell type:code id: tags:
``` python
# Functions
u1=0.5*1.0*np.cos(2*np.pi*f1*t)
u2=0.3*np.cos(2*2*np.pi*f1*t-np.pi/3)
u=u1+u2
```
%% Cell type:markdown id: tags:
# Analyse de fourrier
%% Cell type:code id: tags:
``` python
# fft analysis
Puu=np.abs(np.fft.fft(u,N)/N)**2 # Density spectrum
freqs=np.linspace(0,1/Te,len(Puu)) # frequencies
```
%% Cell type:markdown id: tags:
# Figures
%% Cell type:code id: tags:
``` python
# Figure
fig1=plt.figure(figsize=(10,5))
plt.plot(freqs,Puu, 'ko-', label='u')
plt.axis([0,11,0,0.1])
plt.xlabel("Frequency (Hz)")
plt.ylabel("Power spectrum")
plt.grid()
plt.show()
# Save the figure
fig1.savefig('Figure_TD2',dpi=200)
```
%%%% Output: display_data
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Entête"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Cette entête permet d'indiquer que le script contient du langage python et que l'encodage est en utf-8 (encodage classique respectant des normes iso)"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"#!/usr/bin/python\n",
"# coding: utf-8\n",
"\n",
"# coding: utf-8"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Importation des modules"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Permet d'importer les modules python nécessaires à la réalisation du code"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"#################################################\" \n",
"## MODULES #####\"\n",
"#################################################\"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"#################################################\"\n",
"n=1 # Number of harmonics\n",
"\n",
"# Read ascii file\n",
"\n",
"#################################################\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Lecture d'un fichier"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"ename": "FileNotFoundError",
"evalue": "[Errno 2] No such file or directory: 'fichier2.txt'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-4-9c84ca3ca8f3>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'fichier2.txt'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'r'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0mlines\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadlines\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mu\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'fichier2.txt'"
]
}
],
"source": [
"filename='fichier2.txt'\n",
"with open(filename, 'r') as f:\n",
" lines=f.readlines()\n",
......@@ -30,21 +88,109 @@
" u.append(float(value[1])) # Read the second column: function u \n",
"\n",
"t=np.array(t)\n",
"u=np.array(u)\n",
"u=np.array(u)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Mise en place des paramètres"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Il s'agit ici des paramètres liés aux différentes fonctions "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Parameters\n",
"f1=1\n",
"N=len(t)\n",
"Tmax=np.round(max(t))\n",
"f1=1 # Acquisition frequency (Hz)\n",
"N=len(t) # Number of sampling\n",
"Tmax=np.round(max(t)) # Max time\n",
"n=1 # Number of harmonics"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Définition des fonctions"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Functions\n",
"\n",
"u1=0.5*np.cos(1*2*np.pi*f1*t)\n",
"u2=0.3*np.cos(2*2*np.pi*f1*t-np.pi/3)\n",
"u3=0.5*np.cos(3*2*np.pi*f1*t+np.pi/3)\n",
"u4=0.1*np.cos(4*2*np.pi*f1*t)\n",
"u=u1+u2+u3+u4\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analyse de fourrier"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# fft analysis\n",
"y=np.fft.fft(u) #Fast Fourier Transform\n",
"\n",
"y=np.fft.fft(u) #Fast Fourier Transform\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Reconstruction du signal"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# order of the filtering\n",
"m=int(Tmax)*f1*n+1\n",
"y[m:-m]=0\n",
"# Reverse fft and normalize\n",
"Y=np.fft.ifft(y)\n",
"Y=Y.real\n",
"Y=Y.real"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Figures"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Figure\n",
"fig1=plt.figure(figsize=(10,5))\n",
"plt.plot(t,u, 'r--', label=\"Original dataset\")\n",
......@@ -59,9 +205,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "myenv",
"language": "python",
"name": "python3"
"name": "myenv"
},
"language_info": {
"codemirror_mode": {
......
%% Cell type:markdown id: tags:
# Entête
%% Cell type:markdown id: tags:
Cette entête permet d'indiquer que le script contient du langage python et que l'encodage est en utf-8 (encodage classique respectant des normes iso)
%% Cell type:code id: tags:
``` python
#!/usr/bin/python
# coding: utf-8
```
%% Cell type:markdown id: tags:
# Importation des modules
%% Cell type:markdown id: tags:
Permet d'importer les modules python nécessaires à la réalisation du code
%% Cell type:code id: tags:
``` python
#################################################"
## MODULES #####"
#################################################"
import matplotlib.pyplot as plt
import numpy as np
#################################################"
n=1 # Number of harmonics
```
%% Cell type:markdown id: tags:
# Read ascii file
# Lecture d'un fichier
%% Cell type:code id: tags:
``` python
filename='fichier2.txt'
with open(filename, 'r') as f:
lines=f.readlines()
t=[]
u=[]
for l in lines:
value=l.strip().split("\t")
t.append(float(value[0])) # Read the first column: time t
u.append(float(value[1])) # Read the second column: function u
t=np.array(t)
u=np.array(u)
```
%%%% Output: error
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-4-9c84ca3ca8f3> in <module>
1 filename='fichier2.txt'
----> 2 with open(filename, 'r') as f:
3 lines=f.readlines()
4 t=[]
5 u=[]
FileNotFoundError: [Errno 2] No such file or directory: 'fichier2.txt'
%% Cell type:markdown id: tags:
# Mise en place des paramètres
%% Cell type:markdown id: tags:
Il s'agit ici des paramètres liés aux différentes fonctions
%% Cell type:code id: tags:
``` python
# Parameters
f1=1
N=len(t)
Tmax=np.round(max(t))
f1=1 # Acquisition frequency (Hz)
N=len(t) # Number of sampling
Tmax=np.round(max(t)) # Max time
n=1 # Number of harmonics
```
%% Cell type:markdown id: tags:
# Définition des fonctions
%% Cell type:code id: tags:
``` python
# Functions
u1=0.5*np.cos(1*2*np.pi*f1*t)
u2=0.3*np.cos(2*2*np.pi*f1*t-np.pi/3)
u3=0.5*np.cos(3*2*np.pi*f1*t+np.pi/3)
u4=0.1*np.cos(4*2*np.pi*f1*t)
u=u1+u2+u3+u4
```
%% Cell type:markdown id: tags:
# Analyse de fourrier
%% Cell type:code id: tags: