kopia lustrzana https://github.com/jupyterhub/repo2docker
196 wiersze
39 KiB
Plaintext
196 wiersze
39 KiB
Plaintext
![]() |
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Introduction"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Jupyter notebooks ([@perez2015project; @kluyver2016jupyter; @ragan2014jupyter]) are one of the most popular platforms for doing reproducible research. Stencila supports importing of Jupyter Notebook `.ipynb` files. This allows you to work with collegues to refine a document for final publication while still retaining the code cells, and thus reprodubility of your the work. In the future we also plan to support exporting to `.ipynb` files. "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Markdown cells\n",
|
||
|
"\n",
|
||
|
"Most standard Markdown should be supported by the importer including inline `code`, headings etc (although the Stencila user interface do not currently support rendering of some elements e.g. math and lists).\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Code cells\n",
|
||
|
"\n",
|
||
|
"Code cells in notebooks are imported without loss. Stencila's user interface currently differs from Jupyter in that code cells are executed on update while you are typing. This produces a very reactive user experience but is inappropriate for more compute intensive, longer running code cells. We are currently working on improving this to allowing users to decide to execute cells explicitly (e.g. using `Ctrl+Enter`)."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"'Hello this is Python 3.5 and it is Tue Feb 13 10:56:10 2018'"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import sys\n",
|
||
|
"import time\n",
|
||
|
"'Hello this is Python %s.%s and it is %s' % (sys.version_info[0], sys.version_info[1], time.strftime('%c'))\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Stencila also support Jupyter code cells that produce plots. The cell below produces a simple plot based on the example from [the Matplotlib website](https://matplotlib.org/examples/shapes_and_collections/scatter_demo.html). Try changing the code below (for example, the variable `N`)."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 6,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEACAYAAABVtcpZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzs3Xd4XNWZ+PHvmS6NRr1Xq1rutmzZxlVuGJtmgwkQwIEA\nSTaQzS5kf8lmG9mS3WxIZwOh94TQm40xxgX33iVbtixZvY/q9Dm/PwS4qI40siTrfJ5Hz+OZuffc\nc63Rfe895T1CSomiKIoyOmmGugKKoijK0FFBQFEUZRRTQUBRFGUUU0FAURRlFFNBQFEUZRRTQUBR\nFGUU80sQEEI8J4SoFkIc7ebzbwohjnz5s10IMckfx1UURVEGxl9PAi8Ay3v4vAhYIKWcAvwn8Iyf\njqsoiqIMgM4fhUgptwshUnr4fPdFL3cDCf44rqIoijIwQ9En8ACwfgiOqyiKolzGL08CfSWEWATc\nB8y7ksdVFEVRunbFgoAQYjLwNHCdlLKxh+1UMiNFURQfSSlFf/bzZ3OQ+PKn8wdCJANvA/dIKc/2\nVpCUckT+/Nu//duQ10HVf+jroeo/Mn9Gcv0Hwi9PAkKI14E8IEIIcR74N8AASCnl08C/AOHAH4UQ\nAnBJKWf649iKoihK//lrdNA3e/n8QeBBfxxLURRF8R81Y9iP8vLyhroKA6LqP7RU/YfWS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Tw8nLlz516RYwFotVo8A2jT93q9aP008kpRrhYqCPigoakec5R/\nnwIA9AY9WpOGtrY2goODMRqN3HrrKubMmcW2bTv5/PNNuFwBSGlBowlECPHl8M8WoJn4+GBuu20h\nOTnTruqx8MHBwbQBLo+
|
||
|
"text/plain": [
|
||
|
"<matplotlib.figure.Figure at 0x7fb7526ab588>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"\n",
|
||
|
"N = 50\n",
|
||
|
"N = min(N, 1000) # Prevent generation of too many numbers :)\n",
|
||
|
"x = np.random.rand(N)\n",
|
||
|
"y = np.random.rand(N)\n",
|
||
|
"colors = np.random.rand(N)\n",
|
||
|
"area = np.pi * (15 * np.random.rand(N))**2 # 0 to 15 point radii\n",
|
||
|
"\n",
|
||
|
"plt.scatter(x, y, s=area, c=colors, alpha=0.5)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"We are currently working on supporting [Jupyter's magic commands](http://ipython.readthedocs.io/en/stable/interactive/magics.html) in Stencila via a bridge to Jupyter kernels."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Metadata\n",
|
||
|
"\n",
|
||
|
"To add some metadata about the document (such as authors, title, abstract and so on), In Jupyter, select `Edit -> Edit Notebook metadata` from the top menu. Add the title and abstract as JSON strings and authors and organisations metadata as [JSON arrays](https://www.w3schools.com/js/js_json_arrays.asp). Author `affiliation` identifiers (like `university-of-earth` below) must be unique and preferably use only lowercase characters and no spaces.\n",
|
||
|
" \n",
|
||
|
"For example,"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"```\n",
|
||
|
" \"authors\": [\n",
|
||
|
" {\n",
|
||
|
" \"given-names\": \"Your first name goes here\",\n",
|
||
|
" \"surname\": \"Your last name goes here\",\n",
|
||
|
" \"email\": \"your.email@your-organisation\",\n",
|
||
|
" \"corresponding\": \"yes / no\",\n",
|
||
|
" \"affiliation\": \"university-of-earth\"\n",
|
||
|
" }\n",
|
||
|
" ],\n",
|
||
|
" \n",
|
||
|
" \"organisations\": [ \n",
|
||
|
" {\n",
|
||
|
" \"university-of-earth\": {\n",
|
||
|
" \"institution\": \"Your organisation name\",\n",
|
||
|
" \"city\": \"Your city\",\n",
|
||
|
" \"country\": \"Your country\" \n",
|
||
|
" }\n",
|
||
|
" ],\n",
|
||
|
"\n",
|
||
|
" \"title\": \"Your title goes here\",\n",
|
||
|
" \"abstract\": \"This is a paper about lots of different interesting things\",\n",
|
||
|
" \n",
|
||
|
" ```\n",
|
||
|
" \n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Citations and references \n",
|
||
|
"\n",
|
||
|
"Stencila supports Pandoc style citations and reference lists within Jupyter notebook Markdown cells. Add a `bibliography` entry to the notebook's metadata which points to a file containing your list of references e.g.\n",
|
||
|
"\n",
|
||
|
"```json\n",
|
||
|
"\"bibliography\": \"my-bibliography.bibtex\"\n",
|
||
|
"```\n",
|
||
|
"\n",
|
||
|
"Then, within Markdown cells, you can insert citations inside square brackets and separated by semicolons. Each citation is represented using the `@` symbol followed by the citation identifier from the bibliography database e.g.\n",
|
||
|
"\n",
|
||
|
"```json\n",
|
||
|
"[@perez2015project; @kluyver2016jupyter]\n",
|
||
|
"```\n",
|
||
|
"\n",
|
||
|
"The [cite2c](https://github.com/takluyver/cite2c) Jupyter extension allows for easier, \"cite-while-you-write\" insertion of citations from a Zotero library. We're hoping to support conversion of cite2cstyle citations/references in the [future](https://github.com/stencila/convert/issues/14).\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"anaconda-cloud": {},
|
||
|
"authors": [
|
||
|
{
|
||
|
"given-names": "Aleksandra",
|
||
|
"surname": "Pawlik"
|
||
|
}
|
||
|
],
|
||
|
"bibliography": "bibliography.bibtex",
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.5.2"
|
||
|
},
|
||
|
"title": "Jupyter and Stencila"
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|