Skip to content

Commit ef7a948

Browse files
committed
Adding pelican
1 parent 32a9fd1 commit ef7a948

22 files changed

+1444
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
code
2+
output
3+
*.pid
4+
__pycache__

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# IPython Cookbook, Second Edition (2018)
22

3-
<a href="https://github.com/ipython-books/cookbook-2nd"><img src="cover-cookbook-2nd.png" align="left" alt="IPython Cookbook, Second Edition" height="180" /></a>This repository contains the sources (text and code in Markdown) of the book [*IPython Interactive Computing and Visualization Cookbook, Second Edition (2018)*](https://www.packtpub.com/big-data-and-business-intelligence/ipython-interactive-computing-and-visualization-cookbook-second-e), by [Cyrille Rossant](http://cyrille.rossant.net), *Packt Publishing*.
3+
<a href="https://github.com/ipython-books/cookbook-2nd"><img src="cover-cookbook-2nd.png" align="left" alt="IPython Cookbook, Second Edition" height="180" /></a>[IPython Interactive Computing and Visualization Cookbook, Second Edition (2018)](https://www.packtpub.com/big-data-and-business-intelligence/ipython-interactive-computing-and-visualization-cookbook-second-e), by [Cyrille Rossant](http://cyrille.rossant.net), Packt Publishing, contains over 100 hands-on recipes on high-performance numerical computing and data science in the Jupyter Notebook.
44

5-
The IPython Cookbook contains over 100 hands-on recipes on high-performance numerical computing and data science in the Jupyter Notebook.
5+
This repository contains the sources of the book (text and code in Markdown, [CC-BY-NC-ND license](https://creativecommons.org/licenses/by-nc-nd/3.0/us/legalcode)).
66

77
[**Get the code** as Jupyter notebooks](https://github.com/ipython-books/cookbook-2nd-code)
8-
[**Get the Google Chrome extension** to see LaTeX equations in Markdown documents on GitHub](https://chrome.google.com/webstore/detail/github-with-mathjax/ioemnmodlmafdkllaclgeombjnmnbima/)
8+
[**Get the Google Chrome extension** to see LaTeX equations on GitHub](https://chrome.google.com/webstore/detail/github-with-mathjax/ioemnmodlmafdkllaclgeombjnmnbima/)
99

1010
## Contents
1111

website/Makefile

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
PY?=python3
2+
PELICAN?=pelican
3+
PELICANOPTS=
4+
5+
BASEDIR=$(CURDIR)
6+
INPUTDIR=$(BASEDIR)/content
7+
OUTPUTDIR=$(BASEDIR)/output
8+
CONFFILE=$(BASEDIR)/pelicanconf.py
9+
PUBLISHCONF=$(BASEDIR)/publishconf.py
10+
11+
FTP_HOST=localhost
12+
FTP_USER=anonymous
13+
FTP_TARGET_DIR=/
14+
15+
SSH_HOST=localhost
16+
SSH_PORT=22
17+
SSH_USER=root
18+
SSH_TARGET_DIR=/var/www
19+
20+
S3_BUCKET=my_s3_bucket
21+
22+
CLOUDFILES_USERNAME=my_rackspace_username
23+
CLOUDFILES_API_KEY=my_rackspace_api_key
24+
CLOUDFILES_CONTAINER=my_cloudfiles_container
25+
26+
DROPBOX_DIR=~/Dropbox/Public/
27+
28+
GITHUB_PAGES_BRANCH=gh-pages
29+
30+
DEBUG ?= 0
31+
ifeq ($(DEBUG), 1)
32+
PELICANOPTS += -D
33+
endif
34+
35+
RELATIVE ?= 0
36+
ifeq ($(RELATIVE), 1)
37+
PELICANOPTS += --relative-urls
38+
endif
39+
40+
help:
41+
@echo 'Makefile for a pelican Web site '
42+
@echo ' '
43+
@echo 'Usage: '
44+
@echo ' make html (re)generate the web site '
45+
@echo ' make clean remove the generated files '
46+
@echo ' make regenerate regenerate files upon modification '
47+
@echo ' make publish generate using production settings '
48+
@echo ' make serve [PORT=8000] serve site at http://localhost:8000'
49+
@echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 '
50+
@echo ' make devserver [PORT=8000] start/restart develop_server.sh '
51+
@echo ' make stopserver stop local server '
52+
@echo ' make ssh_upload upload the web site via SSH '
53+
@echo ' make rsync_upload upload the web site via rsync+ssh '
54+
@echo ' make dropbox_upload upload the web site via Dropbox '
55+
@echo ' make ftp_upload upload the web site via FTP '
56+
@echo ' make s3_upload upload the web site via S3 '
57+
@echo ' make cf_upload upload the web site via Cloud Files'
58+
@echo ' make github upload the web site via gh-pages '
59+
@echo ' '
60+
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
61+
@echo 'Set the RELATIVE variable to 1 to enable relative urls '
62+
@echo ' '
63+
64+
html:
65+
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
66+
67+
clean:
68+
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
69+
70+
regenerate:
71+
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
72+
73+
serve:
74+
ifdef PORT
75+
cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
76+
else
77+
cd $(OUTPUTDIR) && $(PY) -m pelican.server
78+
endif
79+
80+
serve-global:
81+
ifdef SERVER
82+
cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 $(SERVER)
83+
else
84+
cd $(OUTPUTDIR) && $(PY) -m pelican.server 80 0.0.0.0
85+
endif
86+
87+
88+
devserver:
89+
ifdef PORT
90+
$(BASEDIR)/develop_server.sh restart $(PORT)
91+
else
92+
$(BASEDIR)/develop_server.sh restart
93+
endif
94+
95+
stopserver:
96+
$(BASEDIR)/develop_server.sh stop
97+
@echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
98+
99+
publish:
100+
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
101+
102+
ssh_upload: publish
103+
scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
104+
105+
rsync_upload: publish
106+
rsync -e "ssh -p $(SSH_PORT)" -P -rvzc --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
107+
108+
dropbox_upload: publish
109+
cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR)
110+
111+
ftp_upload: publish
112+
lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
113+
114+
s3_upload: publish
115+
s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed --guess-mime-type --no-mime-magic --no-preserve
116+
117+
cf_upload: publish
118+
cd $(OUTPUTDIR) && swift -v -A https://auth.api.rackspacecloud.com/v1.0 -U $(CLOUDFILES_USERNAME) -K $(CLOUDFILES_API_KEY) upload -c $(CLOUDFILES_CONTAINER) .
119+
120+
github: publish
121+
ghp-import -m "Generate Pelican site" -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR)
122+
git push origin $(GITHUB_PAGES_BRANCH)
123+
124+
.PHONY: html help clean regenerate serve serve-global devserver stopserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github

website/content/pages/index.md

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
title: IPython Cookbook, Second Edition (2018)
2+
save_as: index.html
3+
4+
<a href="https://github.com/ipython-books/cookbook-2nd"><img src="https://raw.githubusercontent.com/ipython-books/cookbook-2nd/master/cover-cookbook-2nd.png" align="left" alt="IPython Cookbook, Second Edition" height="200" style="margin-right: 20px;" /></a>[IPython Interactive Computing and Visualization Cookbook, Second Edition (2018)](https://www.packtpub.com/big-data-and-business-intelligence/ipython-interactive-computing-and-visualization-cookbook-second-e), by [Cyrille Rossant](http://cyrille.rossant.net), Packt Publishing, contains over 100 hands-on recipes on high-performance numerical computing and data science in the Jupyter Notebook.
5+
6+
Most of the book is freely available on this website (text and code in Markdown, [CC-BY-NC-ND license](https://creativecommons.org/licenses/by-nc-nd/3.0/us/legalcode)).
7+
8+
[**Get the code** as Jupyter notebooks](https://github.com/ipython-books/cookbook-2nd-code)
9+
[**Get the Google Chrome extension** to see LaTeX equations on GitHub](https://chrome.google.com/webstore/detail/github-with-mathjax/ioemnmodlmafdkllaclgeombjnmnbima/)
10+
11+
## Contents
12+
13+
<!-- START_TOC -->
14+
15+
### [Chapter 1 : A Tour of Interactive Computing with Jupyter and IPython](chapter01_basic)
16+
17+
* [1.1. Introducing IPython and the Jupyter Notebook](chapter01_basic/01_notebook.md)
18+
* [1.2. Getting started with exploratory data analysis in the Jupyter Notebook](chapter01_basic/02_pandas.md)
19+
* [1.3. Introducing the multidimensional array in NumPy for fast array computations](chapter01_basic/03_numpy.md)
20+
* [1.4. Creating an IPython extension with custom magic commands](chapter01_basic/04_magic.md)
21+
* [1.5. Mastering IPython's configuration system](chapter01_basic/05_config.md)
22+
* [1.6. Creating a simple kernel for Jupyter](chapter01_basic/06_kernel.md)
23+
24+
25+
### [Chapter 2 : Best practices in Interactive Computing](chapter02_best_practices)
26+
27+
* [2.1. Learning the basics of the Unix shell](chapter02_best_practices/01_shell.md)
28+
* [2.2. Using the latest features of Python 3](chapter02_best_practices/02_py3.md)
29+
* [2.3. Learning the basics of the distributed version control system Git](chapter02_best_practices/03_git.md)
30+
* [2.4. A typical workflow with Git branching](chapter02_best_practices/04_git_advanced.md)
31+
* [2.5. Efficient interactive computing workflows with IPython](chapter02_best_practices/05_workflows.md)
32+
* [2.6. Ten tips for conducting reproducible interactive computing experiments](chapter02_best_practices/06_tips.md)
33+
* [2.7. Writing high-quality Python code](chapter02_best_practices/07_high_quality.md)
34+
* [2.8. Writing unit tests with py.test](chapter02_best_practices/08_test.md)
35+
* [2.9. Debugging code with IPython](chapter02_best_practices/09_debugging.md)
36+
37+
38+
### [Chapter 3 : Mastering the Jupyter Notebook](chapter03_notebook)
39+
40+
* [3.1. Teaching programming in the Notebook with IPython blocks](chapter03_notebook/01_blocks.md)
41+
* [3.2. Converting a Jupyter notebook to other formats with nbconvert](chapter03_notebook/02_nbformat.md)
42+
* [3.3. Mastering widgets in the Jupyter Notebook](chapter03_notebook/03_widgets.md)
43+
* [3.4. Creating custom Jupyter Notebook widgets in Python, HTML, and JavaScript](chapter03_notebook/04_custom_widgets.md)
44+
* [3.5. Configuring the Jupyter Notebook](chapter03_notebook/05_custom_notebook.md)
45+
* [3.6. Introducing JupyterLab](chapter03_notebook/06_jupyterlab.md)
46+
47+
48+
### [Chapter 4 : Profiling and Optimization](chapter04_optimization)
49+
50+
* [4.1. Evaluating the time taken by a command in IPython](chapter04_optimization/01_timeit.md)
51+
* [4.2. Profiling your code easily with cProfile and IPython](chapter04_optimization/02_profile.md)
52+
* [4.3. Profiling your code line-by-line with line_profiler](chapter04_optimization/03_linebyline.md)
53+
* [4.4. Profiling the memory usage of your code with memory_profiler](chapter04_optimization/04_memprof.md)
54+
* [4.5. Understanding the internals of NumPy to avoid unnecessary array copying](chapter04_optimization/05_array_copies.md)
55+
* [4.6. Using stride tricks with NumPy](chapter04_optimization/06_stride_tricks.md)
56+
* [4.7. Implementing an efficient rolling average algorithm with stride tricks](chapter04_optimization/07_rolling_average.md)
57+
* [4.8. Processing large NumPy arrays with memory mapping](chapter04_optimization/08_memmap.md)
58+
* [4.9. Manipulating large arrays with HDF5](chapter04_optimization/09_hdf5_array.md)
59+
60+
61+
### [Chapter 5 : High-Performance Computing](chapter05_hpc)
62+
63+
* [5.1. Knowing Python to write faster code](chapter05_hpc/01_slow.md)
64+
* [5.2. Accelerating pure Python code with Numba and just-in-time compilation](chapter05_hpc/02_numba.md)
65+
* [5.3. Accelerating array computations with Numexpr](chapter05_hpc/03_numexpr.md)
66+
* [5.4. Wrapping a C library in Python with ctypes](chapter05_hpc/04_ctypes.md)
67+
* [5.5. Accelerating Python code with Cython](chapter05_hpc/05_cython.md)
68+
* [5.6. Optimizing Cython code by writing less Python and more C](chapter05_hpc/06_ray.md)
69+
* [5.7. Releasing the GIL to take advantage of multi-core processors with Cython and OpenMP](chapter05_hpc/07_openmp.md)
70+
* [5.8. Writing massively parallel code for NVIDIA graphics cards (GPUs) with CUDA](chapter05_hpc/08_cuda.md)
71+
* [5.9. Distributing Python code across multiple cores with IPython](chapter05_hpc/09_ipyparallel.md)
72+
* [5.10. Interacting with asynchronous parallel tasks in IPython](chapter05_hpc/10_async.md)
73+
* [5.11. Performing out-of-core computations on large arrays with Dask](chapter05_hpc/11_dask.md)
74+
* [5.12. Trying the Julia programming language in the Jupyter Notebook](chapter05_hpc/12_julia.md)
75+
76+
77+
### [Chapter 6 : Data Visualization](chapter06_viz)
78+
79+
* [6.1. Using matplotlib styles](chapter06_viz/01_styles.md)
80+
* [6.2. Creating statistical plots easily with seaborn](chapter06_viz/02_seaborn.md)
81+
* [6.3. Creating interactive Web visualizations with Bokeh and HoloViews](chapter06_viz/03_bokeh.md)
82+
* [6.4. Visualizing a NetworkX graph in the Notebook with D3.js](chapter06_viz/04_d3.md)
83+
* [6.5. Discovering interactive visualization libraries in the Notebook](chapter06_viz/05_widgets.md)
84+
* [6.6. Creating plots with Altair and the Vega-Lite specification](chapter06_viz/06_altair.md)
85+
86+
87+
### [Chapter 7 : Statistical Data Analysis](chapter07_stats)
88+
89+
* [7.1. Exploring a dataset with pandas and matplotlib](chapter07_stats/01_pandas.md)
90+
* [7.2. Getting started with statistical hypothesis testing — a simple z-test](chapter07_stats/02_z_test.md)
91+
* [7.3. Getting started with Bayesian methods](chapter07_stats/03_bayesian.md)
92+
* [7.4. Estimating the correlation between two variables with a contingency table and a chi-squared test](chapter07_stats/04_correlation.md)
93+
* [7.5. Fitting a probability distribution to data with the maximum likelihood method](chapter07_stats/05_mlfit.md)
94+
* [7.6. Estimating a probability distribution nonparametrically with a kernel density estimation](chapter07_stats/06_kde.md)
95+
* [7.7. Fitting a Bayesian model by sampling from a posterior distribution with a Markov Chain Monte Carlo method](chapter07_stats/07_pymc.md)
96+
* [7.8. Analyzing data with the R programming language in the Jupyter Notebook](chapter07_stats/08_r.md)
97+
98+
99+
### [Chapter 8 : Machine Learning](chapter08_ml)
100+
101+
* [8.1. Getting started with scikit-learn](chapter08_ml/01_scikit.md)
102+
* [8.2. Predicting who will survive on the Titanic with logistic regression](chapter08_ml/02_titanic.md)
103+
* [8.3. Learning to recognize handwritten digits with a K-nearest neighbors classifier](chapter08_ml/03_digits.md)
104+
* [8.4. Learning from text — Naive Bayes for Natural Language Processing](chapter08_ml/04_text.md)
105+
* [8.5. Using support vector machines for classification tasks](chapter08_ml/05_svm.md)
106+
* [8.6. Using a random forest to select important features for regression](chapter08_ml/06_random_forest.md)
107+
* [8.7. Reducing the dimensionality of a dataset with a principal component analysis](chapter08_ml/07_pca.md)
108+
* [8.8. Detecting hidden structures in a dataset with clustering](chapter08_ml/08_clustering.md)
109+
110+
111+
### [Chapter 9 : Numerical Optimization](chapter09_numoptim)
112+
113+
* [9.1. Finding the root of a mathematical function](chapter09_numoptim/01_root.md)
114+
* [9.2. Minimizing a mathematical function](chapter09_numoptim/02_minimize.md)
115+
* [9.3. Fitting a function to data with nonlinear least squares](chapter09_numoptim/03_curvefitting.md)
116+
* [9.4. Finding the equilibrium state of a physical system by minimizing its potential energy](chapter09_numoptim/04_energy.md)
117+
118+
119+
### [Chapter 10 : Signal Processing](chapter10_signal)
120+
121+
* [10.1. Analyzing the frequency components of a signal with a Fast Fourier Transform](chapter10_signal/01_fourier.md)
122+
* [10.2. Applying a linear filter to a digital signal](chapter10_signal/02_filter.md)
123+
* [10.3. Computing the autocorrelation of a time series](chapter10_signal/03_autocorrelation.md)
124+
125+
126+
### [Chapter 11 : Image and Audio Processing](chapter11_image)
127+
128+
* [11.1. Manipulating the exposure of an image](chapter11_image/01_exposure.md)
129+
* [11.2. Applying filters on an image](chapter11_image/02_filters.md)
130+
* [11.3. Segmenting an image](chapter11_image/03_segmentation.md)
131+
* [11.4. Finding points of interest in an image](chapter11_image/04_interest.md)
132+
* [11.5. Detecting faces in an image with OpenCV](chapter11_image/05_faces.md)
133+
* [11.6. Applying digital filters to speech sounds](chapter11_image/06_speech.md)
134+
* [11.7. Creating a sound synthesizer in the Notebook](chapter11_image/07_synth.md)
135+
136+
137+
### [Chapter 12 : Deterministic Dynamical Systems](chapter12_deterministic)
138+
139+
* [12.1. Plotting the bifurcation diagram of a chaotic dynamical system](chapter12_deterministic/01_bifurcation.md)
140+
* [12.2. Simulating an elementary cellular automaton](chapter12_deterministic/02_cellular.md)
141+
* [12.3. Simulating an ordinary differential equation with SciPy](chapter12_deterministic/03_ode.md)
142+
* [12.4. Simulating a partial differential equation — reaction-diffusion systems and Turing patterns](chapter12_deterministic/04_turing.md)
143+
144+
145+
### [Chapter 13 : Stochastic Dynamical Systems](chapter13_stochastic)
146+
147+
* [13.1. Simulating a discrete-time Markov chain](chapter13_stochastic/01_markov.md)
148+
* [13.2. Simulating a Poisson process](chapter13_stochastic/02_poisson.md)
149+
* [13.3. Simulating a Brownian motion](chapter13_stochastic/03_brownian.md)
150+
* [13.4. Simulating a stochastic differential equation](chapter13_stochastic/04_sde.md)
151+
152+
153+
### [Chapter 14 : Graphs, Geometry, and Geographic Information Systems](chapter14_graphgeo)
154+
155+
* [14.1. Manipulating and visualizing graphs with NetworkX](chapter14_graphgeo/01_networkx.md)
156+
* [14.2. Drawing flight routes with NetworkX](chapter14_graphgeo/02_airports.md)
157+
* [14.3. Resolving dependencies in a directed acyclic graph with a topological sort](chapter14_graphgeo/03_dag.md)
158+
* [14.4. Computing connected components in an image](chapter14_graphgeo/04_connected.md)
159+
* [14.5. Computing the Voronoi diagram of a set of points](chapter14_graphgeo/05_voronoi.md)
160+
* [14.6. Manipulating geospatial data with Cartopy](chapter14_graphgeo/06_gis.md)
161+
* [14.7. Creating a route planner for a road network](chapter14_graphgeo/07_gps.md)
162+
163+
164+
### [Chapter 15 : Symbolic and Numerical Mathematics](chapter15_symbolic)
165+
166+
* [15.1. Diving into symbolic computing with SymPy](chapter15_symbolic/01_sympy_intro.md)
167+
* [15.2. Solving equations and inequalities](chapter15_symbolic/02_solvers.md)
168+
* [15.3. Analyzing real-valued functions](chapter15_symbolic/03_function.md)
169+
* [15.4. Computing exact probabilities and manipulating random variables](chapter15_symbolic/04_stats.md)
170+
* [15.5. A bit of number theory with SymPy](chapter15_symbolic/05_number_theory.md)
171+
* [15.6. Finding a Boolean propositional formula from a truth table](chapter15_symbolic/06_logic.md)
172+
* [15.7. Analyzing a nonlinear differential system — Lotka-Volterra (predator-prey) equations](chapter15_symbolic/07_lotka.md)
173+
* [15.8. Getting started with Sage](chapter15_symbolic/08_sage.md)
174+
175+
176+
<!-- END_TOC -->
177+
178+
179+
## Contributing
180+
181+
For any comment, question, or error, please [open an issue](https://github.com/ipython-books/cookbook-2nd/issues) or [propose a pull request](https://github.com/ipython-books/cookbook-2nd/pulls).
182+
183+
184+
## Presentation
185+
186+
Python is one of the leading open source platforms for data science and numerical computing. IPython and the associated Jupyter Notebook offer efficient interfaces to Python for data analysis and interactive visualization, and they constitute an ideal gateway to the platform.
187+
188+
IPython Interactive Computing and Visualization Cookbook, Second Edition contains many ready-to-use, focused recipes for high-performance scientific computing and data analysis, from the latest IPython/Jupyter features to the most advanced tricks, to help you write better and faster code. You will apply these state-of-the-art methods to various real-world examples, illustrating topics in applied mathematics, scientific modeling, and machine learning.
189+
190+
The first part of the book covers programming techniques: code quality and reproducibility, code optimization, high- performance computing through just-in-time compilation, parallel computing, and graphics card programming. The second part tackles data science, statistics, machine learning, signal and image processing, dynamical systems, and pure and applied mathematics

0 commit comments

Comments
 (0)