Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sci_python
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SCW2017
sci_python
Commits
fab894bf
Commit
fab894bf
authored
Oct 06, 2017
by
Inigo Aldazabal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refresh and remove matplotlib from clean
parent
a9648fc8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
233 deletions
+43
-233
scipy-tutorial-clean.ipynb
scipy-tutorial-clean.ipynb
+24
-179
scipy-tutorial.ipynb
scipy-tutorial.ipynb
+19
-54
No files found.
scipy-tutorial-clean.ipynb
View file @
fab894bf
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Matplotlib](images/matplotlib_logo-s.png)\n",
"\n",
"# Matplotlib"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's take a quick look at the matplotlib essentials.\n",
"\n",
"First let's import the neccesary modules:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"And now let's go with some examples."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1D plot"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A tangent between 0 and 4$\\pi$.\n",
"\n",
"$$y = \\tan(x), \\; x\\in[0., 4\\pi]$$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1D polar plot "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$\\theta(\\rho) = 2\\pi \\rho, \\; \\rho \\in [0, 2]$"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Exercise"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Plot the function \n",
"\n",
"$$y = \\frac{\\sin(x)}{x}, \\; x\\in[0.1, 6\\pi]$$\n",
"\n",
"and try to \n",
"\n",
"* set the figure *legend*\n",
"* change the *line style*\n",
"\n",
"hint: checkout the [matplotlib examples](http://matplotlib.org/examples/index.html)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# %load files/sol_sinc.py"
]
},
{
"cell_type": "markdown",
"metadata": {},
...
...
@@ -149,10 +31,8 @@
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -224,9 +104,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -240,9 +118,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -256,9 +132,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -272,9 +146,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -298,9 +170,8 @@
},
{
"cell_type": "code",
"execution_count":
3
,
"execution_count":
null
,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [],
...
...
@@ -310,10 +181,8 @@
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#help(integrate)"
...
...
@@ -354,27 +223,21 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -399,18 +262,14 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -424,18 +283,14 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -449,18 +304,14 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -474,9 +325,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -484,7 +333,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"##
#
Scipy direct method"
"##
Scipy direct method"
]
},
{
...
...
@@ -497,18 +346,14 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": []
},
...
...
@@ -549,9 +394,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.
0
"
"version": "3.6.
1
"
}
},
"nbformat": 4,
"nbformat_minor":
0
"nbformat_minor":
1
}
scipy-tutorial.ipynb
View file @
fab894bf
...
...
@@ -32,9 +32,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import scipy as sp"
...
...
@@ -116,9 +114,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"ndata = 50\n",
...
...
@@ -137,9 +133,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"plt.plot(tdata, data_pure)\n",
...
...
@@ -156,9 +150,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"from scipy.optimize import curve_fit\n",
...
...
@@ -180,9 +172,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"plt.plot(tdata, data_pure)\n",
...
...
@@ -214,7 +204,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [],
...
...
@@ -268,9 +257,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"import urllib\n",
...
...
@@ -282,9 +269,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"years = solarspots[:,0]\n",
...
...
@@ -294,9 +279,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"plt.figure(figsize=(10,6))\n",
...
...
@@ -335,9 +318,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"spots_fft = fft(spots)"
...
...
@@ -346,9 +327,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"plt.scatter(spots_fft.real, spots_fft.imag)\n",
...
...
@@ -369,9 +348,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"N = spots_fft.size\n",
...
...
@@ -386,9 +363,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"plt.plot(freq, power)\n",
...
...
@@ -408,9 +383,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"period = 1./freq"
...
...
@@ -419,9 +392,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"plt.plot(period, power)\n",
...
...
@@ -443,9 +414,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"max_power_index = np.argmax(power)\n",
...
...
@@ -470,9 +439,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"from scipy import signal\n",
...
...
@@ -485,9 +452,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [],
"source": [
"max_power_index = np.argmax(Pxx_spectrum)\n",
...
...
@@ -532,9 +497,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.
0
"
"version": "3.6.
1
"
}
},
"nbformat": 4,
"nbformat_minor":
0
"nbformat_minor":
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