"You are looking at an **IPython Notebook**, an interactive Python shell inside of a web browser. With it, you can run individual Python commands and immediately view their output.\n",
"You are looking at an **IPython Notebook**, an interactive Python shell inside of a web browser. With it, you can run individual Python commands and immediately view their output. It's basically the Matlab Desktop or Mathematica Notebook for Python.\n",
"\n",
"It's basically the Matlab Desktop or Mathematica Notebook for Python.\n",
"An IPython Notebook is comprised of **cells**. Cells are just small units of code or text. For example, the text that you are reading is inside a *Markdown* cell. (More on that later.)\n",
"\n",
"An IPython Notebook is comprised of **cells**. Cells are just small units of code or text. They allow you to edit, execute, and analyze small portions of code at a time.\n",
"\n"
"*Code* cells allow you to edit, execute, and analyze small portions of Python code at a time. Here is a code cell:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"1+2"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 19,
"text": [
"3"
]
}
],
"prompt_number": 19
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Modes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Modes\n",
"-----\n",
"\n",
"The IPython Notebook has two different keyboard input modes. \n",
"\n",
"In **Edit Mode**, you type code/text into a cell. Edit Mode is indicated by a *green* cell border. \n",
...
...
@@ -47,7 +71,7 @@
"\n",
"To enter Command Mode from Edit Mode, press `Esc`. Other commands can also enter Command Mode, e.g. `Shift-Enter`.\n",
"\n",
"To display the Help Menu, press `h`."
"To display the Help Menu from Command Mode, press `h`. Use it often; `h` is your best friend."
]
},
{
...
...
@@ -79,6 +103,42 @@
"For headings, we recommend that you use IPython's keyboard shortcuts. To change the text in a cell to a level-3 header, simply press `3`. For similar commands, press `h` to view the Help menu."
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Writing Text in $\\LaTeX$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In a Markdown cell, you can also use $\\LaTeX$ syntax. Example input:"
"Tab autocompletion works in Command Window and the Editor. After you type a few letters, press the `Tab` key and a popup will appear and show you all of the possible completions, including variable names and functions. This prevents you from mistyping the names of variables -- a big time saver! \n",
" \n",
"For example, type `librosa.` and then press `Tab`. You should see a list of members in the Python package `librosa`."
"For example, type `scipy.` and then press `Tab`. You should see a list of members in the Python package `scipy`.\n",
"\n",
"Or type `scipy.sin`, then press `Tab` to view members that begin with `sin`."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# Press Tab at the end of the following line\n",
"scipy.sin"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 22,
"text": [
"<ufunc 'sin'>"
]
}
],
"prompt_number": 22
},
{
"cell_type": "heading",
...
...
@@ -201,7 +284,7 @@
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 7
"prompt_number": 23
},
{
"cell_type": "heading",
...
...
@@ -215,7 +298,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"In the top menu bar, click on Help, and you'll find a prepared set of documentation links for IPython, NumPy, SciPy, Matplotlib!"
"In the top menu bar, click on Help, and you'll find a prepared set of documentation links for IPython, NumPy, SciPy, and Matplotlib."