Skip to content

Commit

Permalink
Add details on markdown and code cells
Browse files Browse the repository at this point in the history
  • Loading branch information
dkirkby committed Jul 19, 2016
1 parent 9224681 commit 8c8cac5
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions TutorialJupyter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Introduction to Jupyter Notebooks http://jupyter.org\n",
"# Introduction to Jupyter Notebooks\n",
"\n",
"#### Tutorial by Javier Sánchez, University of California, Irvine\n",
"#### Prepared for the DESC Collaboration Meeting - Oxford - July 2016."
Expand All @@ -26,7 +26,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Jupyter creates an easy-to-read document that you can view in your web-browser with code (that runs and creates plots inside the document on the fly!) and text (with even math). The name \"Jupyter\" is a combination of Julia, Python, and R. However, it has support for over 40 programming languages. Jupyter is based on iPython notebooks, and, in fact you can still launch jupyter by typing ```ipython notebook``` on your terminal."
"[Jupyter](http://jupyter.org) creates an easy-to-read document that you can view in your web-browser with code (that runs and creates plots inside the document on the fly!) and text (with even math). The name \"Jupyter\" is a combination of Julia, Python, and R. However, it has support for over 40 programming languages. Jupyter is based on iPython notebooks, and, in fact you can still launch jupyter by typing ```ipython notebook``` on your terminal."
]
},
{
Expand Down Expand Up @@ -68,21 +68,44 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"**2.1. Markdown cells**: Used for explanatory text, and written in [GitHub-flavored markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)."
"**2.1. Markdown cells**: Used for explanatory text (like this), and written in [GitHub-flavored markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet). A markdown cells is usually displayed in output format, but a double click will switch it to input mode. **Try that now on this cell.** Use SHIFT+RETURN to toggle back to output format. Markdown cells can contain latex math, for example:\n",
"$$\n",
"\\frac{d\\log G(z)}{d\\log a} \\simeq \\left[ \\frac{\\Omega_m (1 + z)^3}{\\Omega_m (1 + z)^3 + \\Omega_\\Lambda} \\right]^{0.55}\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**2.2 Code cells**: Contain executable source code in the language of the document’s associated kernel (usually python)."
"**2.2 Code cells**: Contain executable source code in the language of the document’s associated kernel (usually python). Use SHIFT+RETURN to execute the code in a cell and see its output directly below. **Try that now for the code cell below**. Note that the output is not editable and that each code cell has an associated label, e.g. `In [3]`, where the number records the order in which cells are executed (which is arbitrary since it depends on you). **Re-run the code cell below and note that its number increases each time.**"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2016-07-19 09:28:50.441125\n"
]
}
],
"source": [
"import datetime\n",
"print datetime.datetime.now()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"More info: https://ipython.org/ipython-doc/3/notebook/nbformat.html"
"More info on notebooks and cells is [here](https://ipython.org/ipython-doc/3/notebook/nbformat.html)."
]
},
{
Expand All @@ -104,7 +127,8 @@
"metadata": {},
"source": [
"```import numpy as np\n",
"import matplotlib.pyplot as plt```"
"import matplotlib.pyplot as plt\n",
"```"
]
},
{
Expand Down Expand Up @@ -162,7 +186,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The magic ```%load``` is really useful since it allows us to load any other Python script. It has an option ```-s``` that allows us to modify the code inside the notebook."
"The magic `%load` is really useful since it allows us to load any other Python script. It has an option ```-s``` that allows us to modify the code inside the notebook. We use `%load` below to reveal solutions to some of the exercises."
]
},
{
Expand Down Expand Up @@ -225,7 +249,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Numpy is a Python package that implements N-dimensional arrays objects and it is designed for scientific computing. It also implements a multitude of mathematical functions to operate efficiently with these arrays. The use of numpy arrays can significantly boost the performance of your Python script to be comparable to compiled C code. Some useful examples and tutorials can be found here: http://www.scipy-lectures.org/intro/numpy/index.html, http://cs231n.github.io/python-numpy-tutorial/"
"Numpy is a Python package that implements N-dimensional arrays objects and it is designed for scientific computing. It also implements a multitude of mathematical functions to operate efficiently with these arrays. The use of numpy arrays can significantly boost the performance of your Python script to be comparable to compiled C code. Some useful examples and tutorials can be found [here](http://www.scipy-lectures.org/intro/numpy/index.html) and [here](http://cs231n.github.io/python-numpy-tutorial/)."
]
},
{
Expand Down

0 comments on commit 8c8cac5

Please sign in to comment.