Commit 2f009646 authored by Inigo Aldazabal's avatar Inigo Aldazabal

stripped out ipython-quickstart section

parent d5348fd6
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![IPython](images/ipython_logo-s.png)\n",
"\n",
"# IPython"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Starting the notebook server using the command line"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can start the notebook server from the command line (Terminal on Mac/Linux, CMD prompt on Windows) by running the following command: \n",
"\n",
" ipython notebook\n",
"\n",
"This will print some information about the notebook server in your terminal, including the URL of the web application (by default, `http://127.0.0.1:8888`). It will then open your default web browser to this URL.\n",
"\n",
"When the notebook opens, you will see the **notebook dashboard**, which will show a list of the notebooks, files, and subdirectories in the directory where the notebook server was started. Most of the time, you will want to start a notebook server in the highest directory in your filesystem where notebooks can be found. Often this will be your home directory."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Basic conceps"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* **Kernels**: Separate processes started by the notebook web application that runs users' code in a given language and returns output back to the notebook web application. The kernel also handles things like computations for interactive widgets, tab completion and introspection.\n",
"\n",
"* **Notebook documents**: Self-contained documents that contain a representation of all content visible in the notebook web application, including inputs and outputs of the computations, narrative text, equations, images, and rich media representations of objects. Each notebook document has its own kernel."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Cell types"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We have different types of cells. The type of a cell is selected from the dropdown menu or with a keyboard shortcut in command mode. We'll see `code` cells and `Markdown` cells. \n",
"\n",
"This is a **Markdown** cell itself and is used to add formatted text to your notebooks. You can use both [Markdown](https://en.wikipedia.org/wiki/Markdown) syntax and [LaTeX](https://en.wikipedia.org/wiki/LaTeX) syntax.\n",
"\n",
"You can include mathematical expressions both inline: $e^{i\\pi} + 1 = 0$ and displayed:\n",
"\n",
"$$e^x=\\sum_{i=0}^\\infty \\frac{1}{i!}x^i$$\n",
"\n",
"**Code cells** on the other hand allow us to input Python code which will be later run by the kernel. Once the cell is run (see below how), the corresponding output, if any, apperas below the cell."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1.0, 4.0, 3.14]\n"
]
}
],
"source": [
"# This is a code cell. It runs code :-)\n",
"a = [1., 4., 3.14]\n",
"print (a)"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3.141592653589793\n",
"1.0\n"
]
}
],
"source": [
"# And another code cell\n",
"import math\n",
"print (math.pi)\n",
"print (math.sin(math.pi/2.))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Modal editor"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Starting with IPython 2.0, the IPython Notebook has a modal user interface. This means that the keyboard does different things depending on which mode the Notebook is in. There are two modes: edit mode and command mode."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Edit mode\n",
"\n",
"Edit mode is indicated by a green cell border and a prompt showing in the editor area:\n",
"\n",
"<img src=\"images/edit_mode.png\">\n",
"\n",
"When a cell is in edit mode, you can type into the cell, like a normal text editor.\n",
"\n",
"<div class=\"alert alert-success\">\n",
"Enter edit mode by pressing `Enter` or using the mouse to click on a cell's editor area.\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Command mode\n",
"\n",
"Command mode is indicated by a grey cell border:\n",
"\n",
"<img src=\"images/command_mode.png\">\n",
"\n",
"When you are in command mode, you are able to edit the notebook as a whole, but not type into individual cells. Most importantly, in command mode, the keyboard is mapped to a set of shortcuts that let you perform notebook and cell actions efficiently. For example, if you are in command mode and you press `c`, you will copy the current cell - no modifier is needed.\n",
"\n",
"<div class=\"alert alert-error\">\n",
"Don't try to type into a cell in command mode; unexpected things will happen!\n",
"</div>\n",
"\n",
"<div class=\"alert alert-success\">\n",
"Enter command mode by pressing `Esc` or using the mouse to click *outside* a cell's editor area.\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Running cells"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The keyboard shortcuts for running a cell, both in edit and command mode, are:\n",
"\n",
"* `Shift-Enter` runs the current cell and moves to the one below.\n",
"* `Alt-Enter` runs the current cell and inserts a new one below.\n",
"* `Ctrl-Enter` run the current cell and enters command mode in current cell.\n",
"\n",
"<div class=\"alert alert-success\">\n",
"Press `h` anytime in command mode for a keyboard shotcut list.\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Tab completion & help (edit mode)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Tab completion**, especially for attributes, is a convenient way to explore the structure of any object you’re dealing with. Simply type in a code cell `object_name.<TAB>` to view the object’s attributes. Besides Python objects and keywords, tab completion also works on file and directory names.\n",
"\n",
"For getting an object **help**, type `object_name.<SHIFT+TAB>` and a tooltip with the object short help will open. Pressing `<TAB>` twice (`<SHIFT+TAB+TAB>`) the full object help will open. Doing it four times and the full object help will go into a new frame."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## References \n",
"\n",
"* This tutorial was essentially based in [IPython's notebook-based documentation](http://nbviewer.ipython.org/github/ipython/ipython/blob/3.x/examples/Index.ipynb). Take a look at it for a more extensive introduction to IPython.\n",
"\n",
"* Official [IPython notebook begginer guide](http://jupyter-notebook-beginner-guide.readthedocs.org/en/latest/index.html#).\n",
"\n",
"* [A gallery of interesting IPython Notebooks](https://github.com/ipython/ipython/wiki/A-gallery-of-interesting-IPython-Notebooks#scientific-computing-and-data-analysis-with-the-scipy-stack)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment