Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cb1e5ba91280d02583d0604166e71c1c
mooc-rr
Commits
62e4f7ad
Commit
62e4f7ad
authored
Apr 07, 2020
by
cb1e5ba91280d02583d0604166e71c1c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no commit message
parent
51181dc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
129 deletions
+38
-129
exercice.ipynb
module3/exo3/exercice.ipynb
+38
-129
No files found.
module3/exo3/exercice.ipynb
View file @
62e4f7ad
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
8
1,
"execution_count": 1,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
8
2,
"execution_count": 2,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -329,7 +329,7 @@
...
@@ -329,7 +329,7 @@
"[756 rows x 10 columns]"
"[756 rows x 10 columns]"
]
]
},
},
"execution_count":
8
2,
"execution_count": 2,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -364,7 +364,7 @@
...
@@ -364,7 +364,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
8
3,
"execution_count": 3,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -651,7 +651,7 @@
...
@@ -651,7 +651,7 @@
"[756 rows x 10 columns]"
"[756 rows x 10 columns]"
]
]
},
},
"execution_count":
8
3,
"execution_count": 3,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -675,7 +675,7 @@
...
@@ -675,7 +675,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
8
4,
"execution_count": 4,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -725,7 +725,7 @@
...
@@ -725,7 +725,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
71
,
"execution_count":
5
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -747,7 +747,7 @@
...
@@ -747,7 +747,7 @@
"dtype: bool"
"dtype: bool"
]
]
},
},
"execution_count":
71
,
"execution_count":
5
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -769,7 +769,7 @@
...
@@ -769,7 +769,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
85
,
"execution_count":
6
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true,
"hidePrompt": true,
...
@@ -917,7 +917,7 @@
...
@@ -917,7 +917,7 @@
"1958-07-01 315.22 315.86 315.19 "
"1958-07-01 315.22 315.86 315.19 "
]
]
},
},
"execution_count":
85
,
"execution_count":
6
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -944,7 +944,7 @@
...
@@ -944,7 +944,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
86
,
"execution_count":
7
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -981,7 +981,7 @@
...
@@ -981,7 +981,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 8
8
,
"execution_count": 8,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -1039,7 +1039,7 @@
...
@@ -1039,7 +1039,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 9
0
,
"execution_count": 9,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true,
"hidePrompt": true,
...
@@ -1114,7 +1114,7 @@
...
@@ -1114,7 +1114,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
92
,
"execution_count":
11
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -1144,7 +1144,7 @@
...
@@ -1144,7 +1144,7 @@
"s5 = data_cube.co2 - data_cube.co2.mean()\n",
"s5 = data_cube.co2 - data_cube.co2.mean()\n",
"s5_fft = np.fft.fft(s5) # calcul de la transformee de Fourier et des frequences\n",
"s5_fft = np.fft.fft(s5) # calcul de la transformee de Fourier et des frequences\n",
"\n",
"\n",
"n = s
1
.size\n",
"n = s
5
.size\n",
"dt = 1/12\n",
"dt = 1/12\n",
"pds_s5 = (dt/n) * np.abs(s5_fft)**2 # densité spectral de puissance\n",
"pds_s5 = (dt/n) * np.abs(s5_fft)**2 # densité spectral de puissance\n",
"freq = np.fft.fftfreq(n, d=dt) # fréquences associées\n",
"freq = np.fft.fftfreq(n, d=dt) # fréquences associées\n",
...
@@ -1171,7 +1171,7 @@
...
@@ -1171,7 +1171,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
93
,
"execution_count":
12
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -1187,9 +1187,9 @@
...
@@ -1187,9 +1187,9 @@
}
}
],
],
"source": [
"source": [
"indide_f = np.where(pds_s
1
> 5)\n",
"indide_f = np.where(pds_s
5
> 5)\n",
"f_lente = indide_f[0][0] * f1\n",
"f_lente = indide_f[0][0] * f1\n",
"indide_f = np.where(pds_s
1
> 20)\n",
"indide_f = np.where(pds_s
5
> 20)\n",
"f_rapide = indide_f[0][-1] * f1\n",
"f_rapide = indide_f[0][-1] * f1\n",
" \n",
" \n",
"print(f' Estimation de la frequence lente : {f_lente} \\n Esitmation de la fréquence rapide : {f_rapide}')"
"print(f' Estimation de la frequence lente : {f_lente} \\n Esitmation de la fréquence rapide : {f_rapide}')"
...
@@ -1197,7 +1197,7 @@
...
@@ -1197,7 +1197,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
94
,
"execution_count":
13
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true,
"hidePrompt": true,
...
@@ -1225,7 +1225,7 @@
...
@@ -1225,7 +1225,7 @@
"\n",
"\n",
"p0 = [f0,ampl0,phase0,offset0]\n",
"p0 = [f0,ampl0,phase0,offset0]\n",
"x = np.array(data_cube['Date 2'])\n",
"x = np.array(data_cube['Date 2'])\n",
"popt_l, pcov_l = curve_fit(my_sin, x , s
1
, p0 = p0)\n",
"popt_l, pcov_l = curve_fit(my_sin, x , s
5
, p0 = p0)\n",
"print(popt_l)\n",
"print(popt_l)\n",
"ylent = my_sin(x,popt_l[0],popt_l[1],popt_l[2],popt_l[3])\n",
"ylent = my_sin(x,popt_l[0],popt_l[1],popt_l[2],popt_l[3])\n",
"fl = p0[0]\n",
"fl = p0[0]\n",
...
@@ -1234,7 +1234,7 @@
...
@@ -1234,7 +1234,7 @@
"f0 = f_rapide \n",
"f0 = f_rapide \n",
"ampl0= 3.5\n",
"ampl0= 3.5\n",
"p0 = [f0,ampl0,phase0,offset0]\n",
"p0 = [f0,ampl0,phase0,offset0]\n",
"popt_r, pcov_r = curve_fit(my_sin, x , s
1
, p0 = p0)\n",
"popt_r, pcov_r = curve_fit(my_sin, x , s
5
, p0 = p0)\n",
"print(popt_r)\n",
"print(popt_r)\n",
"yrapide = my_sin(x,popt_r[0],popt_r[1],popt_r[2],popt_r[3]) \n",
"yrapide = my_sin(x,popt_r[0],popt_r[1],popt_r[2],popt_r[3]) \n",
"fr = p0[0]"
"fr = p0[0]"
...
@@ -1242,7 +1242,7 @@
...
@@ -1242,7 +1242,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
95
,
"execution_count":
14
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true,
"hidePrompt": true,
...
@@ -1270,14 +1270,14 @@
...
@@ -1270,14 +1270,14 @@
"ax2.grid(linestyle='--', linewidth=1)\n",
"ax2.grid(linestyle='--', linewidth=1)\n",
"\n",
"\n",
"ax1.set(title = 'Variation concentration CO2 lente',xlabel='Période',ylabel='Concentration (ppm)')\n",
"ax1.set(title = 'Variation concentration CO2 lente',xlabel='Période',ylabel='Concentration (ppm)')\n",
"ax1.plot(x,ylent,x,s
1
);\n",
"ax1.plot(x,ylent,x,s
5
);\n",
"ax2.set(title = 'Variation concentration CO2 rapide',xlabel='Période',ylabel='Concentration (ppm)')\n",
"ax2.set(title = 'Variation concentration CO2 rapide',xlabel='Période',ylabel='Concentration (ppm)')\n",
"ax2.plot(x,yrapide,x,s
1
);"
"ax2.plot(x,yrapide,x,s
5
);"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
96
,
"execution_count":
15
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -1309,7 +1309,7 @@
...
@@ -1309,7 +1309,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
02
,
"execution_count": 1
6
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -1636,7 +1636,7 @@
...
@@ -1636,7 +1636,7 @@
"[63 rows x 12 columns]"
"[63 rows x 12 columns]"
]
]
},
},
"execution_count": 1
02
,
"execution_count": 1
6
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1648,7 +1648,7 @@
...
@@ -1648,7 +1648,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
03
,
"execution_count": 1
7
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
...
@@ -1836,7 +1836,7 @@
...
@@ -1836,7 +1836,7 @@
"max 411.850000 410.080000 408.550000 408.430000 410.280000 411.850000 "
"max 411.850000 410.080000 408.550000 408.430000 410.280000 411.850000 "
]
]
},
},
"execution_count": 1
03
,
"execution_count": 1
7
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -1847,7 +1847,7 @@
...
@@ -1847,7 +1847,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
63
,
"execution_count": 1
8
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true,
"hidePrompt": true,
...
@@ -2002,7 +2002,7 @@
...
@@ -2002,7 +2002,7 @@
"1962 0.7890 0.8740 0.9562 "
"1962 0.7890 0.8740 0.9562 "
]
]
},
},
"execution_count": 1
63
,
"execution_count": 1
8
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -2041,121 +2041,30 @@
...
@@ -2041,121 +2041,30 @@
"hidePrompt": true
"hidePrompt": true
},
},
"outputs": [],
"outputs": [],
"source": []
"source": [
"d"
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
164
,
"execution_count":
null
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
},
},
"outputs": [
"outputs": [],
{
"data": {
"text/plain": [
"0.1246"
]
},
"execution_count": 164,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"source": [
"0.0416+0.083"
"0.0416+0.083"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
165
,
"execution_count":
null
,
"metadata": {
"metadata": {
"hideCode": true,
"hideCode": true,
"hidePrompt": true
"hidePrompt": true
},
},
"outputs": [
"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>index</th>\n",
" <th>Yr</th>\n",
" <th>Mn</th>\n",
" <th>Date 1</th>\n",
" <th>Date 2</th>\n",
" <th>s1</th>\n",
" <th>s2</th>\n",
" <th>s3</th>\n",
" <th>s4</th>\n",
" <th>s5</th>\n",
" <th>s6</th>\n",
" </tr>\n",
" <tr>\n",
" <th>period</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2020-01-01</th>\n",
" <td>744</td>\n",
" <td>2020</td>\n",
" <td>1</td>\n",
" <td>43845</td>\n",
" <td>2020.041</td>\n",
" <td>413.37</td>\n",
" <td>413.33</td>\n",
" <td>413.11</td>\n",
" <td>413.05</td>\n",
" <td>413.37</td>\n",
" <td>413.33</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" index Yr Mn Date 1 Date 2 s1 s2 s3 s4 \\\n",
"period \n",
"2020-01-01 744 2020 1 43845 2020.041 413.37 413.33 413.11 413.05 \n",
"\n",
" s5 s6 \n",
"period \n",
"2020-01-01 413.37 413.33 "
]
},
"execution_count": 165,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"source": [
"df[-1:]"
"df[-1:]"
]
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment